- add 'bulk-cache' and 'clean-bulk-cache' targets to create and remove trunk
authordmcmahill <dmcmahill@pkgsrc.org>
Mon, 17 Dec 2001 02:32:22 +0000
branchtrunk
changeset 25319 b47e3034b890
parent 25318 8a81e7a4744d
child 25320 0b70a1bf7c51
- add 'bulk-cache' and 'clean-bulk-cache' targets to create and remove the cache files used during a bulk pkgsrc build. - replace the code in the build script that used to create the cache files with a 'make bulk-cache' call.
Makefile
mk/bulk/bsd.bulk-pkg.mk
mk/bulk/build
--- a/Makefile	Mon Dec 17 00:43:10 2001 +0000
+++ b/Makefile	Mon Dec 17 02:32:22 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.44 2001/07/17 13:11:51 wiz Exp $
+# $NetBSD: Makefile,v 1.45 2001/12/17 02:32:22 dmcmahill Exp $
 #
 
 .include "mk/bsd.prefs.mk"
@@ -53,6 +53,14 @@
 
 .include "mk/bsd.pkg.subdir.mk"
 
+# the bulk-cache and clean-bulk-cache targets are a global-pkgsrc
+# thing and thus it makes sense to run it from the top level pkgsrc
+# directory.
+.if make(bulk-cache) || make(clean-bulk-cache)
+.include "${.CURDIR}/mk/bulk/bsd.bulk-pkg.mk"
+_PKGSRCDIR?=${.CURDIR}
+.endif
+
 index:
 	@rm -f ${.CURDIR}/INDEX
 	@${MAKE} ${.CURDIR}/INDEX
--- a/mk/bulk/bsd.bulk-pkg.mk	Mon Dec 17 00:43:10 2001 +0000
+++ b/mk/bulk/bsd.bulk-pkg.mk	Mon Dec 17 02:32:22 2001 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.bulk-pkg.mk,v 1.33 2001/12/16 14:27:07 dmcmahill Exp $
+#	$NetBSD: bsd.bulk-pkg.mk,v 1.34 2001/12/17 02:32:23 dmcmahill Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
@@ -105,6 +105,35 @@
 # and also for xpkgwedge.  Add pkgtools/xpkgwedge in /etc/mk.conf to do an xpkgwedged bulk build.
 BULK_PREREQ+=		pkgtools/digest
 
+
+# build the cache files used as part of a full bulk build
+# Note:  we have to install the BULK_PREREQ packages _before_
+# extracting the depends tree because some packages like
+# xpkgwedge only become DEPENDS if it is installed
+bulk-cache:
+	${ECHO_MSG} "Installing BULK_PREREQ packages"
+.for __prereq in ${BULK_PREREQ}
+	cd ${_PKGSRCDIR}/${__prereq} && ${MAKE} bulk-install
+.endfor
+	@${ECHO_MSG} "BULK> Building complete pkgsrc dependency tree (this may take a while)."
+	cd ${_PKGSRCDIR} && ${SH} mk/bulk/printdepends ${BROKENFILE} > ${DEPENDSTREEFILE}
+	@${ECHO_MSG} "BULK> Sorting build order."
+	tsort ${DEPENDSTREEFILE} > ${ORDERFILE}
+	@${ECHO_MSG} "BULK> Generating up and down dependency files."
+	${_PKGSRCDIR}/mk/bulk/tflat -u ${DEPENDSTREEFILE} > ${SUPPORTSFILE}
+	${_PKGSRCDIR}/mk/bulk/tflat -d ${DEPENDSTREEFILE} > ${DEPENDSFILE}
+	@${ECHO_MSG} "BULK> Generating package name <=> package directory cross reference file"
+	@${ECHO_MSG} "      (this may take a while)."
+	cd ${_PKGSRCDIR} && ${SH} mk/bulk/printindex ${BROKENFILE} > ${INDEXFILE}
+
+# remove the bulk cache files
+clean-bulk-cache:
+	${RM} -f ${DEPENDSTREEFILE} \
+		${DEPENDSFILE} \
+		${SUPPORTSFILE} \
+		${INDEXFILE} \
+		${ORDERFILE}
+
 # check if the $REF file is uptodate, i.e. is newer than any of
 # the pkg files; prints "1" if upto date, "0" if not.
 bulk-check-uptodate:
@@ -338,3 +367,4 @@
 		${ECHO_MSG} ${MAKE} bulk-package PRECLEAN=no; \
 		${DO}       ${MAKE} bulk-package PRECLEAN=no; \
 	fi
+
--- a/mk/bulk/build	Mon Dec 17 00:43:10 2001 +0000
+++ b/mk/bulk/build	Mon Dec 17 02:32:22 2001 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: build,v 1.19 2001/12/01 12:40:52 hubertf Exp $
+# $NetBSD: build,v 1.20 2001/12/17 02:32:23 dmcmahill Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@netbsd.org>
@@ -137,25 +137,10 @@
 	cd ${USR_PKGSRC}/$pkgdir && make bulk-install
 done
 
-# Figure out optimal build order.
+# Create the bulk cache files
 cd ${USR_PKGSRC}
 if [ "$1" != "restart" ]; then
-	echo "Building dependency tree (this may take a while)..."
-	sh mk/bulk/printdepends $BROKENFILE > $DEPENDSTREEFILE
-
-	echo "Sorting build order..."
-	tsort $DEPENDSTREEFILE > $ORDERFILE
-
-	echo "Generating up and down dependency files..."
-	./mk/bulk/tflat -u $DEPENDSTREEFILE > $SUPPORTSFILE
-	./mk/bulk/tflat -d $DEPENDSTREEFILE > $DEPENDSFILE
-
-	echo "Generating package name <=> package directory cross reference file (this may take a while)..."
-	sh mk/bulk/printindex $BROKENFILE > $INDEXFILE
-	if [ $? != 0 ]; then
-		echo "ERROR while creating $INDEXFILE"
-		exit 1
-	fi
+	cd ${USR_PKGSRC} && make bulk-cache
 fi
 
 echo "Starting actual build using the order specified in $ORDERFILE..."