Subject: Re: make update
To: None <tech-pkg@netbsd.org>
From: Rene Hexel <rh@idle.trapdoor.vip.at>
List: tech-pkg
Date: 08/27/1999 22:54:40
This is a multi-part message in MIME format.
--------------8409282FBBE86DA3B4D3B7C8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Rene Hexel wrote:
> here is a first stab at an 'update' target for bsd.pkg.mk.
Sorry to everyone who wanted to try this out. The attached diff was a
bit outdated. Here is what should have been attached in the first
place.
If nobody objects, I will commit this in the next days ...
Cheers
,
Rene
--------------8409282FBBE86DA3B4D3B7C8
Content-Type: text/plain; charset=us-ascii;
name="bsd.pkg.mk.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="bsd.pkg.mk.diff"
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.326
diff -u -r1.326 bsd.pkg.mk
--- bsd.pkg.mk 1999/08/27 11:23:48 1.326
+++ bsd.pkg.mk 1999/08/27 20:50:20
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.326 1999/08/27 11:23:48 rh Exp $
+# $NetBSD: bsd.pkg.mk,v 1.325 1999/08/26 15:29:58 tron Exp $
#
# This file is in the public domain.
#
@@ -330,6 +330,8 @@
DESCR_SRC?= ${PKGDIR}/DESCR
DESCR= ${WRKDIR}/.DESCR
PLIST= ${WRKDIR}/.PLIST
+DLIST= ${WRKDIR}/.DLIST
+DDIR= ${WRKDIR}/.DDIR
# Set INSTALL_FILE to be the name of any INSTALL file
.if !defined(INSTALL_FILE) && exists(${PKGDIR}/INSTALL)
@@ -393,6 +395,7 @@
CHOWN?= /usr/bin/chown
CHGRP?= /usr/bin/chgrp
CP?= /usr/bin/cp
+CUT?= /usr/bin/cut
ECHO?= /usr/ucb/echo
EGREP?= /usr/xpg4/bin/egrep
FALSE?= /usr/bin/false
@@ -436,6 +439,7 @@
CHOWN?= /usr/sbin/chown
CHGRP?= /usr/bin/chgrp
CP?= /bin/cp
+CUT?= /bin/cut
ECHO?= /bin/echo
EGREP?= /bin/egrep
FALSE?= /bin/false
@@ -479,6 +483,7 @@
CHOWN?= /usr/sbin/chown
CHGRP?= /usr/bin/chgrp
CP?= /bin/cp
+CUT?= /usr/bin/cut
ECHO?= /bin/echo
EGREP?= /usr/bin/egrep
FALSE?= /usr/bin/false
@@ -1555,7 +1560,11 @@
.if (${DEINSTALLDEPENDS} != "NO")
+.if (${DEINSTALLDEPENDS} != "ALL")
root-install-flags+= -R
+.else
+root-install-flags+= -r
+.endif
.endif
.ifdef PKG_VERBOSE
root-install-flags+= -v
@@ -1574,6 +1583,35 @@
################################################################
# 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.
+update: ${DDIR}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} deinstall DEINSTALLDEPENDS=ALL
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} reinstall
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ -s ${DDIR} ] ; then \
+ for dep in `${CAT} ${DDIR}` ; do \
+ ${ECHO_MSG} "===> Reinstalling in $${dep}" ; \
+ (cd "../../$${dep}" ; ${MAKE} reinstall) ; \
+ done ; \
+ fi
+
+${DDIR}: ${DLIST}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ddir=`${SED} 's:-[^-]*$$::' <${DLIST}` ; \
+ if ${PKG_INFO} -b $${ddir} >/dev/null 2>&1 ; then \
+ ${PKG_INFO} -b $${ddir} | ${GREP} Makefile | \
+ ${CUT} -d'/' -f1-2 >${DDIR} ; \
+ else \
+ ${ECHO} >${DDIR} ; \
+ fi
+
+${DLIST}: ${MAKEFILE}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} -p ${WRKDIR}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ (${PKG_INFO} -R "${PKGNAME:C/-[^-]*$/-[0-9]*/}" || \
+ ${TRUE}) | ${TAIL} -n +4 >${DLIST}
# This is for the use of sites which store distfiles which others may
# fetch - only fetch the distfile if it is allowed to be
--------------8409282FBBE86DA3B4D3B7C8--