summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authordmcmahill <dmcmahill@pkgsrc.org>2004-04-07 22:56:34 +0000
committerdmcmahill <dmcmahill@pkgsrc.org>2004-04-07 22:56:34 +0000
commiteb0a5dcca7a68b306d9fb9e3d4f44b48cc32e3cb (patch)
tree69bb1d0d9885157508b41df893cc22a81a7cd8c3 /mk
parent2a8f9c23d44d4cdc6f2a9dcd939489acefcf6193 (diff)
downloadpkgsrc-eb0a5dcca7a68b306d9fb9e3d4f44b48cc32e3cb.tar.gz
Add support in the bulk build code to properly deal with SPECIFIC_PKGS=1.
In particular, when SPECIFIC_PKGS is set in /etc/mk.conf, you can now do sh mk/bulk/build and have the right thing happen. Only those packages explicitly listed and those which are depended upon are considered for the build. Other than the restricted list of packages, the bulk build works the same way as a full bulk build.
Diffstat (limited to 'mk')
-rw-r--r--mk/bulk/bsd.bulk-pkg.mk43
-rw-r--r--mk/bulk/build5
-rw-r--r--mk/bulk/post-build7
3 files changed, 47 insertions, 8 deletions
diff --git a/mk/bulk/bsd.bulk-pkg.mk b/mk/bulk/bsd.bulk-pkg.mk
index f0fa305164d..d1914172650 100644
--- a/mk/bulk/bsd.bulk-pkg.mk
+++ b/mk/bulk/bsd.bulk-pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.bulk-pkg.mk,v 1.57 2004/02/25 09:20:59 grant Exp $
+# $NetBSD: bsd.bulk-pkg.mk,v 1.58 2004/04/07 22:56:34 dmcmahill Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org>
@@ -107,6 +107,13 @@ ORDERFILE?= ${_PKGSRCDIR}/.order${BULK_ID}
# for looking for leftover files (files not properly deinstalled)
STARTFILE?= ${_PKGSRCDIR}/.start${BULK_ID}
+# file which is used as a database for bulk builds in which SPECIFIC_PKGS is
+# defined. This database is used to hold all the dependency and index information
+# for the specific packages as well as their dependencies. In a SPECIFIC_PKGS
+# bulk build, this file is created and then used to create the INDEXFILE and
+# DEPENDSTREEFILE.
+BULK_DBFILE?= ${_PKGSRCDIR}/.bulk_db${BULK_ID}
+
# a list of pkgs which we should _never_ delete during a build. The primary use is for digest
# and also for xpkgwedge. Add pkgtools/xpkgwedge in /etc/mk.conf to do an xpkgwedged bulk build.
BULK_PREREQ+= pkgtools/digest
@@ -123,20 +130,46 @@ bulk-cache:
.for __prereq in ${BULK_PREREQ}
cd ${_PKGSRCDIR}/${__prereq} && ${MAKE} bulk-install
.endfor
+ ${RM} -f ${BULK_DBFILE}
+ ${TOUCH} ${BULK_DBFILE}
+.if !defined(SPECIFIC_PKGS)
+ @${ECHO} "This file is unused for a full pkgsrc bulk build" >> ${BULK_DBFILE}
+ @${ECHO} "It is only used for a SPECIFIC_PKGS bulk build" >> ${BULK_DBFILE}
@${ECHO_MSG} "BULK> Building complete pkgsrc dependency tree (this may take a while)."
cd ${_PKGSRCDIR} && ${SH} mk/bulk/printdepends ${BROKENFILE} > ${DEPENDSTREEFILE}
+ @${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}
+.else
+ @${ECHO_MSG} "BULK> Extracting database for SPECIFIC_PKGS subset of pkgsrc"
+ @${ECHO_MSG} " along with their dependencies"
+.for __tmp__ in ${SUBDIR} ${BULK_PREREQ} lang/perl5 pkgtools/pkglint
+ cd ${_PKGSRCDIR}/${__tmp__} && ../../mk/scripts/mkdatabase -a -f ${BULK_DBFILE}
+.endfor
+ @${ECHO_MSG} "BULK> Extracting dependency tree file"
+ ${AWK} '/^(build_)?depends/ {pkgs[$$2] = 1; cat=$$2; sub(/\/.*/, "", cat); \
+ for(i=3; i<=NF; i=i+1){ \
+ listed[$$2] = 1; \
+ sub(/[^:]*:\.\.\/\.\.\//, "", $$i); \
+ sub(/[^:]*:\.\./, cat , $$i); \
+ print $$i " " $$2; \
+ }} END{ \
+ for(pkg in pkgs) {if( pkg in listed ) {} else{ print pkg " " pkg;}} \
+ }' \
+ ${BULK_DBFILE} | ${SORT} -u > ${DEPENDSTREEFILE}
+ @${ECHO_MSG} "BULK> Extracting package name <=> package directory cross reference file"
+ ${AWK} '/^index/ {print $$2 " " $$3 " "}' ${BULK_DBFILE} > ${INDEXFILE}
+.endif
@${ECHO_MSG} "BULK> Sorting build order."
${TSORT} ${DEPENDSTREEFILE} > ${ORDERFILE}
@${ECHO_MSG} "BULK> Generating up and down dependency files."
${AWK} -f ${_PKGSRCDIR}/mk/bulk/tflat up ${DEPENDSTREEFILE} > ${SUPPORTSFILE}
${AWK} -f ${_PKGSRCDIR}/mk/bulk/tflat down ${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} \
+ ${RM} -f ${BULK_DBFILE} \
+ ${DEPENDSTREEFILE} \
${DEPENDSFILE} \
${SUPPORTSFILE} \
${INDEXFILE} \
diff --git a/mk/bulk/build b/mk/bulk/build
index 6d36d6d84dc..f2c0f48efb4 100644
--- a/mk/bulk/build
+++ b/mk/bulk/build
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: build,v 1.36 2004/02/25 09:20:59 grant Exp $
+# $NetBSD: build,v 1.37 2004/04/07 22:56:34 dmcmahill Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org>
@@ -103,6 +103,7 @@ fi
fail=no
if [ -d pkgtools/pkglint ]; then
cd pkgtools/pkglint
+ BULK_DBFILE=`${BMAKE} show-var VARNAME=BULK_DBFILE` || fail=yes
DEPENDSTREEFILE=`${BMAKE} show-var VARNAME=DEPENDSTREEFILE` || fail=yes
DEPENDSFILE=`${BMAKE} show-var VARNAME=DEPENDSFILE` || fail=yes
SUPPORTSFILE=`${BMAKE} show-var VARNAME=SUPPORTSFILE` || fail=yes
@@ -127,6 +128,7 @@ fi
echo "----------------------------------"
echo "| Build Temporary Files: |"
echo "----------------------------------"
+echo "BULK_DBFILE = $BULK_DBFILE"
echo "DEPENDSTREEFILE = $DEPENDSTREEFILE"
echo "DEPENDSFILE = $DEPENDSFILE"
echo "SUPPORTSFILE = $SUPPORTSFILE"
@@ -140,6 +142,7 @@ echo "----------------------------------"
# make sure we have values for these very important
# variables
if [ $fail = "yes" -o \
+ -z "$BULK_DBFILE" -o \
-z "$DEPENDSTREEFILE" -o \
-z "$DEPENDSFILE" -o \
-z "$SUPPORTSFILE" -o \
diff --git a/mk/bulk/post-build b/mk/bulk/post-build
index a27cdf17c91..f6c35195b99 100644
--- a/mk/bulk/post-build
+++ b/mk/bulk/post-build
@@ -1,5 +1,5 @@
#!/usr/pkg/bin/perl
-# $NetBSD: post-build,v 1.41 2004/03/28 20:35:29 agc Exp $
+# $NetBSD: post-build,v 1.42 2004/04/07 22:56:34 dmcmahill Exp $
#
# Collect stuff after a pkg bulk build
#
@@ -48,6 +48,7 @@ chomp($BROKENFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VA
# also extract the names of the cache files used during the bulk build. We'll save a copy of
# those to help debug if the build messed up.
+chomp($BULK_DBFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=BULK_DBFILE )`);
chomp($DEPENDSTREEFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=DEPENDSTREEFILE )`);
chomp($DEPENDSFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=DEPENDSFILE )`);
chomp($SUPPORTSFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=SUPPORTSFILE )`);
@@ -58,6 +59,7 @@ chomp($LOCALBASE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VAR
chomp($X11BASE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=X11BASE )`);
chomp($FIND=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=FIND )`);
chomp($GTAR=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=GTAR )`);
+$bulkdbfile=basename($BULK_DBFILE);
$dtfile=basename($DEPENDSTREEFILE);
$depfile=basename($DEPENDSFILE);
$supfile=basename($SUPPORTSFILE);
@@ -92,7 +94,7 @@ chdir($USR_PKGSRC);
system("find . -name $BROKENFILE -print | $GTAR -T - -plcf - | (cd $FTP; $GTAR -plxf -)");
# Copy over the cache files used during the build
-foreach my $f ($DEPENDSTREEFILE, $DEPENDSFILE, $SUPPORTSFILE, $INDEXFILE, $ORDERFILE) {
+foreach my $f ($BULK_DBFILE, $DEPENDSTREEFILE, $DEPENDSFILE, $SUPPORTSFILE, $INDEXFILE, $ORDERFILE) {
system("cp ${f} ${FTP}") if -f ${f};
}
@@ -442,6 +444,7 @@ EOHTML
The following cache files were used during the build:
</p>
<ul>
+<li>The <a href="$bulkdbfile">SPECIFIC_PKGS bulk database file</a>.</li>
<li>The <a href="$dtfile">depends tree file</a>.</li>
<li>The <a href="$depfile">depends file</a>.</li>
<li>The <a href="$supfile">supports file</a>.</li>