Skip to content

Commit

Permalink
Move definitions for UPDATE_TARGET and DEPENDS_TARGET closer to where
Browse files Browse the repository at this point in the history
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
jlam committed Jun 5, 2006
1 parent a8ac6f8 commit 42bdc0c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 41 deletions.
32 changes: 1 addition & 31 deletions mk/bsd.pkg.mk
Original file line number Original file line Diff line number Diff line change
@@ -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. # This file is in the public domain.
# #
Expand Down Expand Up @@ -761,36 +761,6 @@ BUILD_DEFS+= OSVERSION_SPECIFIC
all: ${_PKGSRC_BUILD_TARGETS} all: ${_PKGSRC_BUILD_TARGETS}
.endif .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 # The following are used to create easy dummy targets for
# disabling some bit of default target behavior you don't want. # disabling some bit of default target behavior you don't want.
Expand Down
23 changes: 19 additions & 4 deletions mk/bsd.pkg.update.mk
Original file line number Original file line Diff line number Diff line change
@@ -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 # This Makefile fragment is included by bsd.pkg.mk and contains the targets
# and variables for "make update". # and variables for "make update".
Expand All @@ -11,6 +11,21 @@
NOCLEAN?= NO # don't clean up after update NOCLEAN?= NO # don't clean up after update
REINSTALL?= NO # reinstall upon 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 # The 'update' target can be used to update a package and all
# currently installed packages that depend upon this package. # currently installed packages that depend upon this package.


Expand All @@ -28,7 +43,7 @@ update:
"${_PKGSRC_IN}> Resuming update for ${PKGNAME}" "${_PKGSRC_IN}> Resuming update for ${PKGNAME}"
. if ${REINSTALL} != "NO" && ${UPDATE_TARGET} != "replace" . if ${REINSTALL} != "NO" && ${UPDATE_TARGET} != "replace"
${_PKG_SILENT}${_PKG_DEBUG} \ ${_PKG_SILENT}${_PKG_DEBUG} \
${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL ${MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL
. endif . endif
.else .else
RESUMEUPDATE?= NO RESUMEUPDATE?= NO
Expand All @@ -38,7 +53,7 @@ update:
${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} ${_DDIR} ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} ${_DDIR}
. if ${UPDATE_TARGET} != "replace" . if ${UPDATE_TARGET} != "replace"
${_PKG_SILENT}${_PKG_DEBUG}if ${PKG_INFO} -qe ${PKGBASE}; then \ ${_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}); \ || (${RM} ${_DDIR} && ${FALSE}); \
fi fi
. endif . endif
Expand All @@ -53,7 +68,7 @@ update:
if [ "(" "${RESUMEUPDATE}" = "NO" -o \ if [ "(" "${RESUMEUPDATE}" = "NO" -o \
"${REINSTALL}" != "NO" ")" -a \ "${REINSTALL}" != "NO" ")" -a \
"${UPDATE_TARGET}" != "replace" ] ; then \ "${UPDATE_TARGET}" != "replace" ] ; then \
${MAKE} ${MAKEFLAGS} deinstall UPDATE_RUNNING=YES; \ ${MAKE} ${MAKEFLAGS} deinstall _UPDATE_RUNNING=YES; \
fi && \ fi && \
${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} \ ${MAKE} ${MAKEFLAGS} ${UPDATE_TARGET} \
DEPENDS_TARGET=${DEPENDS_TARGET:Q} ; \ DEPENDS_TARGET=${DEPENDS_TARGET:Q} ; \
Expand Down
21 changes: 20 additions & 1 deletion mk/depends/bsd.depends.mk
Original file line number Original file line Diff line number Diff line change
@@ -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 # This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to dependencies. # variables and targets related to dependencies.
Expand All @@ -10,6 +10,25 @@


_DEPENDS_COOKIE= ${WRKDIR}/.depends_done _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) ### depends (PUBLIC)
###################################################################### ######################################################################
Expand Down
4 changes: 2 additions & 2 deletions mk/flavor/pkg/deinstall.mk
Original file line number Original file line Diff line number Diff line change
@@ -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 # Set the appropriate flags to pass to pkg_delete(1) based on the value
# of DEINSTALLDEPENDS (see pkgsrc/mk/install/deinstall.mk). # of DEINSTALLDEPENDS (see pkgsrc/mk/install/deinstall.mk).
Expand All @@ -18,7 +18,7 @@ _PKG_ARGS_DEINSTALL+= -v
.endif .endif


.if defined(PKG_PRESERVE) .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 _PKG_ARGS_DEINSTALL+= -N -f # update w/o removing any files
. endif . endif
.endif .endif
Expand Down
6 changes: 3 additions & 3 deletions mk/install/replace.mk
Original file line number Original file line Diff line number Diff line change
@@ -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) ### replace (PUBLIC)
Expand All @@ -18,7 +18,7 @@ replace-message:
@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR." @${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."


su-replace: replace-pkg su-replace: replace-pkg
MAKEFLAGS.su-replace= UPDATE_RUNNING=yes MAKEFLAGS.su-replace= _UPDATE_RUNNING=yes


###################################################################### ######################################################################
### undo-replace (PUBLIC) ### undo-replace (PUBLIC)
Expand All @@ -34,7 +34,7 @@ undo-replace-message:
@${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR." @${WARNING_MSG} "experimental target - DATA LOSS MAY OCCUR."


su-undo-replace: undo-replace-pkg su-undo-replace: undo-replace-pkg
MAKEFLAGS.su-undo-replace= UPDATE_RUNNING=yes MAKEFLAGS.su-undo-replace= _UPDATE_RUNNING=yes


###################################################################### ######################################################################
### replace-pkg (PRIVATE, override) ### replace-pkg (PRIVATE, override)
Expand Down

0 comments on commit 42bdc0c

Please sign in to comment.