summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorrh <rh>1999-10-31 19:43:02 +0000
committerrh <rh>1999-10-31 19:43:02 +0000
commit02610284ca287709f57350373fc25ce62954b606 (patch)
tree22f9950a5420d1fbf88e4e6eac7f13972560bc80 /mk
parent2d9ad451cc5d8349bb668d339a2a078ed69e1136 (diff)
downloadpkgsrc-02610284ca287709f57350373fc25ce62954b606.tar.gz
Change the "update" target so it becomes more useful (and less dangerous!).
Here is a summary of the changed behaviour: * A "make update" will no longer clean the subtree before running. * If called a second time, it will resume package installation, in case a previous "make update" was interrupted for some reason. (just make sure you don't call "make clean" in between ;-) * Unless "NOCLEAN" is set, "make update" will clean up the subtree after successfully updating _all_ packages (to avoid a dirty directory structure for future makes). * A "clean-update" target has been introduced to clean up the subtree that gets updated. This should be used prior to an initial "make update" if you suspect that one of the packages that get updated may be dirty. XXX: this still does not automatically check for or update any obsolete ´upstream' packages (e.g., if gtk depends on glib, a "make update" in the gtk directory won't automatically update glib, you have to do it the other way round).
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk58
1 files changed, 52 insertions, 6 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index a6cf9a5b1f2..ce4103c36b0 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.361 1999/10/22 14:14:22 agc Exp $
+# $NetBSD: bsd.pkg.mk,v 1.362 1999/10/31 19:43:02 rh Exp $
#
# This file is in the public domain.
#
@@ -59,6 +59,7 @@ DEF_UMASK?= 0022
CLEANDEPENDS?= NO
DEINSTALLDEPENDS?= NO # add -R to pkg_delete
REINSTALL?= NO # reinstall upon update
+NOCLEAN?= NO # don't clean up after update
LOCALBASE?= ${DESTDIR}/usr/local
X11BASE?= ${DESTDIR}/usr/X11R6
@@ -1620,19 +1621,28 @@ root-deinstall:
@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
.endif # target(deinstall)
+
################################################################
# Some more targets supplied for users' convenience
################################################################
# The 'update' target can be used to update a package and all
# currently installed packages that depend upon this package.
+
+.if exists(${DDIR})
+RESUMEUPDATE?= YES
+
+update:
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_MSG} \
+ "===> Resuming update for ${PKGNAME}"
+.else
+RESUMEUPDATE?= NO
+
update:
-.if (${REINSTALL} == "NO")
- ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} clean
-.endif
${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${DDIR}
${_PKG_SILENT}${_PKG_DEBUG}${MAKE} deinstall DEINSTALLDEPENDS=ALL
-.if (${REINSTALL} == "NO")
+.endif
+.if ${REINSTALL} == "NO"
${_PKG_SILENT}${_PKG_DEBUG} \
${MAKE} ${DEPENDS_TARGET} KEEP_WRKDIR=YES
.else
@@ -1643,14 +1653,50 @@ update:
for dep in `${CAT} ${DDIR}` ; do \
${ECHO_MSG} "===> Installing in $${dep}" ; \
(cd "../../$${dep}" && \
+ if [ "${RESUMEUPDATE}" = "NO" ] ; then \
+ ${MAKE} deinstall ; \
+ fi && \
if [ "${REINSTALL}" = "NO" ] ; then \
- ${MAKE} clean && \
${MAKE} ${DEPENDS_TARGET} ; \
else \
${MAKE} reinstall ; \
fi) ; \
done ; \
fi
+.if ${NOCLEAN} == "NO"
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} clean-update CLEAR_DIRLIST=YES
+.endif
+
+
+clean-update:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${DDIR}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ -s ${DDIR} ] ; then \
+ for dep in `${CAT} ${DDIR}` ; do \
+ (cd "../../$${dep}" && ${MAKE} clean) ; \
+ done ; \
+ fi
+.ifdef CLEAR_DIRLIST
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} clean
+.else
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} clean update-dirlist \
+ DIRLIST="`${CAT} ${DDIR}`" PKGLIST="`${CAT} ${DLIST}`"
+.endif
+
+
+update-dirlist:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} -p ${WRKDIR}
+.ifdef PKGLIST
+.for __tmp__ in ${PKGLIST}
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} >>${DLIST} "${__tmp__}"
+.endfor
+.endif
+.ifdef DIRLIST
+.for __tmp__ in ${DIRLIST}
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} >>${DDIR} "${__tmp__}"
+.endfor
+.endif
+
${DDIR}: ${DLIST}
${_PKG_SILENT}${_PKG_DEBUG} \