Subject: review wanted: bsd.bulk-pkg.mk bulk-check-uptodate fixes
To: None <tech-pkg@netbsd.org>
From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
List: tech-pkg
Date: 10/06/2003 00:50:39
The patch below addresses three problems:

1) When checking if any of the required binary pkgs is newer, it's
   not good to look into the (already existing) binary pkg, as that
   might be unchanged. Instead, look at the DEPENDS.

   In the context of the recent jpeg changes, the gd package itself was
   not changed, but the DEPENDS were (via buildlink files). Now looking
   into the existing gd binary pkg still said it wanted jpeg-6b instead
   of the now-wanted jpeg>=6b, which was only available via the DEPENDS.

   That's the first chunk of the patch below.

2) It's not good enough to have a required binary pkg available to not
   rebuild things. If one is available but it's newer, we still need
   to rebuild.

   That's addressed in the second chunk of the patch below.

3) While debugging this, I found that the change in rev. 1.48 was
   wrong, as can be seen throughout the last bulk build, search for errors
   like:

	find: "/usr/cvs.local/pkgsrc/packages/i386/All/gd-2.0.15.tgz": No such file or directory

   As the whole operation is really on two files (as assured by "pkg_admin
   lsbest" for pkg and REFS by definition), the quotes can be ommitted.

   Why this wasn't caught when that change was tested is beyond me - maybe
   different sh(1) behaviour? (The error happened on 1.6.1_STABLE, see
   e.g. http://smaug.fh-regensburg.de/~feyrer/ftp/pub/NetBSD/pkgstat-i386/last/www/p5-Template-Toolkit/.broken.yui.html).

   Anyways, that's addressed in the second part of the patch below, too.

4) Use ${FIND} while there.

Please review & let me know if that's ok to commit.


 - Hubert


Index: bsd.bulk-pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bulk/bsd.bulk-pkg.mk,v
retrieving revision 1.49
diff -u -r1.49 bsd.bulk-pkg.mk
--- bsd.bulk-pkg.mk	2 Sep 2003 07:00:04 -0000	1.49
+++ bsd.bulk-pkg.mk	5 Oct 2003 22:34:27 -0000
@@ -160,9 +160,7 @@
 	fi ; \
 	if [ "$$uptodate" = "1" ]; then \
 		${SHCOMMENT} "Check required binary packages" ; \
-		deps=`${PKG_INFO} -qf ${REF} \
-		      | ${GREP} '^@pkgdep' \
-		      | ${SED} 's,@pkgdep.,,g'`; \
+		deps=${DEPENDS:C/:.*//:Q} ; \
 		for dep in $$deps ; do \
 			${SHCOMMENT} "check against the binary pkg that pkg_add would pick, too:" ; \
 			${SHCOMMENT} "(Only one should be returned here, really...)" ; \
@@ -170,7 +168,8 @@
 			if [ -z "$$pkg" ]; then \
 				${ECHO_MSG} >&2 "BULK> Required binary package $$dep does not exist, rebuilding... " ; \
 				uptodate=0 ; \
-			elif [ -n "$$(find \"$$pkg\" -prune -newer \"${REF}\")" ]; then \
+			fi ; \
+			if [ -n "$$(${FIND} $$pkg -prune -newer ${REF})" ]; then \
 				${ECHO_MSG} >&2 "BULK> Required binary package $$dep (`basename $$pkg`) is newer, rebuilding... " ; \
 				uptodate=0 ; \
 			else \

-- 
  ___ _ _  _   _        * Harddisk Image Cloning *
 / __| | || | | |           www.feyrer.de/g4u/
| (_ |_  _| |_| |
 \___| |_| \___/          v1.12 out now, including partition support!