From aeaa9d2c207e1d156cbea10cb15e1c8d56c07e6d Mon Sep 17 00:00:00 2001 From: jlam Date: Thu, 2 Aug 2007 23:00:18 +0000 Subject: 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". --- mk/flavor/pkg/replace.mk | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'mk') 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 @@ -100,6 +103,21 @@ replace-names: .PHONY ${_PKG_SILENT}${_PKG_DEBUG} \ ${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) ###################################################################### -- cgit v1.2.3