diff options
author | dmcmahill <dmcmahill@pkgsrc.org> | 2003-01-05 15:17:24 +0000 |
---|---|---|
committer | dmcmahill <dmcmahill@pkgsrc.org> | 2003-01-05 15:17:24 +0000 |
commit | 3c18e7dacd0b14c056c8f62afea1929515fe75f0 (patch) | |
tree | 7410ceb1ac1edd07491f2a62a238a000536f88c9 /mk | |
parent | 536207c4ce58cce3f388bc5382e488963514ad59 (diff) | |
download | pkgsrc-3c18e7dacd0b14c056c8f62afea1929515fe75f0.tar.gz |
add a -a|--append option to allow appending to an existing database instead of
creating a new one.
Diffstat (limited to 'mk')
-rwxr-xr-x | mk/scripts/mkdatabase | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/mk/scripts/mkdatabase b/mk/scripts/mkdatabase index eb6cc9ff6f6..3cbfa6846da 100755 --- a/mk/scripts/mkdatabase +++ b/mk/scripts/mkdatabase @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkdatabase,v 1.2 2003/01/04 22:27:46 dmcmahill Exp $ +# $NetBSD: mkdatabase,v 1.3 2003/01/05 15:17:24 dmcmahill Exp $ # # Script for generating a database with complete dependency information # for a particular package @@ -54,7 +54,7 @@ prog=$0 usage(){ echo "$prog - Generates a complete dependency tree for a particular package" - echo "Usage: $prog [-d|--debug] [-f|--database database]" + echo "Usage: $prog [-a|--append] [-d|--debug] [-f|--database database]" echo " " echo " $prog -h|--help" echo " " @@ -62,6 +62,8 @@ usage(){ echo " " echo "The options supported by $prog are: " echo " " + echo " -a|--append Append to the database rather than overwriting it" + echo " " echo " -d|--debug Enables debugging output" echo " " echo " -f|--database <file> Writes the database into file specified by <file>" @@ -86,6 +88,7 @@ clean_and_exit(){ ###################################################################### DEBUG= +append=no while test -n "$1" @@ -93,6 +96,12 @@ do case "$1" in + # Append to the database + -a|--append) + append=yes + shift + ;; + # Turn on debugging -d|--debug) DEBUG=yes @@ -151,9 +160,32 @@ case ${DATABASE} in ;; esac -echo "$prompt Creating database in ${DATABASE}" -${BMAKE} print-summary-data > ${DATABASE} || exit 1 +if [ "X$append" = "Xyes" ]; then + echo "$prompt Appending to database in ${DATABASE}" + if [ ! -f ${DATABASE} ]; then + touch ${DATABASE} + fi + # make sure we haven't already been listed before + # appending ourselves. + here=`pwd` + tmp1=`dirname $here` + pkgcat=`basename $tmp1` + pkg=`basename $here` + pkgpath=$pkgcat/$pkg + if [ "x$DEBUG" = "xyes" ]; then + echo "Looking for $pkgpath before appending" + fi + if grep "^index $pkgpath " ${DATABASE} >/dev/null 2>&1 ; then + echo "$prompt $pkgpath has already been depended. Skipping..." + exit 0 + else + ${BMAKE} print-summary-data >> ${DATABASE} || exit 1 + fi +else + echo "$prompt Creating new database in ${DATABASE}" + ${BMAKE} print-summary-data > ${DATABASE} || exit 1 +fi here=`pwd` echo "$prompt Depending in $here (pass #1)" dirs=`${AWK} -f ../../mk/scripts/chkdatabase.awk debug=${DEBUG} ${DATABASE}` |