makepkg: adopt parseopts for option parsing
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This commit is contained in:
parent
8679cd68d8
commit
d85c71865e
3 changed files with 16 additions and 15 deletions
|
@ -153,7 +153,8 @@ Options
|
||||||
the GPL when distributing binary packages.
|
the GPL when distributing binary packages.
|
||||||
|
|
||||||
*\--pkg <list>*::
|
*\--pkg <list>*::
|
||||||
Only build listed packages from a split package.
|
Only build listed packages from a split package. Multiple packages should
|
||||||
|
be comma separated in the list.
|
||||||
|
|
||||||
*\--check*::
|
*\--check*::
|
||||||
Run the check() function in the PKGBUILD, overriding the setting in
|
Run the check() function in the PKGBUILD, overriding the setting in
|
||||||
|
|
|
@ -68,7 +68,7 @@ $(OURSCRIPTS): Makefile
|
||||||
|
|
||||||
makepkg: \
|
makepkg: \
|
||||||
$(srcdir)/makepkg.sh.in \
|
$(srcdir)/makepkg.sh.in \
|
||||||
$(srcdir)/library/parse_options.sh
|
$(srcdir)/library/parseopts.sh
|
||||||
|
|
||||||
pacman-db-upgrade: \
|
pacman-db-upgrade: \
|
||||||
$(srcdir)/pacman-db-upgrade.sh.in \
|
$(srcdir)/pacman-db-upgrade.sh.in \
|
||||||
|
|
|
@ -1885,7 +1885,7 @@ canonicalize_path() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
m4_include(library/parse_options.sh)
|
m4_include(library/parseopts.sh)
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "makepkg (pacman) %s\n" "$myver"
|
printf "makepkg (pacman) %s\n" "$myver"
|
||||||
|
@ -1954,19 +1954,20 @@ ARGLIST=("$@")
|
||||||
|
|
||||||
# Parse Command Line Options.
|
# Parse Command Line Options.
|
||||||
OPT_SHORT="AcdefFghiLmop:rRsSV"
|
OPT_SHORT="AcdefFghiLmop:rRsSV"
|
||||||
OPT_LONG="allsource,asroot,ignorearch,check,clean,nodeps"
|
OPT_LONG=('allsource' 'asroot' 'ignorearch' 'check' 'clean' 'nodeps'
|
||||||
OPT_LONG+=",noextract,force,forcever:,geninteg,help,holdver,skippgpcheck"
|
'noextract' 'force' 'forcever:' 'geninteg' 'help' 'holdver' 'skippgpcheck'
|
||||||
OPT_LONG+=",install,key:,log,nocolor,nobuild,nocheck,nosign,pkg:,rmdeps"
|
'install' 'key:' 'log' 'nocolor' 'nobuild' 'nocheck' 'nosign' 'pkg:' 'rmdeps'
|
||||||
OPT_LONG+=",repackage,skipchecksums,skipinteg,skippgpcheck,sign,source,syncdeps"
|
'repackage' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'sign' 'source' 'syncdeps'
|
||||||
OPT_LONG+=",version,config:"
|
'version' 'config:')
|
||||||
|
|
||||||
# Pacman Options
|
# Pacman Options
|
||||||
OPT_LONG+=",noconfirm,noprogressbar"
|
OPT_LONG+=('noconfirm' 'noprogressbar')
|
||||||
if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
|
|
||||||
|
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||||
echo; usage; exit 1 # E_INVALID_OPTION;
|
echo; usage; exit 1 # E_INVALID_OPTION;
|
||||||
fi
|
fi
|
||||||
eval set -- "$OPT_TEMP"
|
set -- "${OPTRET[@]}"
|
||||||
unset OPT_SHORT OPT_LONG OPT_TEMP
|
unset OPT_SHORT OPT_LONG OPTRET
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -1997,7 +1998,7 @@ while true; do
|
||||||
--nosign) SIGNPKG='n' ;;
|
--nosign) SIGNPKG='n' ;;
|
||||||
-o|--nobuild) NOBUILD=1 ;;
|
-o|--nobuild) NOBUILD=1 ;;
|
||||||
-p) shift; BUILDFILE=$1 ;;
|
-p) shift; BUILDFILE=$1 ;;
|
||||||
--pkg) shift; PKGLIST=($1) ;;
|
--pkg) shift; IFS=, read -ra PKGLIST <<<"$1" ;;
|
||||||
-r|--rmdeps) RMDEPS=1 ;;
|
-r|--rmdeps) RMDEPS=1 ;;
|
||||||
-R|--repackage) REPKG=1 ;;
|
-R|--repackage) REPKG=1 ;;
|
||||||
--skipchecksums) SKIPCHECKSUMS=1 ;;
|
--skipchecksums) SKIPCHECKSUMS=1 ;;
|
||||||
|
@ -2010,8 +2011,7 @@ while true; do
|
||||||
-h|--help) usage; exit 0 ;; # E_OK
|
-h|--help) usage; exit 0 ;; # E_OK
|
||||||
-V|--version) version; exit 0 ;; # E_OK
|
-V|--version) version; exit 0 ;; # E_OK
|
||||||
|
|
||||||
--) OPT_IND=0; shift; break;;
|
--) OPT_IND=0; shift; break 2;;
|
||||||
*) usage; exit 1 ;; # E_INVALID_OPTION
|
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue