Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets * Add a special case for sets="all".



details:   https://anonhg.NetBSD.org/src/rev/744a0ae813ad
branches:  trunk
changeset: 586866:744a0ae813ad
user:      apb <apb%NetBSD.org@localhost>
date:      Wed Jan 04 14:44:41 2006 +0000

description:
* Add a special case for sets="all".
* Use dirname, don't try to use a shortcut that doesn't always work.
  This uses the cheap implementation of dirname from sets.subr.
* Fix error in getopts string ("-p" option takes an arg).
* Explicitly use ${HOST_SH} to run culldeps script, because we might
  be on a host where /bin/sh is not a POSIX shell.

Reviewed by agc

diffstat:

 distrib/sets/syspkgdeps |  22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diffs (65 lines):

diff -r e9f23fc379aa -r 744a0ae813ad distrib/sets/syspkgdeps
--- a/distrib/sets/syspkgdeps   Wed Jan 04 14:35:03 2006 +0000
+++ b/distrib/sets/syspkgdeps   Wed Jan 04 14:44:41 2006 +0000
@@ -9,12 +9,14 @@
 
 #set -u
 
-#
-# set defaults and import setlist subroutines
-#
+prog="${0##*/}"
 rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
 . "${rundir}/sets.subr"
 
+#
+# set defaults
+#
+prefix=/
 
 usage()
 {
@@ -30,7 +32,7 @@
 }
 
 # parse arguments
-while getopts a:m:ps: ch; do
+while getopts a:m:p:s: ch; do
        case ${ch} in
        a)
                MACHINE_ARCH="${OPTARG}"
@@ -56,9 +58,12 @@
 fi
 
 sets="$*"
+case "${sets}" in
+all)   sets="${nlists}" ;;
+esac
 
 # TBD clean up
-SCRATCH="$(${MKTEMP} -d "/var/tmp/${0##*/}.XXXXXX")"
+SCRATCH="$(${MKTEMP} -d "/var/tmp/${prog}.XXXXXX")"
 
 [ $? -ne 0 ] && { echo "Could not create scratch directory." 1>&2 ; exit 1 ; }
 
@@ -84,8 +89,9 @@
 echo "computing parent pathnames" 1>&2
 
 while read pathname pkgname; do
-       # print parent pathname
-       echo "${pathname%/*}"
+       # print parent pathname.
+       # (This uses a cheap implementation of dirname from sets.subr.)
+       dirname "${pathname}"
 done < "${PATH_MEMBERSHIP}" > "${PARENT_PATHNAMES}"
 
 echo "selecting parent packages using parent pathnames" 1>&2
@@ -94,7 +100,7 @@
        ${PASTE} "${PATH_MEMBERSHIP}" - | \
        ${AWK} '{ if ($2 != $4) print $2 " " $4; }' | \
        ${SORT} -u | \
-       "${rundir}/culldeps"
+       ${HOST_SH} "${rundir}/culldeps"
 
 if [ $? -ne 0 ]; then
        echo "error in parent-directory lookup, aborting" 1>&2



Home | Main Index | Thread Index | Old Index