Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets Add shell variables defined in sets.subr for al...



details:   https://anonhg.NetBSD.org/src/rev/a61bb1d430f9
branches:  trunk
changeset: 586836:a61bb1d430f9
user:      apb <apb%NetBSD.org@localhost>
date:      Tue Jan 03 16:40:16 2006 +0000

description:
Add shell variables defined in sets.subr for almost all commands used
by scripts in distrib/sets/*.  This is intended to be useful when cross
building.  Only trivial commands like echo, cat, and rm are excluded
from this treatment.

While I am here, make ${MTREE} and ${DB} follow the pattern used by most
other such variables.

Reviewed by agc.

diffstat:

 distrib/sets/checkflist   |  14 +++++++-------
 distrib/sets/culldeps     |  14 +++++++-------
 distrib/sets/listpkgs     |   4 ++--
 distrib/sets/makeflist    |   4 ++--
 distrib/sets/makeobsolete |   4 ++--
 distrib/sets/makeplist    |  12 ++++++------
 distrib/sets/makesrctars  |   8 ++++----
 distrib/sets/makesums     |   5 +++--
 distrib/sets/maketars     |  11 ++++++-----
 distrib/sets/regpkg       |  39 +++++++++++++++++++++------------------
 distrib/sets/regpkgset    |  12 ++++++------
 distrib/sets/sets.subr    |  32 +++++++++++++++++++++++++-------
 distrib/sets/syspkgdeps   |  20 ++++++++++----------
 13 files changed, 101 insertions(+), 78 deletions(-)

diffs (truncated from 571 to 300 lines):

diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/checkflist
--- a/distrib/sets/checkflist   Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/checkflist   Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh --
 #
-#      $NetBSD: checkflist,v 1.27 2006/01/03 15:42:42 apb Exp $
+#      $NetBSD: checkflist,v 1.28 2006/01/03 16:40:16 apb Exp $
 #
 # Verify output of makeflist against contents of $DESTDIR.
 
@@ -85,7 +85,7 @@
 
 (
        cd $DESTDIR
-       find $origin \( -type d -o -type f -o -type l \) -print
+       ${FIND} $origin \( -type d -o -type f -o -type l \) -print
 ) | (
        while read line; do
                case "$line" in
@@ -96,13 +96,13 @@
                        ;;
                esac
        done
-) | sort > $SDIR/files
+) | ${SORT} > $SDIR/files
 
-comm -23 $SDIR/flist $SDIR/files > $SDIR/missing
-comm -13 $SDIR/flist $SDIR/files > $SDIR/extra
+${COMM} -23 $SDIR/flist $SDIR/files > $SDIR/missing
+${COMM} -13 $SDIR/flist $SDIR/files > $SDIR/extra
 
 if [ -s $SDIR/extra ]; then
-       count=$(awk 'END {print NR}' $SDIR/extra)
+       count=$(${AWK} 'END {print NR}' $SDIR/extra)
        echo ""
        echo "============  ${count} extra files  ==============="
        echo "Files in DESTDIR but missing from flist."
@@ -119,7 +119,7 @@
 fi
 
 if [ -s $SDIR/missing ]; then
-       count=$(awk 'END {print NR}' $SDIR/missing)
+       count=$(${AWK} 'END {print NR}' $SDIR/missing)
        echo ""
        echo "===========  ${count} missing files  =============="
        echo "Files in flist but missing from DESTDIR."
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/culldeps
--- a/distrib/sets/culldeps     Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/culldeps     Tue Jan 03 16:40:16 2006 +0000
@@ -19,28 +19,28 @@
 # and A D can be derived from A B, B C, C D by transitivity.
 #
 
-SCRATCH=$(mktemp -d /var/tmp/$0.XXXXXX)
+SCRATCH=$(${MKTEMP} -d /var/tmp/$0.XXXXXX)
 NEXTLEFTOVERS=$SCRATCH/leftovers0
 LASTJOIN=$SCRATCH/join0
 NEXTJOIN=$SCRATCH/join1
 TAB="  "
 
-sort -k 1 > $LASTJOIN
+${SORT} -k 1 > $LASTJOIN
 
 LEFTOVERS=$LASTJOIN
 
-while [ $(wc -l $LASTJOIN | awk '{ print $1; }') -ne 0 ]; do
+while [ $(${WC} -l $LASTJOIN | ${AWK} '{ print $1; }') -ne 0 ]; do
 
        #
        # From dependencies X-requires-Y in $LEFTOVERS and Y-requires-Z in
        # $LASTJOIN, produce dependencies X-requires-Z and write them to
        # $NEXTJOIN.
        #
-       sort -k 2 < $LEFTOVERS | join -1 2 -2 1 -o '1.1 2.2' - $LASTJOIN | \
-           sort -u > $NEXTJOIN
+       ${SORT} -k 2 < $LEFTOVERS | ${JOIN} -1 2 -2 1 -o '1.1 2.2' - $LASTJOIN | \
+           ${SORT} -u > $NEXTJOIN
        if [ ${DEBUG:-0} -gt 0 ]; then
                echo "### filtered ###" 1>&2
-               join -t "$TAB" $NEXTJOIN $LEFTOVERS | sort 1>&2
+               ${JOIN} -t "$TAB" $NEXTJOIN $LEFTOVERS | ${SORT} 1>&2
                echo "###" 1>&2
        fi
 
@@ -49,7 +49,7 @@
        # were produced in the previous step. Write the new leftovers to
        # $NEXTLEFTOVERS.
        #
-       join -v 2 -t "$TAB" $NEXTJOIN $LEFTOVERS | sort -u > $NEXTLEFTOVERS
+       ${JOIN} -v 2 -t "$TAB" $NEXTJOIN $LEFTOVERS | ${SORT} -u > $NEXTLEFTOVERS
 
        #
        # Swap output files before repeating. 
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/listpkgs
--- a/distrib/sets/listpkgs     Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/listpkgs     Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: listpkgs,v 1.9 2004/07/23 15:11:26 erh Exp $
+# $NetBSD: listpkgs,v 1.10 2006/01/03 16:40:16 apb Exp $
 #
 # List all packages in the given pkgset by parsing the list files.
 #
@@ -46,4 +46,4 @@
 fi
 setname="$1"
 
-list_set_files $setname | awk '{print $2}' | sort -u
+list_set_files $setname | ${AWK} '{print $2}' | ${SORT} -u
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/makeflist
--- a/distrib/sets/makeflist    Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/makeflist    Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makeflist,v 1.71 2004/07/23 15:11:26 erh Exp $
+# $NetBSD: makeflist,v 1.72 2006/01/03 16:40:16 apb Exp $
 #
 # Print out the files in some or all lists.
 # Usage: makeflist [-bxlo] [-a arch] [-m machine] [-s setsdir] [setname ...]
@@ -66,4 +66,4 @@
        exit 0
 fi
 
-list_set_files $lists | awk '{print $1}' | sort -u
+list_set_files $lists | ${AWK} '{print $1}' | ${SORT} -u
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/makeobsolete
--- a/distrib/sets/makeobsolete Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/makeobsolete Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makeobsolete,v 1.25 2005/03/28 03:12:34 lukem Exp $
+# $NetBSD: makeobsolete,v 1.26 2006/01/03 16:40:16 apb Exp $
 #
 # Print out the obsolete files for a set
 # Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
@@ -65,5 +65,5 @@
 
 for setname in $lists; do
        file=$target/${setname}
-       list_set_files $setname | awk '{print $1}' | sort -ru > $file
+       list_set_files $setname | ${AWK} '{print $1}' | ${SORT} -ru > $file
 done
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/makeplist
--- a/distrib/sets/makeplist    Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/makeplist    Tue Jan 03 16:40:16 2006 +0000
@@ -54,11 +54,11 @@
 dfilename=/tmp/makeplist.dirs.$$ 
 
 list_set_files $setname | \
-    env PLISTPKG=$pkgname awk '
+    ${ENV_CMD} PLISTPKG=$pkgname ${AWK} '
        $2 == ENVIRON["PLISTPKG"] {
                sub("^\\./", "", $1);
                print $1
-       }' | sort -u > $filename
+       }' | ${SORT} -u > $filename
 
 SELECTDIRS="-prune -type d"
 SELECTNONDIRS="! -type d -print -o ( -type d -prune )"
@@ -77,8 +77,8 @@
 xargs echo $SELECTDIRS < $filename | \
 while read ignore ignore ignore args; do
        [ -z "$args" ] && break 
-       find $args $SELECTDIRS
-done | awk '{ print "@dirrm " $1; }' > $dfilename
+       ${FIND} $args $SELECTDIRS
+done | ${AWK} '{ print "@dirrm " $1; }' > $dfilename
 
 #
 # Match the non-directories.  Use find(1) to avoid repeat calls to
@@ -89,7 +89,7 @@
 while read ignore ignore ignore ignore ignore ignore ignore ignore ignore \
     ignore args; do
        [ -z "$args" ] && break 
-       find $args $SELECTNONDIRS
+       ${FIND} $args $SELECTNONDIRS
 done > $ffilename
 
 cd -
@@ -99,7 +99,7 @@
        cat $ffilename
 fi
 if [ -s $dfilename ]; then
-        sort -r $dfilename
+        ${SORT} -r $dfilename
 fi
 
 rm -f $filename $ffilename $dfilename
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/makesrctars
--- a/distrib/sets/makesrctars  Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/makesrctars  Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#      $NetBSD: makesrctars,v 1.28 2006/01/03 15:42:42 apb Exp $
+#      $NetBSD: makesrctars,v 1.29 2006/01/03 16:40:16 apb Exp $
 #
 # makesrctars srcdir setdir
 #      Create source tarballs in setdir from the source under srcdir.
@@ -76,12 +76,12 @@
        fi
        set -f
        ${MTREE} -c -X /tmp/in$$ | ${MTREE} -C -k type | \
-               egrep -v 'type=link' | egrep $egrep | \
-               sed -e 's:type=file:& mode=0664:' \
+               ${EGREP} -v 'type=link' | ${EGREP} $egrep | \
+               ${SED} -e 's:type=file:& mode=0664:' \
                        -e 's:type=dir:& mode=0775:' \
                        -e 's:$: uname=root gname=wsrc:' | \
                ${PAX} -M -N ${PASSWD} -w -d -s'|^\.|'${srcprefix}'|' | \
-               gzip > "${setdir}/${set}"
+               ${GZIP_CMD} > "${setdir}/${set}"
        rm -f /tmp/in$$
 )}
 
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/makesums
--- a/distrib/sets/makesums     Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/makesums     Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makesums,v 1.12 2006/01/03 15:42:42 apb Exp $
+# $NetBSD: makesums,v 1.13 2006/01/03 16:40:16 apb Exp $
 #
 # Make checksum files for files in ``tardir''.  Usage:
 # makesums [-a] [-t tardir] [setname [...]]
@@ -71,7 +71,8 @@
 elif [ -z "$pat" ]; then
        pat='*.tgz'
 fi
-lists=$(find $pat -prune \( -type f -o -type l \) \! -name '*SUM' \! -name MD5 \! -name SHA512 2>/dev/null)
+lists=$(${FIND} $pat -prune \( -type f -o -type l \) \
+       \! -name '*SUM' \! -name MD5 \! -name SHA512 2>/dev/null)
 if [ -n "$lists" ]; then
        eval ${CKSUM} -o1 $lists $append BSDSUM
        eval ${CKSUM}     $lists $append CKSUM
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/maketars
--- a/distrib/sets/maketars     Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/maketars     Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: maketars,v 1.56 2006/01/03 15:42:42 apb Exp $
+# $NetBSD: maketars,v 1.57 2006/01/03 16:40:16 apb Exp $
 #
 # Make release tar files for some or all lists.  Usage:
 # maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir]
@@ -93,7 +93,7 @@
 done
 shift $((${OPTIND} - 1))
 if [ -n "$installdir" ]; then  # if -i, remove etc & xetc from the default list
-       lists=$(echo $lists | sed -e 's/ etc / /;s/ xetc / /')
+       lists=$(echo $lists | ${SED} -e 's/ etc / /;s/ xetc / /')
 fi
 if [ -n "$*" ]; then
        lists="$*"
@@ -143,11 +143,12 @@
            -s $setsdir $setname > $SDIR/flist.$setname
        if [ -n "$metalog" ]; then
                $setfilesonly && echo "Creating ${setlistdir}/set.${setname}"
-               awk -f $rundir/getdirs.awk $SDIR/flist.$setname \
-                   | sort -u > $SDIR/flist.$setname.full
+               ${AWK} -f $rundir/getdirs.awk $SDIR/flist.$setname \
+                   | ${SORT} -u > $SDIR/flist.$setname.full
                (
                        echo "/set uname=root gname=wheel"
-                       awk -f $rundir/join.awk $SDIR/flist.$setname.full $SDIR/metalog
+                       ${AWK} -f $rundir/join.awk \
+                               $SDIR/flist.$setname.full $SDIR/metalog
                        echo "./etc/mtree/set.${setname} type=file mode=0444"
                ) > ${setlistdir}/set.${setname}
        elif ! cmp -s ${SDIR}/flist.${setname} \
diff -r 275c03d3d5c2 -r a61bb1d430f9 distrib/sets/regpkg
--- a/distrib/sets/regpkg       Tue Jan 03 15:43:04 2006 +0000
+++ b/distrib/sets/regpkg       Tue Jan 03 16:40:16 2006 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# $NetBSD: regpkg,v 1.6 2004/07/23 15:11:26 erh Exp $
+# $NetBSD: regpkg,v 1.7 2006/01/03 16:40:16 apb Exp $
 #
 # Copyright (c) 2003 Alistair G. Crooks.  All rights reserved.
 #
@@ -72,21 +72,21 @@
 
 # create the pkg tiny version
 case "${SYSPKG_DATES}" in
-"")    tinyvers=`awk '$1 ~ '/$pkg/' { print $2 }' $rundir/versions`
+"")    tinyvers=`${AWK} '$1 ~ '/$pkg/' { print $2 }' $rundir/versions`
        case "$tinyvers" in
        "")     tinyvers=0
                ;;
        esac
        if [ -f ../../sys/conf/osrelease.sh ]; then
-               osvers=`sh ../../sys/conf/osrelease.sh`
+               osvers=`${HOST_SH} ../../sys/conf/osrelease.sh`



Home | Main Index | Thread Index | Old Index