pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/bulk - Condensed the code.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/591fa490d9dd
branches:  trunk
changeset: 502539:591fa490d9dd
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Nov 05 21:52:33 2005 +0000

description:
- Condensed the code.
- Sorted the command line options alphabetically in the parse loop.

diffstat:

 mk/bulk/build |  55 ++++++++++++++++++-------------------------------------
 1 files changed, 18 insertions(+), 37 deletions(-)

diffs (98 lines):

diff -r 0eb7fe1dab95 -r 591fa490d9dd mk/bulk/build
--- a/mk/bulk/build     Sat Nov 05 21:38:34 2005 +0000
+++ b/mk/bulk/build     Sat Nov 05 21:52:33 2005 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: build,v 1.66 2005/11/05 21:38:34 rillig Exp $
+# $NetBSD: build,v 1.67 2005/11/05 21:52:33 rillig Exp $
 
 #
 # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf%NetBSD.org@localhost>
@@ -108,58 +108,41 @@
 #
 # Parse the command line.
 #
-while [ ${#} -ge 1 ] ; do
+while test $# -gt 0; do
        case $1 in
-
-       --help|-h )
+       -c|--config)
+               shift
+               BULK_BUILD_CONF=$1; shift
+               ;;
+       -e|--no-email)
+               noemail=yes
+               shift
+               ;;
+       -h|--help)
                usage
                exit 0
                ;;
-
-       --mirror_only|-m )
+       -m|--mirror_only)
                mirror_only=yes
                target=mirror-distfiles
                shift
                ;;
-
-       --restart|-r|restart|--resume )
+       -r|--restart|--resume|restart)
                restart=yes
                shift
                ;;
-
-       --specific-pkgs|-s )
+       -s|--specific-pkgs)
                makeargs="$makeargs SPECIFIC_PKGS=1"
                shift
                ;;
-       
-       --no-email|-e )
-               noemail=yes
-               shift
-               ;;
-
-       --config|-c )
-               shift
-               BULK_BUILD_CONF=$1; shift
-               ;;
-
-       -* )
+       *)
                echo "unknown option:  $1" 1>&2
                usage 1>&2
                exit 1
                ;;
-
-       * )
-               break
-               ;;
-
        esac
 done
 
-if [ $# -ne 0 ]; then
-       usage
-       exit 1
-fi
-
 #
 # Choose an appropriate value for BMAKE depending on the operating system.
 #
@@ -195,11 +178,9 @@
 #
 # Load the variables from the configuration file.
 #
-if [ -f "${BULK_BUILD_CONF}" ]; then
-       . "${BULK_BUILD_CONF}"
-else
-       die     "Cannot find config file ${BULK_BUILD_CONF}, aborting."
-fi
+{ test -f "${BULK_BUILD_CONF}" \
+  && . "${BULK_BUILD_CONF}"
+} || die "Cannot find config file ${BULK_BUILD_CONF}, aborting."
 
 #
 # Check if a valid pkgsrc root directory is given.



Home | Main Index | Thread Index | Old Index