pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Run pkg_add(1) and pkg_delete(1) using ${SETENV} ${...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8a3c0553061a
branches:  trunk
changeset: 366912:8a3c0553061a
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Sat Aug 19 00:30:19 2017 +0000

description:
Run pkg_add(1) and pkg_delete(1) using ${SETENV} ${PKGTOOLS_ENV}.

PKGTOOLS_ENV allows for passing environment variables to the
package install and deinstall scripts.

diffstat:

 mk/install/bin-install.mk          |   6 +++---
 mk/pkgformat/pkg/deinstall.mk      |   6 +++---
 mk/pkgformat/pkg/package.mk        |   9 +++++----
 mk/pkgformat/pkg/pkgformat-vars.mk |   7 ++++++-
 mk/pkgformat/pkg/replace.mk        |  10 +++++-----
 5 files changed, 22 insertions(+), 16 deletions(-)

diffs (142 lines):

diff -r 6a8095e2a4a3 -r 8a3c0553061a mk/install/bin-install.mk
--- a/mk/install/bin-install.mk Sat Aug 19 00:30:07 2017 +0000
+++ b/mk/install/bin-install.mk Sat Aug 19 00:30:19 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bin-install.mk,v 1.25 2016/06/16 18:28:45 mspo Exp $
+# $NetBSD: bin-install.mk,v 1.26 2017/08/19 00:30:19 jlam Exp $
 #
 
 # This file provides the following targets:
@@ -93,7 +93,7 @@
 .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
        ${RUN} ${_BIN_INSTALL_PREPARE_CMD}                              \
        ${STEP_MSG} "Installing ${PKGNAME} from $$pkg_path";            \
-       if ${PKGSRC_SETENV} PKG_PATH="$$pkg_path" ${PKG_ADD} -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${_BIN_INSTALL_FLAGS} ${PKGNAME_REQD:Q}${PKG_SUFX}; then \
+       if ${PKGSRC_SETENV} PKG_PATH="$$pkg_path" ${PKGTOOLS_ENV} ${PKG_ADD} -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${_BIN_INSTALL_FLAGS} ${PKGNAME_REQD:Q}${PKG_SUFX}; then \
                ${ECHO} "Fixing recorded cwd...";                       \
                ${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp; \
                ${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS; \
@@ -103,7 +103,7 @@
        ${RUN} ${_BIN_INSTALL_PREPARE_CMD}                              \
        pkgpattern=${PKGNAME_REQD:Q};                                   \
        ${STEP_MSG} "Installing $$pkgpattern from $$pkg_path";          \
-       if ${PKGSRC_SETENV} PKG_PATH="$$pkg_path" ${PKG_ADD} ${_BIN_INSTALL_FLAGS} "$$pkgpattern"; then \
+       if ${PKGSRC_SETENV} PKG_PATH="$$pkg_path" ${PKGTOOLS_ENV} ${PKG_ADD} ${_BIN_INSTALL_FLAGS} "$$pkgpattern"; then \
                installed=`${PKG_INFO} -e "$$pkgpattern"`;              \
                ${ECHO} "$$installed successfully installed.";          \
        fi
diff -r 6a8095e2a4a3 -r 8a3c0553061a mk/pkgformat/pkg/deinstall.mk
--- a/mk/pkgformat/pkg/deinstall.mk     Sat Aug 19 00:30:07 2017 +0000
+++ b/mk/pkgformat/pkg/deinstall.mk     Sat Aug 19 00:30:19 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: deinstall.mk,v 1.2 2013/05/09 23:37:26 riastradh Exp $
+# $NetBSD: deinstall.mk,v 1.3 2017/08/19 00:30:19 jlam Exp $
 
 # Set the appropriate flags to pass to pkg_delete(1) based on the value
 # of DEINSTALLDEPENDS (see pkgsrc/mk/install/deinstall.mk).
@@ -43,7 +43,7 @@
        esac;                                                           \
        if ${TEST} -n "$$found"; then                                   \
                ${ECHO} "Running ${PKG_DELETE} ${_PKG_ARGS_DEINSTALL} $$found"; \
-               ${PKG_DELETE} ${_PKG_ARGS_DEINSTALL} "$$found" || ${TRUE} ; \
+               ${SETENV} ${PKGTOOLS_ENV} ${PKG_DELETE} ${_PKG_ARGS_DEINSTALL} "$$found" || ${TRUE} ; \
        fi
 .if defined(DEINSTALLDEPENDS) && !empty(DEINSTALLDEPENDS:M[yY][eE][sS])
 # XXX Need to handle BUILD_DEPENDS/TOOL_DEPENDS split.
@@ -52,7 +52,7 @@
        found=`${_PKG_BEST_EXISTS} ${_pkg_:Q} || ${TRUE}`;              \
        if ${TEST} -n "$$found"; then                                   \
                ${ECHO} "Running ${PKG_DELETE} ${_PKG_ARGS_DEINSTALL} $$found"; \
-               ${PKG_DELETE} ${_PKG_ARGS_DEINSTALL} "$$found" || ${TRUE}; \
+               ${SETENV} ${PKGTOOLS_ENV} ${PKG_DELETE} ${_PKG_ARGS_DEINSTALL} "$$found" || ${TRUE}; \
        fi
 .  endfor
 .endif
diff -r 6a8095e2a4a3 -r 8a3c0553061a mk/pkgformat/pkg/package.mk
--- a/mk/pkgformat/pkg/package.mk       Sat Aug 19 00:30:07 2017 +0000
+++ b/mk/pkgformat/pkg/package.mk       Sat Aug 19 00:30:19 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.15 2016/05/09 00:07:23 joerg Exp $
+# $NetBSD: package.mk,v 1.16 2017/08/19 00:30:19 jlam Exp $
 
 .if defined(PKG_SUFX)
 WARNINGS+=             "PKG_SUFX is deprecated, please use PKG_COMPRESSION"
@@ -144,13 +144,14 @@
        @${PHASE_MSG} "Installing binary package of "${PKGNAME:Q}
 .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
        @${MKDIR} ${_CROSS_DESTDIR}${PREFIX}
-       ${PKG_ADD} -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${STAGE_PKGFILE}
+       ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${STAGE_PKGFILE}
        @${ECHO} "Fixing recorded cwd..."
        @${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp
        @${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS
 .else
        ${RUN} case ${_AUTOMATIC:Q}"" in                                        \
-       [yY][eE][sS])   ${PKG_ADD} -A ${STAGE_PKGFILE} ;;               \
-       *)              ${PKG_ADD} ${STAGE_PKGFILE} ;;                  \
+       [yY][eE][sS])                                                           \
+               ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} -A ${STAGE_PKGFILE} ;;     \
+       *)      ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} ${STAGE_PKGFILE} ;;        \
        esac
 .endif
diff -r 6a8095e2a4a3 -r 8a3c0553061a mk/pkgformat/pkg/pkgformat-vars.mk
--- a/mk/pkgformat/pkg/pkgformat-vars.mk        Sat Aug 19 00:30:07 2017 +0000
+++ b/mk/pkgformat/pkg/pkgformat-vars.mk        Sat Aug 19 00:30:19 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: pkgformat-vars.mk,v 1.6 2016/04/10 15:20:26 joerg Exp $
+# $NetBSD: pkgformat-vars.mk,v 1.7 2017/08/19 00:30:19 jlam Exp $
 #
 # This Makefile fragment is included indirectly by bsd.prefs.mk and
 # defines some variables which must be defined earlier than where
@@ -37,6 +37,11 @@
 # Latest version of pkg_install required to extract packages
 PKGTOOLS_VERSION_REQD= 20091115
 
+# Environment used when invoking package tools.  This is used to pass
+# environment variables to the package install and deinstall scripts.
+#
+PKGTOOLS_ENV?=         # empty
+
 .if !defined(PKGTOOLS_VERSION)
 PKGTOOLS_VERSION!=     ${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
 MAKEFLAGS+=            PKGTOOLS_VERSION=${PKGTOOLS_VERSION}
diff -r 6a8095e2a4a3 -r 8a3c0553061a mk/pkgformat/pkg/replace.mk
--- a/mk/pkgformat/pkg/replace.mk       Sat Aug 19 00:30:07 2017 +0000
+++ b/mk/pkgformat/pkg/replace.mk       Sat Aug 19 00:30:19 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.4 2016/09/19 12:26:08 gdt Exp $
+# $NetBSD: replace.mk,v 1.5 2017/08/19 00:30:19 jlam Exp $
 #
 
 # _pkgformat-destdir-replace:
@@ -90,13 +90,13 @@
        @${PHASE_MSG} "Re-adding ${PKGNAME} from saved tar-up package."
        ${RUN} ${_REPLACE_OLDNAME_CMD};                                 \
        ${ECHO} "Installing saved package ${WRKDIR}/$${oldname}${PKG_SUFX}"; \
-       ${PKG_ADD} ${WRKDIR}/$${oldname}${PKG_SUFX}
+       ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} ${WRKDIR}/$${oldname}${PKG_SUFX}
 
 undo-destdir-replace-install: .PHONY
        @${PHASE_MSG} "Re-adding ${PKGNAME} from saved tar-up package."
        ${RUN} ${_REPLACE_OLDNAME_CMD};                                 \
        ${ECHO} "Installing saved package ${WRKDIR}/$${oldname}${PKG_SUFX}"; \
-       ${PKG_ADD} -U -D ${WRKDIR}/$${oldname}${PKG_SUFX}
+       ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} -U -D ${WRKDIR}/$${oldname}${PKG_SUFX}
 
 # Computes and saves the full names of the installed package to be replaced
 # (oldname) and the package that will be installed (newname), so that these
@@ -202,12 +202,12 @@
        @${PHASE_MSG} "Updating using binary package of "${PKGNAME:Q}
 .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
        @${MKDIR} ${_CROSS_DESTDIR}${PREFIX}
-       ${PKG_ADD} -U -D -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${STAGE_PKGFILE}
+       ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} -U -D -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${STAGE_PKGFILE}
        @${ECHO} "Fixing recorded cwd..."
        @${SED} -e 's|@cwd ${_CROSS_DESTDIR}|@cwd |' ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS > ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp
        @${MV} ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS.tmp ${_PKG_DBDIR}/${PKGNAME:Q}/+CONTENTS
 .else
-       ${PKG_ADD} -U -D ${STAGE_PKGFILE}
+       ${SETENV} ${PKGTOOLS_ENV} ${PKG_ADD} -U -D ${STAGE_PKGFILE}
 .endif
        ${RUN}${_REPLACE_OLDNAME_CMD}; \
        ${PKG_INFO} -qR ${PKGNAME:Q} | while read pkg; do \



Home | Main Index | Thread Index | Old Index