pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Use hashed package keys for (un)installing Cabal pa...
details: https://anonhg.NetBSD.org/pkgsrc/rev/b25ce1d30dba
branches: trunk
changeset: 420923:b25ce1d30dba
user: pho <pho%pkgsrc.org@localhost>
date: Thu Jan 09 12:29:32 2020 +0000
description:
Use hashed package keys for (un)installing Cabal packages
Starting from somewhere around GHC 7.8, Cabal installs packages with a
hashed package key instead of just "{NAME}-{VERSION}". In other words,
the pair of the plain package name and the version is no longer unique
in the package DB, and using it for uninstallation may also remove
packages that we didn't mean to remove.
This is paricularly problematic because GHC comes with several bundled
Cabal packages. Installing and uninstalling a package with the same
name could break GHC itself, if the uninstallation is performed
without hashed keys.
diffstat:
mk/haskell.mk | 20 ++++++++++++++------
mk/haskell/DEINSTALL.in | 11 +++++------
mk/haskell/INSTALL.in | 4 ++--
3 files changed, 21 insertions(+), 14 deletions(-)
diffs (105 lines):
diff -r 3f6366465db0 -r b25ce1d30dba mk/haskell.mk
--- a/mk/haskell.mk Thu Jan 09 12:22:03 2020 +0000
+++ b/mk/haskell.mk Thu Jan 09 12:29:32 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: haskell.mk,v 1.10 2020/01/02 16:45:15 pho Exp $
+# $NetBSD: haskell.mk,v 1.11 2020/01/09 12:29:32 pho Exp $
#
# This Makefile fragment handles Haskell Cabal packages.
# See: http://www.haskell.org/cabal/
@@ -107,6 +107,7 @@
_HASKELL_BIN \
_HASKELL_PKG_BIN \
_HASKELL_PKG_DESCR_FILE \
+ _HASKELL_PKG_ID_FILE \
_HASKELL_VERSION
_USER_VARS.haskell= \
HASKELL_ENABLE_SHARED_LIBRARY \
@@ -140,7 +141,7 @@
# Compiler specific variables and targets.
.if ${HASKELL_COMPILER} == "ghc"
-# Add dependency to the GHC.
+# Add dependency on GHC.
.include "../../lang/ghc7/buildlink3.mk"
# Tools
@@ -241,15 +242,22 @@
# for package registration (if any).
_HASKELL_PKG_DESCR_DIR= ${PREFIX}/lib/${DISTNAME}/${_HASKELL_VERSION}
_HASKELL_PKG_DESCR_FILE= ${_HASKELL_PKG_DESCR_DIR}/package-description
+_HASKELL_PKG_ID_FILE= ${_HASKELL_PKG_DESCR_DIR}/package-id
INSTALLATION_DIRS+= ${_HASKELL_PKG_DESCR_DIR}
do-install:
${RUN}cd ${WRKSRC} && \
- ./Setup register ${PKG_VERBOSE:D-v} --gen-pkg-config=dist/package-description && \
+ ./Setup register ${PKG_VERBOSE:D-v} \
+ --gen-pkg-config=dist/package-description \
+ --print-ipid \
+ > dist/package-id && \
./Setup copy ${PKG_VERBOSE:D-v} --destdir=${DESTDIR:Q} && \
if [ -f dist/package-description ]; then \
- ${INSTALL_DATA} dist/package-description ${DESTDIR:Q}${_HASKELL_PKG_DESCR_FILE:Q}; \
- fi \
+ ${INSTALL_DATA} dist/package-description \
+ ${DESTDIR:Q}${_HASKELL_PKG_DESCR_FILE:Q}; \
+ ${INSTALL_DATA} dist/package-id \
+ ${DESTDIR:Q}${_HASKELL_PKG_ID_FILE:Q}; \
+ fi
# Define test target.
do-test:
@@ -257,9 +265,9 @@
./Setup test ${PKG_VERBOSE:D-v}
# Substitutions for INSTALL and DEINSTALL.
-FILES_SUBST+= DISTNAME=${DISTNAME}
FILES_SUBST+= HASKELL_PKG_BIN=${_HASKELL_PKG_BIN}
FILES_SUBST+= HASKELL_PKG_DESCR_FILE=${_HASKELL_PKG_DESCR_FILE}
+FILES_SUBST+= HASKELL_PKG_ID_FILE=${_HASKELL_PKG_ID_FILE}
INSTALL_TEMPLATES+= ../../mk/haskell/INSTALL.in
DEINSTALL_TEMPLATES+= ../../mk/haskell/DEINSTALL.in
diff -r 3f6366465db0 -r b25ce1d30dba mk/haskell/DEINSTALL.in
--- a/mk/haskell/DEINSTALL.in Thu Jan 09 12:22:03 2020 +0000
+++ b/mk/haskell/DEINSTALL.in Thu Jan 09 12:29:32 2020 +0000
@@ -1,14 +1,13 @@
# -*- sh -*-
-# $NetBSD: DEINSTALL.in,v 1.1 2014/02/05 07:02:30 obache Exp $
+# $NetBSD: DEINSTALL.in,v 1.2 2020/01/09 12:29:32 pho Exp $
#
-DISTNAME="@DISTNAME@"
HASKELL_PKG_BIN="@HASKELL_PKG_BIN@"
-HASKELL_PKG_DESCR_FILE="@HASKELL_PKG_DESCR_FILE@"
+HASKELL_PKG_ID_FILE="@HASKELL_PKG_ID_FILE@"
-case ${STAGE} in
+case ${STAGE} in
DEINSTALL)
- if [ -f ${HASKELL_PKG_DESCR_FILE} ]; then
- ${HASKELL_PKG_BIN} unregister --force ${DISTNAME}
+ if [ -f ${HASKELL_PKG_ID_FILE} ]; then
+ ${HASKELL_PKG_BIN} unregister --force --ipid `cat "$HASKELL_PKG_ID_FILE"`
fi
;;
esac
diff -r 3f6366465db0 -r b25ce1d30dba mk/haskell/INSTALL.in
--- a/mk/haskell/INSTALL.in Thu Jan 09 12:22:03 2020 +0000
+++ b/mk/haskell/INSTALL.in Thu Jan 09 12:29:32 2020 +0000
@@ -1,5 +1,5 @@
# -*- sh -*-
-# $NetBSD: INSTALL.in,v 1.1 2014/02/05 07:02:30 obache Exp $
+# $NetBSD: INSTALL.in,v 1.2 2020/01/09 12:29:32 pho Exp $
#
HASKELL_PKG_BIN="@HASKELL_PKG_BIN@"
HASKELL_PKG_DESCR_FILE="@HASKELL_PKG_DESCR_FILE@"
@@ -7,7 +7,7 @@
case ${STAGE} in
POST-INSTALL)
if [ -f ${HASKELL_PKG_DESCR_FILE} ]; then
- ${HASKELL_PKG_BIN} update ${HASKELL_PKG_DESCR_FILE};
+ ${HASKELL_PKG_BIN} register ${HASKELL_PKG_DESCR_FILE};
fi
;;
esac
Home |
Main Index |
Thread Index |
Old Index