Subject: Bulk-Updating
To: None <tech-pkg@NetBSD.ORG>
From: Martin Husemann <martin@duskware.de>
List: tech-pkg
Date: 08/09/2001 11:13:31
I'm trying to ease the process of upgrading all downlevel packages
wiht minimal rebuilds. The idea is to have a script that sets the 
environment variables STOP_DOWNLEVEL_AFTER_FIRST and REBUILD_DOWNLEVEL_DEPENDS
and then does "make show-downlevel", awks the first downlevel package
from the output, cds into that directory and does "make update" there.
After that finished, it starts all over again, until no more downlevel
packages are found.

I came up with is the following patch:

---8<---
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.796
diff -c -u -r1.796 bsd.pkg.mk
--- bsd.pkg.mk	2001/08/08 07:24:57	1.796
+++ bsd.pkg.mk	2001/08/09 09:04:39
@@ -1337,6 +1337,10 @@
 	found="`${PKG_INFO} -e \"${PKGBASE}\" || ${TRUE}`";		\
 	if [ "X$$found" != "X" -a "X$$found" != "X${PKGNAME}" ]; then	\
 		${ECHO} "${PKGBASE} package: $$found installed, pkgsrc version ${PKGNAME}"; \
+		if [ "X$$STOP_DOWNLEVEL_AFTER_FIRST" != "X" ]; then	\
+			${ECHO} "stoping after first downlevel pkg found";	\
+			exit 1;						\
+		fi;							\
 	fi
 .  endif
 .endif
@@ -2733,6 +2737,13 @@
 	pkg="${dep:C/:.*//}";						\
 	dir="${dep:C/[^:]*://:C/:.*$//}";				\
 	found=`${PKG_INFO} -e "$$pkg" || ${TRUE}`;			\
+	if [ "X$$REBUILD_DOWNLEVEL_DEPENDS" != "X" ]; then		\
+		pkgname=`cd $$dir ; ${MAKE} ${MAKEFLAGS} show-var VARNAME=PKGNAME`;	\
+		if [ "X$$found" != "X" -a "X$$found" != "X$${pkgname}" ]; then		\
+			${ECHO_MSG} "ignoring old installed package \"$$found\"";	\
+			found="";					\
+		fi;							\
+	fi;								\
 	if [ "$$found" != "" ]; then					\
 		instobjfmt=`${PKG_INFO} -B "$$pkg" | ${AWK} '/^OBJECT_FMT/ {print $$2}' | ${HEAD} -1`; \
 		if [ "$$instobjfmt" = "" ]; then			\

--->8---

The first part (stopping after first downlevel pkg) does not realy work, as
bsd.pkg.subdir.mk ignores the error return from the recursive make. Is there
an eaysy way to stop the whole process? Anyway, this is only a slight
performance improvement and not realy necessary.

The other part, rebuilding all dependencies that are downlevel, seems to
work.

What do you think?


Martin