pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   pho
Date:           Thu Jan  9 12:29:32 UTC 2020

Modified Files:
        pkgsrc/mk: haskell.mk
        pkgsrc/mk/haskell: DEINSTALL.in INSTALL.in

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 pkgsrc/mk/haskell.mk
cvs rdiff -u -r1.1 -r1.2 pkgsrc/mk/haskell/DEINSTALL.in \
    pkgsrc/mk/haskell/INSTALL.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/haskell.mk
diff -u pkgsrc/mk/haskell.mk:1.10 pkgsrc/mk/haskell.mk:1.11
--- pkgsrc/mk/haskell.mk:1.10   Thu Jan  2 16:45:15 2020
+++ pkgsrc/mk/haskell.mk        Thu Jan  9 12:29:32 2020
@@ -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 @@ _DEF_VARS.haskell= \
        _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 @@ HASKELL_ENABLE_HADDOCK_DOCUMENTATION?=      y
 # 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 @@ do-build:
 # 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 @@ do-test:
                ./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

Index: pkgsrc/mk/haskell/DEINSTALL.in
diff -u pkgsrc/mk/haskell/DEINSTALL.in:1.1 pkgsrc/mk/haskell/DEINSTALL.in:1.2
--- pkgsrc/mk/haskell/DEINSTALL.in:1.1  Wed Feb  5 07:02:30 2014
+++ pkgsrc/mk/haskell/DEINSTALL.in      Thu Jan  9 12:29:32 2020
@@ -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
Index: pkgsrc/mk/haskell/INSTALL.in
diff -u pkgsrc/mk/haskell/INSTALL.in:1.1 pkgsrc/mk/haskell/INSTALL.in:1.2
--- pkgsrc/mk/haskell/INSTALL.in:1.1    Wed Feb  5 07:02:30 2014
+++ pkgsrc/mk/haskell/INSTALL.in        Thu Jan  9 12:29:32 2020
@@ -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 @@ HASKELL_PKG_DESCR_FILE="@HASKELL_PKG_DES
 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