Browse Source

Reworked how bin/sde-build-tools validate it's options, using getopt now

karasz/new-early
Alejandro Mery 17 years ago
parent
commit
831dba3b2f
3 changed files with 54 additions and 10 deletions
  1. +52
    -8
      bin/sde-build-tools
  2. +1
    -1
      scripts/Build-Pkg
  3. +1
    -1
      scripts/Build-Target

+ 52
- 8
bin/sde-build-tools

@ -15,20 +15,64 @@
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#Description: Builds tools, wrappers and caches needed for a build
[ -n "$SDEROOT" ] ||
export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
. "$SDEROOT/lib/libsde.in"
create_usage() {
local progname=${0##*/}
cat <<EOT
Usage: ${progname//-/ } [--config <config>] [-<stagelevel>] [--cleanup]
EOT
}
shortopts='0123456789c:'
longopts='help,config:,cfg:,cleanup'
options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
if [ $? -ne 0 ]; then
create_usage
exit -1
fi
# load new arguments list
eval set -- "$options"
config=default
stagelevel=9
cleanup=0
while [ "$1" ] ; do
case "$1" in
-cleanup) cleanup=1 ; shift ;;
-cfg) config=$2 ; shift ; shift ;;
-[0-9]) options="$options $1" ; stagelevel=${1#-} ; shift ;;
*) echo "Usage: $0 [ -cfg config ] [ -0 | -9 ] \\"
echo " ${0//?/ } [ -cleanup ]" ; exit 1 ;;
esac
while [ $# -gt 0 ]; do
case "$1" in
--help)
create_usage
exit 0
;;
--cleanup)
cleanup=1
;;
-c|--cfg|--config)
config="$2"
shift
;;
-[0-9])
stagelevel=${1#-}
;;
--)
shift
break
;;
*)
echo_abort 1 "Unknown argument '$1', aborting."
esac
shift
done
cd "$SDEROOT"
. lib/functions.in
. lib/parse-config

+ 1
- 1
scripts/Build-Pkg

@ -249,7 +249,7 @@ if [ "$chroot" = 1 ] ; then
exit $returncode
fi
./bin/sde-build-tools -$stagelevel -cfg $config || exit 1
./bin/sde-build-tools -$stagelevel -c $config || exit 1
if [ "$SDECFG_FLIST" = "flwrapper" -a -z "$FLWRAPPER" ] ; then
export FLWRAPPER_WLOG="$builddir/fl_wrapper.wlog"

+ 1
- 1
scripts/Build-Target

@ -265,7 +265,7 @@ trap 'umount_chroot' EXIT
{
ln -sf build_target_$$.log ${build_logs}/build_target.log
./bin/sde-build-tools -1 -cfg $config
./bin/sde-build-tools -1 -c $config
_built=0
for x in $( get_expanded ./target/%/build.sh $targetchain ); do
if [ -f $x ]; then

Loading…
Cancel
Save