Subject: Another try (was Re: moving md5 and patch-sum from files/ to pkg/)
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 04/05/2001 02:08:29
Below is my second try at a patch (for bsd.pkg.mk) to use pkg/ directory
instead of files/ directory for md5 and patch-sum. It also changes name of
md5 to checksum.

This patch is better than my previous patch (Mar. 15), because it will
fallback to previous defaults (so it can work with old packages).

The benefit (in the long run) is to remove unnecessary files/ directories.
This should save a little space and a lot of time.

Some examples:

Using old files/md5 and files/patch-sum:

 rainier:/usr/pkgsrc/audio/libao$ ls -l {pkg,files}/{md5,patch-sum,checksum}
 ls: files/checksum: No such file or directory
 ls: pkg/checksum: No such file or directory
 ls: pkg/md5: No such file or directory
 ls: pkg/patch-sum: No such file or directory
 -rw-r--r--  1 root  wheel   79 Apr  5 01:44 files/md5
 -rw-r--r--  1 root  wheel  541 Apr  5 00:51 files/patch-sum
 rainier:/usr/pkgsrc/audio/libao$ make
 ===> Validating dependencies for libao-0.6.0nb1
 => Checksum OK for libao-0.6.0.tar.gz.
 ===> Extracting for libao-0.6.0nb1
 ===> Required installed package automake-1.4: automake-1.4 found
 ===> Required installed package autoconf-2.13: autoconf-2.13 found
 ===> Required installed package gmake>=3.78: gmake-3.79.1 found
 ===> Required installed package libtool-base>=1.4.20010219nb5: libtool-base-1.4.20010219nb5 found
 ===> Patching for libao-0.6.0nb1
 ===> Applying NetBSD patches for libao-0.6.0nb1
 ===> Configuring for libao-0.6.0nb1

(On an unrelated note, maybe it should tell you that the patches'
checksums were also successful. I made a patch for this in a different
email.)

Now an example of generating new and using new:

 rainier:/usr/pkgsrc/audio/libao$ make clean
 ===> Cleaning for libao-0.6.0nb1
 rainier:/usr/pkgsrc/audio/libao$ rm {pkg,files}/{md5,patch-sum,checksum}
 rm: pkg/md5: No such file or directory
 rm: pkg/patch-sum: No such file or directory
 rm: pkg/checksum: No such file or directory
 rm: files/checksum: No such file or directory
 rainier:/usr/pkgsrc/audio/libao$ rm -r files
 rainier:/usr/pkgsrc/audio/libao$ make makesum
 ===> Validating dependencies for libao-0.6.0nb1
 rainier:/usr/pkgsrc/audio/libao$ make makepatchsum
 ===> Making patch checksums
 rainier:/usr/pkgsrc/audio/libao$ ls -l {pkg,files}/{md5,patch-sum,checksum}
 ls: files/checksum: No such file or directory
 ls: files/md5: No such file or directory
 ls: files/patch-sum: No such file or directory
 ls: pkg/md5: No such file or directory
 -rw-r--r--  1 root  wheel   79 Apr  5 01:59 pkg/checksum
 -rw-r--r--  1 root  wheel  541 Apr  5 01:59 pkg/patch-sum
 rainier:/usr/pkgsrc/audio/libao$ make
 ===> Validating dependencies for libao-0.6.0nb1
 => Checksum OK for libao-0.6.0.tar.gz.
 ===> Extracting for libao-0.6.0nb1
 ===> Required installed package automake-1.4: automake-1.4 found
 ===> Required installed package autoconf-2.13: autoconf-2.13 found
 ===> Required installed package gmake>=3.78: gmake-3.79.1 found
 ===> Required installed package libtool-base>=1.4.20010219nb5: libtool-base-1.4.20010219nb5 found
 ===> Patching for libao-0.6.0nb1
 ===> Applying NetBSD patches for libao-0.6.0nb1
 ===> Configuring for libao-0.6.0nb1

Here is the patch:

--- ../../mk/bsd.pkg.mk.orig	Wed Apr  4 23:02:55 2001
+++ bsd.pkg.mk	Thu Apr  5 01:29:07 2001
@@ -267,8 +267,8 @@
 # Miscellaneous overridable commands:
 SHCOMMENT?=		${ECHO_MSG} >/dev/null '***'
 
-DIGEST_FILE?=		${FILESDIR}/md5
-PATCH_SUM_FILE?=	${FILESDIR}/patch-sum
+DIGEST_FILE?=		${PKGDIR}/checksum
+PATCH_SUM_FILE?=	${PKGDIR}/patch-sum
 
 .if exists(/usr/bin/m4)
 M4?=			/usr/bin/m4
@@ -1443,6 +1443,10 @@
 # Patch
 
 .if !target(do-patch)
+# Work with old files/patch-sum location
+.if !exists(${PATCH_SUM_FILE}) && !make(makepatchsum)
+PATCH_SUM_FILE=		${FILESDIR}/patch-sum
+.endif
 do-patch: uptodate-digest
 .if defined(PATCHFILES)
 	@${ECHO_MSG} "${_PKGSRC_IN}> Applying distribution patches for ${PKGNAME}"
@@ -2468,7 +2472,7 @@
 
 .if !target(makesum)
 makesum: fetch uptodate-digest
-	${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${FILESDIR}
+	${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${PKGDIR}
 	${_PKG_SILENT}${_PKG_DEBUG}if [ -f ${DIGEST_FILE} ]; then ${RM} -f ${DIGEST_FILE}; fi
 	@${ECHO} -n "$$" > ${DIGEST_FILE};				\
 		${ECHO} -n "NetBSD" >> ${DIGEST_FILE}; 			\
@@ -2489,7 +2493,7 @@
 .if !target(makepatchsum)
 makepatchsum mps: uptodate-digest
 	${_PKG_SILENT}${_PKG_DEBUG}					\
-	(${MKDIR} ${FILESDIR};						\
+	(${MKDIR} ${PKGDIR};						\
 	${ECHO_MSG} "${_PKGSRC_IN}> Making patch checksums";		\
 	if [ -f "${PATCH_SUM_FILE}" ]; then				\
 		${AWK} -- '{print ; exit}' < ${PATCH_SUM_FILE} > ${PATCH_SUM_FILE}.new; \
@@ -2535,6 +2539,10 @@
 .endif
 
 .if !target(checksum)
+# Work with old files/md5 location
+.if !exists(${DIGEST_FILE}) && !make(makesum)
+DIGEST_FILE=		${FILESDIR}/md5
+.endif
 checksum: fetch uptodate-digest
 	${_PKG_SILENT}${_PKG_DEBUG}					\
 	if [ ! -f ${DIGEST_FILE} ]; then				\



Any suggestions?

Should I send-pr this? (Also need to update pkglint, Packages.txt,
port2pkg and url2pkg.)

   Jeremy C. Reed
   http://www.reedmedia.net/