Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets Fix syntax error on OSX 10.5.



details:   https://anonhg.NetBSD.org/src/rev/9e8cee65dd7a
branches:  trunk
changeset: 749668:9e8cee65dd7a
user:      cegger <cegger%NetBSD.org@localhost>
date:      Sat Dec 05 15:56:25 2009 +0000

description:
Fix syntax error on OSX 10.5.
While here, simplify handling with OPTARG using IFS.

developped with and 'go for it' dsl@

diffstat:

 distrib/sets/makeflist    |  25 +++++++++++++------------
 distrib/sets/makeobsolete |  25 +++++++++++++------------
 distrib/sets/maketars     |  25 +++++++++++++------------
 3 files changed, 39 insertions(+), 36 deletions(-)

diffs (162 lines):

diff -r 316040f0d596 -r 9e8cee65dd7a distrib/sets/makeflist
--- a/distrib/sets/makeflist    Sat Dec 05 15:31:07 2009 +0000
+++ b/distrib/sets/makeflist    Sat Dec 05 15:56:25 2009 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makeflist,v 1.75 2009/11/30 16:13:23 uebayasi Exp $
+# $NetBSD: makeflist,v 1.76 2009/12/05 15:56:25 cegger Exp $
 #
 # Print out the files in some or all lists.
 # Usage: makeflist [-bxlo] [-a arch] [-m machine] [-s setsdir] [setname ...]
@@ -8,7 +8,7 @@
 
 rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
 . "${rundir}/sets.subr"
-lists="${nlists}"
+lists=
 
 usage()
 {
@@ -32,15 +32,16 @@
 while getopts L:bxXloa:m:s: ch; do
        case ${ch} in
        L)
-               lists=$(
-                       for _list in $( echo ${OPTARG} | tr , ' ' ); do
-                               case $_list in
-                               base)   echo "${nlists}" ;;
-                               x)      echo "${xlists}" ;;
-                               ext)    echo "${extlists}" ;;
-                               esac
-                       done
-               )
+               save_IFS="${IFS}"
+               IFS=,
+               for _list in ${OPTARG}; do
+                       case $_list in
+                       base)   lists="${lists} ${nlists}" ;;
+                       x)      lists="${lists} ${xlists}" ;;
+                       ext)    lists="${lists} ${extlists}" ;;
+                       esac
+               done
+               IFS="${save_IFS}"
                ;;
        # backward compat
        b)
@@ -83,4 +84,4 @@
        exit 0
 fi
 
-list_set_files ${lists} | ${AWK} '{print $1}' | ${SORT} -u
+list_set_files ${lists:-${nlists}} | ${AWK} '{print $1}' | ${SORT} -u
diff -r 316040f0d596 -r 9e8cee65dd7a distrib/sets/makeobsolete
--- a/distrib/sets/makeobsolete Sat Dec 05 15:31:07 2009 +0000
+++ b/distrib/sets/makeobsolete Sat Dec 05 15:56:25 2009 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makeobsolete,v 1.30 2009/11/30 16:13:23 uebayasi Exp $
+# $NetBSD: makeobsolete,v 1.31 2009/12/05 15:56:25 cegger Exp $
 #
 # Print out the obsolete files for a set
 # Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
@@ -9,7 +9,7 @@
 
 rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
 . "${rundir}/sets.subr"
-lists="${nlists}"
+lists=
 target=./dist
 obsolete=1
 
@@ -33,15 +33,16 @@
 while getopts L:bxya:m:s:t: ch; do
        case ${ch} in
        L)
-               lists=$(
-                       for _list in $( echo ${OPTARG} | tr , ' ' ); do
-                               case $_list in
-                               base)   echo "${nlists}" ;;
-                               x)      echo "${xlists}" ;;
-                               ext)    echo "${extlists}" ;;
-                               esac
-                       done
-               )
+               save_IFS="${IFS}"
+               IFS=,
+               for _list in ${OPTARG}; do
+                       case $_list in
+                       base)   lists="${lists} ${nlists}" ;;
+                       x)      lists="${lists} ${xlists}" ;;
+                       ext)    lists="${lists} ${extlists}" ;;
+                       esac
+               done
+               IFS="${save_IFS}"
                ;;
        # backward compat
        b)
@@ -81,7 +82,7 @@
        exit 1
 fi
 
-for setname in ${lists}; do
+for setname in ${lists:-${nlists}}; do
        file="${target}/${setname}"
        list_set_files "${setname}" | ${AWK} '{print $1}' | \
                ${SORT} -ru > "${file}"
diff -r 316040f0d596 -r 9e8cee65dd7a distrib/sets/maketars
--- a/distrib/sets/maketars     Sat Dec 05 15:31:07 2009 +0000
+++ b/distrib/sets/maketars     Sat Dec 05 15:56:25 2009 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: maketars,v 1.71 2009/12/03 12:44:57 apb Exp $
+# $NetBSD: maketars,v 1.72 2009/12/05 15:56:25 cegger Exp $
 #
 # Make release tar files for some or all lists.  Usage:
 # maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir]
@@ -20,7 +20,7 @@
 . "${rundir}/sets.subr"
 
 # set defaults
-lists="${nlists}"
+lists=
 tars="${RELEASEDIR}"
 dest="${DESTDIR}"
 metalog=
@@ -64,15 +64,16 @@
 while getopts L:bxyi:a:m:qs:SM:N:d:t: ch; do
        case ${ch} in
        L)
-               lists=$(
-                       for _list in $( echo ${OPTARG} | tr , ' ' ); do
-                               case $_list in
-                               base)   echo "${nlists}" ;;
-                               x)      echo "${xlists}" ;;
-                               ext)    echo "${extlists}" ;;
-                               esac
-                       done
-               )
+               save_IFS="${IFS}"
+               IFS=,
+               for _list in ${OPTARG}; do
+                       case $_list in
+                       base)   lists="${lists} ${nlists}" ;;
+                       x)      lists="${lists} ${xlists}" ;;
+                       ext)    lists="${lists} ${extlists}" ;;
+                       esac
+               done
+               IFS="${save_IFS}"
                ;;
        # backward compat
        b)
@@ -198,7 +199,7 @@
 GZIP=-9n               # for pax -z
 export GZIP
 es=0
-for setname in ${lists}; do
+for setname in ${lists:-${nlists}}; do
        out="${setname}.tgz"
        if [ -n "${installdir}" ]; then
                msg "Copying set ${setname}"



Home | Main Index | Thread Index | Old Index