summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerh <erh>2004-11-02 00:03:09 +0000
committererh <erh>2004-11-02 00:03:09 +0000
commitf15ed86b34e8cc5a3d60f97b63ac156458f9d407 (patch)
tree0e5e11ca6dfa088400443a9afab1466337f740ba
parent852e5cdef9854e5392cc1335ecfa131cb3e1f1a3 (diff)
downloadpkgsrc-f15ed86b34e8cc5a3d60f97b63ac156458f9d407.tar.gz
Set UPDATE_RUNNING=YES when deinstalling due to a update or replace target.
Use this to trigger appropriate args to pkg_delete so PKG_PRESERVE packages can be upgraded.
-rw-r--r--mk/bsd.pkg.mk20
1 files changed, 15 insertions, 5 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 7cd9ea3f459..a152a3a787a 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1529 2004/10/28 14:05:56 tv Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1530 2004/11/02 00:03:09 erh Exp $
#
# This file is in the public domain.
#
@@ -1395,6 +1395,8 @@ UPDATE_TARGET= ${DEPENDS_TARGET}
. endif
.endif
+UPDATE_RUNNING?= NO
+
################################################################
# The following are used to create easy dummy targets for
# disabling some bit of default target behavior you don't want.
@@ -3352,6 +3354,7 @@ reinstall:
.if !target(deinstall)
deinstall: do-su-deinstall
+.if !target(do-su-deinstall)
do-su-deinstall: uptodate-pkgtools
@${ECHO_MSG} "${_PKGSRC_IN}> Deinstalling for ${PKGBASE}"
${_PKG_SILENT}${_PKG_DEBUG} \
@@ -3359,6 +3362,7 @@ do-su-deinstall: uptodate-pkgtools
realflags="DEINSTALLDEPENDS=${DEINSTALLDEPENDS}"; \
action="deinstall"; \
${_SU_TARGET}
+.endif
. if (${DEINSTALLDEPENDS} != "NO")
. if (${DEINSTALLDEPENDS} != "ALL")
@@ -3372,6 +3376,12 @@ real-su-deinstall-flags+= -r
. ifdef PKG_VERBOSE
real-su-deinstall-flags+= -v
. endif
+. ifdef PKG_PRESERVE
+. if (${UPDATE_RUNNING} == "YES")
+# used to update w/o removing any files
+real-su-deinstall-flags+= -N -f
+. endif
+. endif
.PHONY: real-su-deinstall
real-su-deinstall:
@@ -3417,7 +3427,7 @@ update:
"${_PKGSRC_IN}> Resuming update for ${PKGNAME}"
. if ${REINSTALL} != "NO" && ${UPDATE_TARGET} != "replace"
${_PKG_SILENT}${_PKG_DEBUG} \
- ${MAKE} ${MAKEFLAGS} deinstall DEINSTALLDEPENDS=ALL
+ ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
. endif
.else
RESUMEUPDATE?= NO
@@ -3427,7 +3437,7 @@ update:
${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} ${DDIR}
. if ${UPDATE_TARGET} != "replace"
${_PKG_SILENT}${_PKG_DEBUG}if ${PKG_INFO} -qe ${PKGBASE}; then \
- ${MAKE} ${MAKEFLAGS} deinstall DEINSTALLDEPENDS=ALL \
+ ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL \
|| (${RM} ${DDIR} && ${FALSE}); \
fi
. endif
@@ -3442,7 +3452,7 @@ update:
if [ "(" "${RESUMEUPDATE}" = "NO" -o \
"${REINSTALL}" != "NO" ")" -a \
"${UPDATE_TARGET}" != "replace" ] ; then \
- ${MAKE} ${MAKEFLAGS} deinstall; \
+ ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES; \
fi && \
${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} \
DEPENDS_TARGET=${DEPENDS_TARGET:Q} ; \
@@ -3560,7 +3570,7 @@ _REPLACE= \
if [ -f ${_PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ]; then \
${MV} ${_PKG_DBDIR}/$$oldpkgname/+REQUIRED_BY ${WRKDIR}/.req; \
fi; \
- ${MAKE} deinstall; \
+ ${MAKE} deinstall UPDATE_RUNNING=YES; \
$$replace_action; \
if [ -f ${WRKDIR}/.req ]; then \
${MV} ${WRKDIR}/.req ${_PKG_DBDIR}/$$newpkgname/+REQUIRED_BY; \