diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2017-01-10 17:37:14 +0100 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2017-02-17 11:52:09 +0000 |
commit | 28c73779d876450fc6b988057ae2584e6d6f2cfc (patch) | |
tree | 7e57d466e38351f224503e5fbc83db6002346abf /MakeRelease.job | |
parent | c6b13dcff529dac6b2c9559c2298ea60159002ae (diff) |
MakeRelease.job: Fix option handling.
Remove short option names support, shift args
when current option requires an argument, and
exit with an error code in case an unsupported
option is supplied or a mandatory one is missing.
Change-Id: I3dcb5a24cfd7f5b74682a12c43233ad2b73fe96c
Diffstat (limited to 'MakeRelease.job')
-rwxr-xr-x | MakeRelease.job | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/MakeRelease.job b/MakeRelease.job index 6359bb69..0dcfed53 100755 --- a/MakeRelease.job +++ b/MakeRelease.job @@ -3,6 +3,8 @@ set -x usage() { + ret=1 + [ x"$1" != x ] && ret=$1 echo "MakeRelease: [options]" echo " --abedir - PATH to ABE" echo " --workspace - Specify an alternate workspace" @@ -19,7 +21,7 @@ usage() { echo " --binariesdir XXX - Specify where to upload the generated binaries" echo " --logsdir XXX - Specify where to upload the logs" echo " --help" - exit + exit $ret } # Jenkins may run only using environment variables, a user needs to always @@ -43,23 +45,24 @@ abe_dir= binariesdir= logsdir= -OPTS="`getopt -o t:f:d:w:m:l:g:u:h -l target:,date:,fileserver:,workspace:,toolchainconfig:,manifest:,glibc:,gcc:,binutils:,help,abedir:,binariesdir:,logsdir:`" +OPTS="`getopt -o h -l target:,date:,fileserver:,workspace:,toolchainconfig:,manifest:,glibc:,gcc:,binutils:,help,abedir:,binariesdir:,logsdir:`" while test $# -gt 0; do case $1 in - --abedir) abe_dir=$2 ;; - -w|--workspace) user_workspace=$2 ;; - -t|--target) target=$2 ;; - -d|--date) date=$2 ;; - --toolchainconfig) toolchain_config=$2 ;; - -f|--fileserver) fileserver=$2 ;; - -m|--manifest) manifest_src=$2 ;; - -l|--glibc) glibc_src=$2 ;; - -g|--gcc) gcc_src=$2 ;; - -u|--binutils) binutils_src=$2 ;; - --binariesdir) binariesdir=$2 ;; - --logsdir) logsdir=$2 ;; - -h|--help) usage ;; + --abedir) abe_dir=$2 ; shift ;; + --workspace) user_workspace=$2 ; shift ;; + --target) target=$2 ; shift ;; + --date) date=$2 ; shift ;; + --toolchainconfig) toolchain_config=$2 ; shift ;; + --fileserver) fileserver=$2 ; shift ;; + --manifest) manifest_src=$2 ; shift ;; + --glibc) glibc_src=$2 ; shift ;; + --gcc) gcc_src=$2 ; shift ;; + --binutils) binutils_src=$2 ; shift ;; + --binariesdir) binariesdir=$2 ; shift ;; + --logsdir) logsdir=$2 ; shift ;; + -h|--help) usage 0 ;; --) break ;; + *) usage ;; esac shift done |