Permalink
Browse files

Move definitions for UPDATE_TARGET and DEPENDS_TARGET closer to where

they are used.  Also, move UPDATE_RUNNING into the install module where
it is used, and make it "private" by prepending with an underscore.
  • Loading branch information...
1 parent a8ac6f8 commit 42bdc0cd3d3dc5b7797b5ebdcf0b61541967d366 jlam committed Jun 5, 2006
Showing with 45 additions and 41 deletions.
  1. +1 −31 mk/bsd.pkg.mk
  2. +19 −4 mk/bsd.pkg.update.mk
  3. +20 −1 mk/depends/bsd.depends.mk
  4. +2 −2 mk/flavor/pkg/deinstall.mk
  5. +3 −3 mk/install/replace.mk
View
32 mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1836 2006/06/05 02:22:49 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1837 2006/06/05 17:21:54 jlam Exp $
#
# This file is in the public domain.
#
@@ -761,36 +761,6 @@ BUILD_DEFS+= OSVERSION_SPECIFIC
all: ${_PKGSRC_BUILD_TARGETS}
.endif
-.if !defined(DEPENDS_TARGET)
-. if make(package)
-DEPENDS_TARGET= package
-. elif make(update)
-. if defined(UPDATE_TARGET) && ${UPDATE_TARGET} == "replace"
-DEPENDS_TARGET= ${UPDATE_TARGET}
-. else
-DEPENDS_TARGET= update
-. endif
-. elif make(bin-install) || make(real-su-bin-install)
-DEPENDS_TARGET= bin-install
-. else
-DEPENDS_TARGET= reinstall
-. endif
-.endif
-
-.if !defined(UPDATE_TARGET)
-. if ${DEPENDS_TARGET} == "update"
-. if make(package)
-UPDATE_TARGET= package
-. else
-UPDATE_TARGET= install
-. endif
-. else
-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.
View
23 mk/bsd.pkg.update.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.update.mk,v 1.2 2006/06/04 08:25:53 jlam Exp $
+# $NetBSD: bsd.pkg.update.mk,v 1.3 2006/06/05 17:21:54 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and contains the targets
# and variables for "make update".
@@ -11,6 +11,21 @@
NOCLEAN?= NO # don't clean up after update
REINSTALL?= NO # reinstall upon update
+# UPDATE_TARGET is the target that is invoked when updating packages during
+# a "make update". This variable is user-settable within /etc/mk.conf.
+#
+.if !defined(UPDATE_TARGET)
+. if defined(DEPENDS_TARGET) && (${DEPENDS_TARGET} == "update")
+. if make(package)
+UPDATE_TARGET= package
+. else
+UPDATE_TARGET= install
+. endif
+. else
+UPDATE_TARGET= ${DEPENDS_TARGET}
+. endif
+.endif
+
# The 'update' target can be used to update a package and all
# currently installed packages that depend upon this package.
@@ -28,7 +43,7 @@ update:
"${_PKGSRC_IN}> Resuming update for ${PKGNAME}"
. if ${REINSTALL} != "NO" && ${UPDATE_TARGET} != "replace"
${_PKG_SILENT}${_PKG_DEBUG} \
- ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
+ ${MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
. endif
.else
RESUMEUPDATE?= NO
@@ -38,7 +53,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 UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL \
+ ${MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL \
|| (${RM} ${_DDIR} && ${FALSE}); \
fi
. endif
@@ -53,7 +68,7 @@ update:
if [ "(" "${RESUMEUPDATE}" = "NO" -o \
"${REINSTALL}" != "NO" ")" -a \
"${UPDATE_TARGET}" != "replace" ] ; then \
- ${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES; \
+ ${MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES; \
fi && \
${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} \
DEPENDS_TARGET=${DEPENDS_TARGET:Q} ; \
View
21 mk/depends/bsd.depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.depends.mk,v 1.1 2006/06/03 23:11:42 jlam Exp $
+# $NetBSD: bsd.depends.mk,v 1.2 2006/06/05 17:21:55 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to dependencies.
@@ -10,6 +10,25 @@
_DEPENDS_COOKIE= ${WRKDIR}/.depends_done
+# DEPENDS_TARGET is the target that is invoked to satisfy missing
+# dependencies. This variable is user-settable in /etc/mk.conf.
+#
+.if !defined(DEPENDS_TARGET)
+. if make(package)
+DEPENDS_TARGET= package
+. elif make(update)
+. if defined(UPDATE_TARGET) && (${UPDATE_TARGET} == "replace")
+DEPENDS_TARGET= ${UPDATE_TARGET}
+. else
+DEPENDS_TARGET= update
+. endif
+. elif make(bin-install) || make(real-su-bin-install)
+DEPENDS_TARGET= bin-install
+. else
+DEPENDS_TARGET= reinstall
+. endif
+.endif
+
######################################################################
### depends (PUBLIC)
######################################################################
View
4 mk/flavor/pkg/deinstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: deinstall.mk,v 1.1 2006/06/03 23:11:42 jlam Exp $
+# $NetBSD: deinstall.mk,v 1.2 2006/06/05 17:21:55 jlam Exp $
# Set the appropriate flags to pass to pkg_delete(1) based on the value
# of DEINSTALLDEPENDS (see pkgsrc/mk/install/deinstall.mk).
@@ -18,7 +18,7 @@ _PKG_ARGS_DEINSTALL+= -v
.endif
.if defined(PKG_PRESERVE)
-. if !empty(UPDATE_RUNNING:M[yY][eE][sS])
+. if defined(_UPDATE_RUNNING) && !empty(_UPDATE_RUNNING:M[yY][eE][sS])
_PKG_ARGS_DEINSTALL+= -N -f # update w/o removing any files
. endif
.endif
View
6 mk/install/replace.mk
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.1 2006/06/03 23:11:42 jlam Exp $
+# $NetBSD: replace.mk,v 1.2 2006/06/05 17:21:55 jlam Exp $
######################################################################
### replace (PUBLIC)
@@ -18,7 +18,7 @@ replace-message:
@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."
su-replace: replace-pkg
-MAKEFLAGS.su-replace= UPDATE_RUNNING=yes
+MAKEFLAGS.su-replace= _UPDATE_RUNNING=yes
######################################################################
### undo-replace (PUBLIC)
@@ -34,7 +34,7 @@ undo-replace-message:
@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."
su-undo-replace: undo-replace-pkg
-MAKEFLAGS.su-undo-replace= UPDATE_RUNNING=yes
+MAKEFLAGS.su-undo-replace= _UPDATE_RUNNING=yes
######################################################################
### replace-pkg (PRIVATE, override)

0 comments on commit 42bdc0c

Please sign in to comment.