diff options
author | jlam <jlam@pkgsrc.org> | 2007-08-02 23:00:18 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2007-08-02 23:00:18 +0000 |
commit | e92540b3b8f895855d96070966046354505ccdec (patch) | |
tree | 1861ffae24e6278853851de55f19e2ca65055f58 /mk | |
parent | bb2864741d17ca7967aca37c23d5f3bb4467873c (diff) | |
download | pkgsrc-e92540b3b8f895855d96070966046354505ccdec.tar.gz |
Preserve any existing +INSTALLED_INFO file from an installed package
before replacing it, and restore it when the new package is installed.
This saves any state information that should be carried over to the
new package, e.g. automatic=yes.
XXX Still need to do the same when "un-replacing".
Diffstat (limited to 'mk')
-rw-r--r-- | mk/flavor/pkg/replace.mk | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/mk/flavor/pkg/replace.mk b/mk/flavor/pkg/replace.mk index 9a57516b070..f06c15d2de6 100644 --- a/mk/flavor/pkg/replace.mk +++ b/mk/flavor/pkg/replace.mk @@ -1,4 +1,4 @@ -# $NetBSD: replace.mk,v 1.8 2007/03/17 17:17:33 rillig Exp $ +# $NetBSD: replace.mk,v 1.9 2007/08/02 23:00:18 jlam Exp $ # # _flavor-replace: @@ -15,6 +15,7 @@ _flavor-replace: \ replace-tarup \ replace-names \ + replace-preserve-installed-info \ replace-preserve-required-by \ deinstall \ install-clean \ @@ -30,6 +31,7 @@ _flavor-replace: \ # _flavor-undo-replace: \ undo-replace-check \ + replace-preserve-installed-info \ replace-preserve-required-by \ deinstall \ undo-replace-install \ @@ -37,6 +39,7 @@ _flavor-undo-replace: \ replace-clean \ .PHONY +_INSTALLED_INFO_FILE= ${PKG_DB_TMPDIR}/+INSTALLED_INFO _REQUIRED_BY_FILE= ${PKG_DB_TMPDIR}/+REQUIRED_BY _COOKIE.replace= ${WRKDIR}/.replace_done @@ -101,6 +104,21 @@ replace-names: .PHONY ${CP} -f ${_REPLACE_NEWNAME_FILE} ${_COOKIE.replace} ###################################################################### +### replace-preserve-installed-info (PRIVATE) +###################################################################### +### replace-preserve-installed-info saves and removes the +INSTALLED_INFO +### file from the installed package. +### +replace-preserve-installed-info: .PHONY + ${_PKG_SILENT}${_PKG_DEBUG} \ + ${TEST} -f ${_REPLACE_OLDNAME_FILE} || exit 0; \ + ${STEP_MSG} "Preserving existing +INSTALLED_INFO file."; \ + oldname=`${CAT} ${_REPLACE_OLDNAME_FILE}`; \ + installed_info="${_PKG_DBDIR}/$$oldname/+INSTALLED_INFO"; \ + ${TEST} ! -f "$$installed_info" || \ + ${MV} $$installed_info ${_INSTALLED_INFO_FILE} + +###################################################################### ### replace-preserve-required-by (PRIVATE) ###################################################################### ### replace-preserve-required-by saves and removes the +REQUIRED_BY |