pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/pkgsrc-2004Q1]: pkgsrc/mk/bulk Pullup "specific bulk package" functio...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5d581716b1fe
branches:  pkgsrc-2004Q1
changeset: 471395:5d581716b1fe
user:      agc <agc%pkgsrc.org@localhost>
date:      Tue Apr 27 07:54:11 2004 +0000

description:
Pullup "specific bulk package" functionality to the pkgsrc-2004Q1
branch.  Also pullup a minor wording change in an informational
message whilst I'm here.

Requested by dmcmahill in ticket pkgsrc-14.

"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:

 mk/bulk/bsd.bulk-pkg.mk |  43 ++++++++++++++++++++++++++++++++++++++-----
 mk/bulk/build           |   5 ++++-
 mk/bulk/post-build      |   9 ++++++---
 3 files changed, 48 insertions(+), 9 deletions(-)

diffs (160 lines):

diff -r 091e17fa5165 -r 5d581716b1fe mk/bulk/bsd.bulk-pkg.mk
--- a/mk/bulk/bsd.bulk-pkg.mk   Tue Apr 27 07:48:43 2004 +0000
+++ b/mk/bulk/bsd.bulk-pkg.mk   Tue Apr 27 07:54:11 2004 +0000
@@ -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.57.2.1 2004/04/27 07:54:11 agc Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%NetBSD.org@localhost>
@@ -107,6 +107,13 @@
 # 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 @@
 .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 -r 091e17fa5165 -r 5d581716b1fe mk/bulk/build
--- a/mk/bulk/build     Tue Apr 27 07:48:43 2004 +0000
+++ b/mk/bulk/build     Tue Apr 27 07:54:11 2004 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: build,v 1.36 2004/02/25 09:20:59 grant Exp $
+# $NetBSD: build,v 1.36.2.1 2004/04/27 07:54:11 agc Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%NetBSD.org@localhost>
@@ -103,6 +103,7 @@
 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 @@
 echo "----------------------------------"
 echo "| Build Temporary Files:         |"
 echo "----------------------------------"
+echo "BULK_DBFILE     = $BULK_DBFILE"
 echo "DEPENDSTREEFILE = $DEPENDSTREEFILE"
 echo "DEPENDSFILE     = $DEPENDSFILE"
 echo "SUPPORTSFILE    = $SUPPORTSFILE"
@@ -140,6 +142,7 @@
 # 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 -r 091e17fa5165 -r 5d581716b1fe mk/bulk/post-build
--- a/mk/bulk/post-build        Tue Apr 27 07:48:43 2004 +0000
+++ b/mk/bulk/post-build        Tue Apr 27 07:54:11 2004 +0000
@@ -1,5 +1,5 @@
 #!/usr/pkg/bin/perl
-# $NetBSD: post-build,v 1.40 2004/03/22 21:54:48 jschauma Exp $
+# $NetBSD: post-build,v 1.40.2.1 2004/04/27 07:54:11 agc Exp $
 #
 # Collect stuff after a pkg bulk build
 #
@@ -48,6 +48,7 @@
 
 # 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($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 @@
 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 @@
 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>
@@ -467,7 +470,7 @@
 
        if ($verbose) {
                print "\n\n$ADMINSIG\n\n";
-               print "[* This message was created automatically! *]\n";
+               print "[* This message was created by the Packages Collection bulk build software *]\n";
        }
 }
 



Home | Main Index | Thread Index | Old Index