summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorgdt <gdt>2007-11-07 13:50:09 +0000
committergdt <gdt>2007-11-07 13:50:09 +0000
commit172c8041101d49391ad254832e5ae1c9cc016695 (patch)
treef6ce40c12da8081115ee311ada20f842f6293357 /mk
parent7ae435cb3c492b8c6b28ef5aa2e2f0a40f99e824 (diff)
downloadpkgsrc-172c8041101d49391ad254832e5ae1c9cc016695.tar.gz
Allow make replace to replace a package with a name other than the new
one, via "make replace OLDNAME=oldpkgname". Enhance replace-names to use OLDNAME if present. Move replace-names target before replace-tarup, and change replace-tarup to use the computed oldname. Make deinstall respect OLDNAME. Tested on netbsd-current with standard make replace and with OLDNAME.
Diffstat (limited to 'mk')
-rw-r--r--mk/flavor/pkg/deinstall.mk8
-rw-r--r--mk/flavor/pkg/replace.mk23
2 files changed, 21 insertions, 10 deletions
diff --git a/mk/flavor/pkg/deinstall.mk b/mk/flavor/pkg/deinstall.mk
index 07485b89fd8..d3a8be1772c 100644
--- a/mk/flavor/pkg/deinstall.mk
+++ b/mk/flavor/pkg/deinstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: deinstall.mk,v 1.3 2007/03/09 00:39:55 rillig Exp $
+# $NetBSD: deinstall.mk,v 1.4 2007/11/07 13:50:09 gdt Exp $
# Set the appropriate flags to pass to pkg_delete(1) based on the value
# of DEINSTALLDEPENDS (see pkgsrc/mk/install/deinstall.mk).
@@ -31,7 +31,11 @@ _PKG_ARGS_DEINSTALL+= -N -f # update w/o removing any files
#
_flavor-deinstall:
${_PKG_SILENT}${_PKG_DEBUG} \
- found="`${PKG_INFO} -e \"${PKGNAME}\" || ${TRUE}`"; \
+ if [ x"$OLDNAME" = x ]; then \
+ found="`${PKG_INFO} -e \"${PKGNAME}\" || ${TRUE}`"; \
+ else \
+ found=${OLDNAME}; \
+ fi; \
case "$$found" in \
"") found="`${_PKG_BEST_EXISTS} ${PKGWILDCARD:Q} || ${TRUE}`" ;; \
esac; \
diff --git a/mk/flavor/pkg/replace.mk b/mk/flavor/pkg/replace.mk
index 37848966486..1d556928786 100644
--- a/mk/flavor/pkg/replace.mk
+++ b/mk/flavor/pkg/replace.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.20 2007/09/22 15:19:47 gdt Exp $
+# $NetBSD: replace.mk,v 1.21 2007/11/07 13:50:09 gdt Exp $
#
# _flavor-replace:
@@ -13,8 +13,8 @@
# can be confused when a +REQUIRED_BY files suddenly disappears.
#
_flavor-replace: \
- replace-tarup \
replace-names \
+ replace-tarup \
replace-preserve-installed-info \
replace-preserve-required-by \
deinstall \
@@ -76,9 +76,10 @@ undo-replace-check: .PHONY
replace-tarup: .PHONY
${RUN} [ -x ${_PKG_TARUP_CMD:Q} ] \
|| ${FAIL_MSG} ${_PKG_TARUP_CMD:Q}" was not found.";
+ ${_REPLACE_OLDNAME_CMD}; \
${SETENV} PKG_DBDIR=${_PKG_DBDIR} PKG_SUFX=${PKG_SUFX} \
PKGREPOSITORY=${WRKDIR} \
- ${_PKG_TARUP_CMD} ${PKGBASE}
+ ${_PKG_TARUP_CMD} $${oldname}
######################################################################
### undo-replace-install (PRIVATE)
@@ -93,14 +94,20 @@ undo-replace-install: .PHONY
${PKG_ADD} ${WRKDIR}/$${oldname}${PKG_SUFX}
######################################################################
-### replace-names, undo-replace-names (PRIVATE)
+### replace-names (PRIVATE)
######################################################################
-### replace-names and undo-replace-names save the correct names of the
-### installed and replacement packages into files queried by other
-### targets.
+
+### replace-names computes and saves the full names of the installed
+### package to be replaced (oldname) and the package that will be
+### installed (newname) into files for later use.
###
replace-names: .PHONY
- ${RUN} ${_PKG_BEST_EXISTS} ${PKGWILDCARD:Q} > ${_REPLACE_OLDNAME_FILE}
+ ${RUN} if [ x"${OLDNAME}" = x ]; then \
+ wildcard=${PKGWILDCARD:Q}; \
+ else \
+ wildcard="${OLDNAME}-[0-9]*"; \
+ fi; \
+ ${_PKG_BEST_EXISTS} "$${wildcard}" > ${_REPLACE_OLDNAME_FILE}
${RUN} ${ECHO} ${PKGNAME} > ${_REPLACE_NEWNAME_FILE}
${RUN} ${CP} -f ${_REPLACE_NEWNAME_FILE} ${_COOKIE.replace}