pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Add support for using USE_DESTDIR=yes and replace t...
details: https://anonhg.NetBSD.org/pkgsrc/rev/1a6eb5fc8bfd
branches: trunk
changeset: 394359:1a6eb5fc8bfd
user: joerg <joerg%pkgsrc.org@localhost>
date: Tue Jun 09 08:40:27 2009 +0000
description:
Add support for using USE_DESTDIR=yes and replace together.
Based on the patch send to tech-pkg in 2008, but less intrusive.
diffstat:
mk/flavor/README | 3 ++-
mk/flavor/pkg/replace.mk | 26 ++++++++++++++++++++++++--
mk/install/replace.mk | 15 +++++++++++++--
mk/package/package.mk | 4 ++--
4 files changed, 41 insertions(+), 7 deletions(-)
diffs (124 lines):
diff -r 85d3778317d7 -r 1a6eb5fc8bfd mk/flavor/README
--- a/mk/flavor/README Tue Jun 09 08:40:26 2009 +0000
+++ b/mk/flavor/README Tue Jun 09 08:40:27 2009 +0000
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.6 2007/10/01 10:08:20 rillig Exp $
+$NetBSD: README,v 1.7 2009/06/09 08:40:27 joerg Exp $
= Introduction =
@@ -58,6 +58,7 @@
* tarup-pkg
* package-install
* _flavor-replace
+* _flavor-destdir-replace
* _flavor-undo-replace
= Bugs =
diff -r 85d3778317d7 -r 1a6eb5fc8bfd mk/flavor/pkg/replace.mk
--- a/mk/flavor/pkg/replace.mk Tue Jun 09 08:40:26 2009 +0000
+++ b/mk/flavor/pkg/replace.mk Tue Jun 09 08:40:27 2009 +0000
@@ -1,8 +1,11 @@
-# $NetBSD: replace.mk,v 1.24 2008/01/23 14:48:50 gdt Exp $
+# $NetBSD: replace.mk,v 1.25 2009/06/09 08:40:27 joerg Exp $
#
# _flavor-replace:
-# Updates a package in-place on the system.
+# Updates a package in-place on the system (USE_DESTDIR=yes).
+#
+# _flavor-destdir-replace:
+# Updates a package in-place on the system (USE_DESTDIR=yes).
#
# See also:
# replace
@@ -24,6 +27,13 @@
replace-fixup-installed-info \
.PHONY
+_flavor-destdir-replace: \
+ replace-names \
+ replace-destdir \
+ replace-fixup-required-by \
+ replace-fixup-installed-info \
+ .PHONY
+
# _flavor-undo-replace:
# Undoes the actions from a previous _flavor-replace.
#
@@ -172,3 +182,15 @@
${RM} -f ${WRKDIR}/$$newname${PKG_SUFX}; \
${RM} -f ${_REPLACE_OLDNAME_FILE} ${_REPLACE_NEWNAME_FILE} \
${_COOKIE.replace}
+
+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 -m ${MACHINE_ARCH} -I -p ${_CROSS_DESTDIR}${PREFIX} ${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 ${PKGFILE}
+.endif
diff -r 85d3778317d7 -r 1a6eb5fc8bfd mk/install/replace.mk
--- a/mk/install/replace.mk Tue Jun 09 08:40:26 2009 +0000
+++ b/mk/install/replace.mk Tue Jun 09 08:40:27 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.10 2007/03/09 03:28:58 rillig Exp $
+# $NetBSD: replace.mk,v 1.11 2009/06/09 08:40:28 joerg Exp $
#
# Public targets:
#
@@ -14,12 +14,19 @@
# Private targets that must be defined by the package system flavor:
#
# _flavor-replace:
-# Updates a package in-place on the system.
+# Updates a package in-place on the system (USE_DESTDIR=no).
+#
+# _flavor-destdir-replace:
+# Updates a package in-place on the system (USE_DESTDIR=yes).
#
# _flavor-undo-replace:
# Undoes a previous "make _flavor-replace".
+.if ${_USE_DESTDIR} == "no"
_REPLACE_TARGETS+= ${_PKGSRC_BUILD_TARGETS}
+.else
+_REPLACE_TARGETS+= package
+.endif
_REPLACE_TARGETS+= replace-message
_REPLACE_TARGETS+= unprivileged-install-hook
@@ -38,7 +45,11 @@
@${PHASE_MSG} "Replacing for ${PKGNAME}"
@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."
+.if ${_USE_DESTDIR} == "no"
su-replace: .PHONY _flavor-replace
+.else
+su-replace: .PHONY _flavor-destdir-replace
+.endif
MAKEFLAGS.su-replace= _UPDATE_RUNNING=yes
#
diff -r 85d3778317d7 -r 1a6eb5fc8bfd mk/package/package.mk
--- a/mk/package/package.mk Tue Jun 09 08:40:26 2009 +0000
+++ b/mk/package/package.mk Tue Jun 09 08:40:27 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.20 2009/03/17 22:13:36 rillig Exp $
+# $NetBSD: package.mk,v 1.21 2009/06/09 08:40:28 joerg Exp $
#
# This file provides the code for the "package" phase.
#
@@ -13,7 +13,7 @@
#
_PACKAGE_TARGETS+= check-vulnerable
-.if make(replace)
+.if make(replace) && ${_USE_DESTDIR} == "no"
_PACKAGE_TARGETS+= replace
.else
_PACKAGE_TARGETS+= install
Home |
Main Index |
Thread Index |
Old Index