diff options
author | Rob Savoye <rob.savoye@linaro.org> | 2014-10-15 09:55:15 -0600 |
---|---|---|
committer | Rob Savoye <rob.savoye@linaro.org> | 2014-10-15 09:55:15 -0600 |
commit | be907b07704ca7c5cfc068fc2a8fe50aadd9119f (patch) | |
tree | 2931d32ac04d87ef25d74ea09e72e95bd1176c05 /tcwgweb.sh | |
parent | c3036aced9bcc402f12cace35d1f5c6d532c437d (diff) |
use getopt instead of case
Change-Id: I9ad4c6f27c011b3eb00fafd5e4a2ac7351ca5ca3
Diffstat (limited to 'tcwgweb.sh')
-rwxr-xr-x | tcwgweb.sh | 71 |
1 files changed, 23 insertions, 48 deletions
@@ -19,6 +19,18 @@ returncode="0" returnstr="ALLGOOD" +usage() +{ + # Format this section with 75 columns. + cat << EOF +--email : Send email of the validation results +--tdir dir1 dir2 : Compare the test results in 2 subdirectories +--branch NAME : Specify a branch name for the log file + Note: BRANCH is only used for the notification email. +EOF + return 0 +} + # $1 - the check.log file to scan scancheck () { @@ -280,61 +292,24 @@ mailto() fi } -usage() -{ - echo "--email : Send email of the validation results" - echo "--tdir dir1 dir2 : Compare the test results in 2 subdirectories" - echo "--base dir : Compare the test results in dir to the baseline" - echo "These next two options are only used by --base" - echo " --target triplet : Thr target triplet or 'native'" - echo " --build cpu : The cpu of the build machine" -} - # ---------------------------------------------------------------------- # Start to actually do something -# The top level is usually something like /space/build/gcc-linaro-4.8.3-2014.02 - -if test "`echo $* | grep -c email`" -gt 0; then - email=yes -fi - if test $# -eq 0; then usage fi -args="$*" + +OPTS="`getopt -o etb:h -l email:tdir:help:branch -- "$@"`" while test $# -gt 0; do - case "$1" in - --email) - ;; - --tdir*) - difftwodirs "$2" "$3" - shift - ;; - --target*) - # Set the target triplet - target="$2" - shift - ;; - --build*) - # Set the build triplet - buildarch="`echo $2 | cut -d '-' -f 1`" - shift - ;; - --base*) - # For each revision we build the toolchain for this config triplet - if test x"${target}" = x; then - echo "ERROR: No target to compare!" - echo "tcwgweb.sh --target [triplet] ${args} --base [path]" - exit - - fi - shift - diffbaseline "${buildarch}.${target}" "$1" - ;; + echo 1 = "$1" + case $1 in + -e|--email) email=yes ;; + -b|--branch) branch=$2 ;; + -t|--tdir) difftwodirs "$2" "$3" + shift ; shift ;; + -h|--help) usage ;; + --) break ;; esac - if test $# -gt 0; then - shift - fi + shift done |