summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/bsd.pkg.barrier.mk3
-rw-r--r--mk/install/bsd.install.mk4
-rw-r--r--mk/install/replace.mk4
-rw-r--r--mk/package/package.mk3
-rw-r--r--mk/pkgformat/pkg/package.mk51
-rw-r--r--mk/pkgformat/pkg/replace.mk6
6 files changed, 57 insertions, 14 deletions
diff --git a/mk/bsd.pkg.barrier.mk b/mk/bsd.pkg.barrier.mk
index d60b8377e26..a400865acef 100644
--- a/mk/bsd.pkg.barrier.mk
+++ b/mk/bsd.pkg.barrier.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.barrier.mk,v 1.18 2010/02/24 22:53:34 joerg Exp $
+# $NetBSD: bsd.pkg.barrier.mk,v 1.19 2013/05/23 13:18:56 obache Exp $
_COOKIE.barrier= ${WRKDIR}/.barrier_cookie
@@ -23,6 +23,7 @@ _BARRIER_POST_TARGETS+= build build-env
_BARRIER_POST_TARGETS+= test
_BARRIER_POST_TARGETS+= all
_BARRIER_POST_TARGETS+= stage-install
+_BARRIER_POST_TARGETS+= stage-package-create
_BARRIER_POST_TARGETS+= reinstall
_BARRIER_POST_TARGETS+= replace
_BARRIER_POST_TARGETS+= package
diff --git a/mk/install/bsd.install.mk b/mk/install/bsd.install.mk
index 2486c5da14e..014f2f65e25 100644
--- a/mk/install/bsd.install.mk
+++ b/mk/install/bsd.install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.install.mk,v 1.13 2010/02/24 22:53:34 joerg Exp $
+# $NetBSD: bsd.install.mk,v 1.14 2013/05/23 13:18:56 obache Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to installing packages.
@@ -25,7 +25,7 @@ _COOKIE.install= ${WRKDIR}/.install_done
.if ${_USE_DESTDIR} == "no"
install: stage-install
.else
-install: package-install
+install: stage-package-install
.endif
######################################################################
diff --git a/mk/install/replace.mk b/mk/install/replace.mk
index 5fecc4d96f9..41a1ab6c929 100644
--- a/mk/install/replace.mk
+++ b/mk/install/replace.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.14 2011/10/15 00:23:09 reed Exp $
+# $NetBSD: replace.mk,v 1.15 2013/05/23 13:18:56 obache Exp $
#
# Public targets:
#
@@ -28,7 +28,7 @@
.if ${_USE_DESTDIR} == "no"
_REPLACE_TARGETS+= ${_PKGSRC_BUILD_TARGETS}
.else
-_REPLACE_TARGETS+= package
+_REPLACE_TARGETS+= stage-package-create
.endif
_REPLACE_TARGETS+= replace-message
_REPLACE_TARGETS+= unprivileged-install-hook
diff --git a/mk/package/package.mk b/mk/package/package.mk
index 947c4d0a2c6..0fe7781223f 100644
--- a/mk/package/package.mk
+++ b/mk/package/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.23 2011/10/15 00:23:09 reed Exp $
+# $NetBSD: package.mk,v 1.24 2013/05/23 13:18:56 obache Exp $
#
# This file provides the code for the "package" phase.
#
@@ -17,6 +17,7 @@ _PACKAGE_TARGETS+= check-vulnerable
_PACKAGE_TARGETS+= replace
.else
_PACKAGE_TARGETS+= stage-install
+_PACKAGE_TARGETS+= stage-package-create
.endif
_PACKAGE_TARGETS+= acquire-package-lock
_PACKAGE_TARGETS+= ${_COOKIE.package}
diff --git a/mk/pkgformat/pkg/package.mk b/mk/pkgformat/pkg/package.mk
index cdee24570f4..7929bb93972 100644
--- a/mk/pkgformat/pkg/package.mk
+++ b/mk/pkgformat/pkg/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.1 2011/10/15 00:23:09 reed Exp $
+# $NetBSD: package.mk,v 1.2 2013/05/23 13:18:56 obache Exp $
.if defined(PKG_SUFX)
WARNINGS+= "PKG_SUFX is deprecated, please use PKG_COMPRESSION"
@@ -13,6 +13,11 @@ WARNINGS+= "Unsupported value for PKG_SUFX"
PKG_SUFX?= .tgz
FILEBASE?= ${PKGBASE}
PKGFILE?= ${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
+.if ${_USE_DESTDIR} == "no"
+STAGE_PKGFILE?= ${PKGFILE}
+.else
+STAGE_PKGFILE?= ${WRKDIR}/.packages/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
+.endif
PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
PKGREPOSITORYSUBDIR?= All
@@ -35,6 +40,18 @@ package-check-installed:
.PHONY: package-create
package-create: package-remove ${PKGFILE} package-links
+######################################################################
+### stage-package-create (PRIVATE, pkgsrc/mk/package/package.mk)
+######################################################################
+### stage-package-create creates the binary package for stage install.
+###
+.PHONY: stage-package-create
+.if ${_USE_DESTDIR} == "no"
+stage-package-create: package-create
+.else
+stage-package-create: stage-install stage-package-remove ${STAGE_PKGFILE}
+.endif
+
_PKG_ARGS_PACKAGE+= ${_PKG_CREATE_ARGS}
_PKG_ARGS_PACKAGE+= -F ${PKG_COMPRESSION}
.if ${_USE_DESTDIR} == "no"
@@ -49,7 +66,7 @@ _PKG_ARGS_PACKAGE+= -u ${REAL_ROOT_USER} -g ${REAL_ROOT_GROUP}
_PKG_ARGS_PACKAGE+= -E
.endif
-${PKGFILE}: ${_CONTENTS_TARGETS}
+${STAGE_PKGFILE}: ${_CONTENTS_TARGETS}
${RUN} ${MKDIR} ${.TARGET:H}
@${STEP_MSG} "Creating binary package ${.TARGET}"
${RUN} tmpname=${.TARGET:S,${PKG_SUFX}$,.tmp${PKG_SUFX},}; \
@@ -59,6 +76,14 @@ ${PKGFILE}: ${_CONTENTS_TARGETS}
exitcode=$$?; ${RM} -f "$$tmpname"; exit $$exitcode; \
fi
+.if ${_USE_DESTDIR} != "no"
+${PKGFILE}: ${STAGE_PKGFILE}
+ ${RUN} ${MKDIR} ${.TARGET:H}
+ @${STEP_MSG} "Creating binary package ${.TARGET}"
+ ${LN} -f ${STAGE_PKGFILE} ${PKGFILE} 2>/dev/null || \
+ ${CP} -pf ${STAGE_PKGFILE} ${PKGFILE}
+.endif
+
######################################################################
### package-remove (PRIVATE)
######################################################################
@@ -70,6 +95,15 @@ package-remove:
${RUN} ${RM} -f ${PKGFILE}
######################################################################
+### stage-package-remove (PRIVATE)
+######################################################################
+### stage-package-remove removes the binary package for stage install
+###
+.PHONY: stage-package-remove
+stage-package-remove:
+ ${RUN} ${RM} -f ${STAGE_PKGFILE}
+
+######################################################################
### package-links (PRIVATE)
######################################################################
### package-links creates symlinks to the binary package from the
@@ -132,6 +166,13 @@ package-install: package real-package-install
package-install: barrier
.endif
+.PHONY: stage-package-install
+.if defined(_PKGSRC_BARRIER)
+stage-package-install: stage-package-create real-package-install
+.else
+stage-package-install: barrier
+.endif
+
.if ${_USE_DESTDIR} != "no"
. if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
real-package-install: su-real-package-install
@@ -147,13 +188,13 @@ su-real-package-install:
@${PHASE_MSG} "Install 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} ${PKGFILE}
+ ${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 ${PKGFILE} ;; \
- *) ${PKG_ADD} ${PKGFILE} ;; \
+ [yY][eE][sS]) ${PKG_ADD} -A ${STAGE_PKGFILE} ;; \
+ *) ${PKG_ADD} ${STAGE_PKGFILE} ;; \
esac
.endif
diff --git a/mk/pkgformat/pkg/replace.mk b/mk/pkgformat/pkg/replace.mk
index 17a81b32463..93d976e8fa1 100644
--- a/mk/pkgformat/pkg/replace.mk
+++ b/mk/pkgformat/pkg/replace.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.1 2011/10/15 00:23:09 reed Exp $
+# $NetBSD: replace.mk,v 1.2 2013/05/23 13:18:56 obache Exp $
#
# _pkgformat-replace:
@@ -207,12 +207,12 @@ replace-destdir: .PHONY
@${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} ${PKGFILE}
+ ${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 ${PKGFILE}
+ ${PKG_ADD} -U -D ${STAGE_PKGFILE}
.endif
${RUN}${_REPLACE_OLDNAME_CMD}; \
${PKG_INFO} -qR ${PKGNAME:Q} | while read pkg; do \