Author: matthew (ports committer)
Date: Wed Nov 30 07:16:29 2016
New Revision: 309314
URL: https://svnweb.freebsd.org/changeset/base/309314

Log:
  Allow a user-overridable setting 'PKG_CMD' to control the command used
  to create a repo during 'make packages'
  
  This would have been useful for a situation I found myself in where
  pkg(8) had been upgraded to a version that wanted the FBSD_1.5 ABI
  version but libc.so.7 had not been upgraded, and only provided
  FBSD_1.4. I found I needed to update libc in order to run pkg, and I
  also needed to use pkg to update libc... Which is why pkg-static
  exists, but there's currently no way to tell the build system to use
  pkg-static instead of pkg.
  
  This creates a variable PKG_CMD, default value 'pkg', that can be
  overridden from the command line.
  
  Reviewed by:  gjb
  Approved by:  gjb
  Differential Revision:        https://reviews.freebsd.org/D8120

Modified:
  head/Makefile.inc1
  head/release/scripts/make-pkg-package.sh
  head/share/mk/bsd.own.mk

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1  Wed Nov 30 06:26:37 2016        (r309313)
+++ head/Makefile.inc1  Wed Nov 30 07:16:29 2016        (r309314)
@@ -1379,7 +1379,8 @@ packages: .PHONY
 package-pkg: .PHONY
        rm -rf /tmp/ports.${TARGET} || :
        env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} 
REVISION=${_REVISION} \
-               PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} 
WSTAGEDIR=${WSTAGEDIR} \
+               PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} 
REPODIR=${REPODIR} \
+               WSTAGEDIR=${WSTAGEDIR} \
                sh ${.CURDIR}/release/scripts/make-pkg-package.sh
 
 real-packages: stage-packages create-packages sign-packages .PHONY
@@ -1417,11 +1418,11 @@ create-world-packages:  _pkgbootstrap .PH
                        /^name/ { printf("===> Creating %s-", $$2); next } \
                        /^version/ { print $$2; next } \
                        ' ${WSTAGEDIR}/$${pkgname}.ucl ; \
-               pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
+               ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o 
ALLOW_BASE_SHLIBS=yes \
                        create -M ${WSTAGEDIR}/$${pkgname}.ucl \
                        -p ${WSTAGEDIR}/$${pkgname}.plist \
                        -r ${WSTAGEDIR} \
-                       -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION} ; \
+                       -o ${REPODIR}/$$(${PKG_CMD} -o 
ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} ; \
        done
 
 create-kernel-packages:        _pkgbootstrap .PHONY
@@ -1445,11 +1446,11 @@ create-kernel-packages: _pkgbootstrap .P
                /name/ { printf("===> Creating %s-", $$2); next } \
                /version/ {print $$2; next } ' \
                ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
-       pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
+       ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
                create -M 
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
                -p 
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
                -r ${KSTAGEDIR}/${DISTDIR} \
-               -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}
+               -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION}
 .endfor
 .endif
 .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
@@ -1474,25 +1475,25 @@ create-kernel-packages: _pkgbootstrap .P
                /name/ { printf("===> Creating %s-", $$2); next } \
                /version/ {print $$2; next } ' \
                ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; 
\
-       pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
+       ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
                create -M 
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
                -p 
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
                -r ${KSTAGEDIR}/kernel.${_kernel} \
-               -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}
+               -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION}
 .endfor
 .endif
 .endfor
 .endif
 
 sign-packages: _pkgbootstrap .PHONY
-       @[ -L "${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest" ] && \
-               unlink ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest ; \
-       pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
-               -o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
-               ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
+       @[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest" ] && \
+               unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/latest ; \
+       ${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
+               -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh 
config ABI)/${PKG_VERSION} \
+               ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
                ${PKGSIGNKEY} ; \
-       ln -s ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
-               ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest
+       ln -s ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION} \
+               ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/latest
 
 #
 #

Modified: head/release/scripts/make-pkg-package.sh
==============================================================================
--- head/release/scripts/make-pkg-package.sh    Wed Nov 30 06:26:37 2016        
(r309313)
+++ head/release/scripts/make-pkg-package.sh    Wed Nov 30 07:16:29 2016        
(r309314)
@@ -8,6 +8,7 @@ eval $(make -C ${SRCDIR} TARGET=${TARGET
 export WRKDIRPREFIX=/tmp/ports.${TARGET}
 export WSTAGEDIR=${WSTAGEDIR}
 export REPODIR=${REPODIR}
+export PKG_CMD=${PKG_CMD}
 export PKG_VERSION=${PKG_VERSION}
 export WRKDIR=$(make -C ${PORTSDIR}/ports-mgmt/pkg -V WRKDIR)
 
@@ -15,11 +16,11 @@ make -C ${PORTSDIR}/ports-mgmt/pkg TARGE
        CONFIGURE_ARGS="--host=$(uname -m)-portbld-freebsd${REVISION}" \
        stage create-manifest
 
-pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh \
+${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh \
        create -v -m ${WRKDIR}/.metadir/ \
        -r ${WRKDIR}/stage \
        -p ${WRKDIR}/.PLIST.mktmp \
-       -o ${REPODIR}/$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}
-mkdir -p ${REPODIR}/$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}/Latest/
-cd ${REPODIR}/$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}/Latest/ && \
+       -o ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}
+mkdir -p ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}/Latest/
+cd ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config 
ABI)/${PKG_VERSION}/Latest/ && \
        ln -s ../pkg-*.txz

Modified: head/share/mk/bsd.own.mk
==============================================================================
--- head/share/mk/bsd.own.mk    Wed Nov 30 06:26:37 2016        (r309313)
+++ head/share/mk/bsd.own.mk    Wed Nov 30 07:16:29 2016        (r309314)
@@ -116,6 +116,9 @@
 # NLSMODE      National Language Support files mode. [${NOBINMODE}]
 #
 # INCLUDEDIR   Base path for standard C include files [/usr/include]
+#
+# PKG_CMD      Program for creating and manipulating packages.
+#               [pkg] 
 
 .if !target(__<bsd.own.mk>__)
 __<bsd.own.mk>__:
@@ -249,6 +252,8 @@ XZ_CMD?=    xz -T ${XZ_THREADS}
 XZ_CMD?=       xz
 .endif
 
+PKG_CMD?=      pkg
+
 # Pointer to the top directory into which tests are installed.  Should not be
 # overriden by Makefiles, but the user may choose to set this in src.conf(5).
 TESTSBASE?= /usr/tests
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to