summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-04-08 13:13:07 -0400
committerDan McGee <dan@archlinux.org>2012-04-24 08:38:36 -0500
commitd85c71865ee826041c85cd47189ea43b44ce52cc (patch)
treedb27107dbd76a620215fe9cccc09ad56ec574afb /scripts
parent8679cd68d825bfe28ba0c833494c415bcfa6d8f6 (diff)
downloadpacman-d85c71865ee826041c85cd47189ea43b44ce52cc.tar.xz
makepkg: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am2
-rw-r--r--scripts/makepkg.sh.in26
2 files changed, 14 insertions, 14 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 7662fba6..0df90e13 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -68,7 +68,7 @@ $(OURSCRIPTS): Makefile
makepkg: \
$(srcdir)/makepkg.sh.in \
- $(srcdir)/library/parse_options.sh
+ $(srcdir)/library/parseopts.sh
pacman-db-upgrade: \
$(srcdir)/pacman-db-upgrade.sh.in \
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 46191ee4..663fdc68 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1885,7 +1885,7 @@ canonicalize_path() {
fi
}
-m4_include(library/parse_options.sh)
+m4_include(library/parseopts.sh)
usage() {
printf "makepkg (pacman) %s\n" "$myver"
@@ -1954,19 +1954,20 @@ ARGLIST=("$@")
# Parse Command Line Options.
OPT_SHORT="AcdefFghiLmop:rRsSV"
-OPT_LONG="allsource,asroot,ignorearch,check,clean,nodeps"
-OPT_LONG+=",noextract,force,forcever:,geninteg,help,holdver,skippgpcheck"
-OPT_LONG+=",install,key:,log,nocolor,nobuild,nocheck,nosign,pkg:,rmdeps"
-OPT_LONG+=",repackage,skipchecksums,skipinteg,skippgpcheck,sign,source,syncdeps"
-OPT_LONG+=",version,config:"
+OPT_LONG=('allsource' 'asroot' 'ignorearch' 'check' 'clean' 'nodeps'
+ 'noextract' 'force' 'forcever:' 'geninteg' 'help' 'holdver' 'skippgpcheck'
+ 'install' 'key:' 'log' 'nocolor' 'nobuild' 'nocheck' 'nosign' 'pkg:' 'rmdeps'
+ 'repackage' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'sign' 'source' 'syncdeps'
+ 'version' 'config:')
# Pacman Options
-OPT_LONG+=",noconfirm,noprogressbar"
-if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
+OPT_LONG+=('noconfirm' 'noprogressbar')
+
+if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
echo; usage; exit 1 # E_INVALID_OPTION;
fi
-eval set -- "$OPT_TEMP"
-unset OPT_SHORT OPT_LONG OPT_TEMP
+set -- "${OPTRET[@]}"
+unset OPT_SHORT OPT_LONG OPTRET
while true; do
case "$1" in
@@ -1997,7 +1998,7 @@ while true; do
--nosign) SIGNPKG='n' ;;
-o|--nobuild) NOBUILD=1 ;;
-p) shift; BUILDFILE=$1 ;;
- --pkg) shift; PKGLIST=($1) ;;
+ --pkg) shift; IFS=, read -ra PKGLIST <<<"$1" ;;
-r|--rmdeps) RMDEPS=1 ;;
-R|--repackage) REPKG=1 ;;
--skipchecksums) SKIPCHECKSUMS=1 ;;
@@ -2010,8 +2011,7 @@ while true; do
-h|--help) usage; exit 0 ;; # E_OK
-V|--version) version; exit 0 ;; # E_OK
- --) OPT_IND=0; shift; break;;
- *) usage; exit 1 ;; # E_INVALID_OPTION
+ --) OPT_IND=0; shift; break 2;;
esac
shift
done