util/abuild: Add argument -R to specify root directory

cbroot was previously specified by just adding it to the end of the
command line with no explicit identifier.  This change allows it to
go anywhere in the command line and adds the -R or --root identifier.

This makes the command line more consistent.  Most of the time, this
argument isn't even needed, as the automatic detection finds cbroot.

Change-Id: I1d6fd8f51765d0d8b29be8af1e8105e06dd44cc8
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/17740
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-12-06 09:18:36 -07:00
parent b06bfa4d39
commit 5b0d2dbdce
1 changed files with 8 additions and 10 deletions

View File

@ -16,8 +16,8 @@
#set -x # Turn echo on.... #set -x # Turn echo on....
ABUILD_DATE="Nov 23, 2016" ABUILD_DATE="Dec 6, 2016"
ABUILD_VERSION="0.10.0" ABUILD_VERSION="0.10.01"
TOP=$PWD TOP=$PWD
@ -505,7 +505,7 @@ function remove_target
function myhelp function myhelp
{ {
cat << __END_OF_HELP cat << __END_OF_HELP
Usage: $0 [options] [cbroot] Usage: $0 [options]
$0 [-V|--version] $0 [-V|--version]
$0 [-h|--help] $0 [-h|--help]
@ -525,6 +525,8 @@ Options:\n"
[-P|--prefix <name>] File name prefix in CBFS [-P|--prefix <name>] File name prefix in CBFS
[-q|--quiet] Print fewer messages [-q|--quiet] Print fewer messages
[-r|--remove] Remove output dir after build [-r|--remove] Remove output dir after build
[-R|--root <path>] Absolute path to coreboot sources
(defaults to $ROOT)
[--scan-build] Use clang's static analyzer [--scan-build] Use clang's static analyzer
[-s|--silent] Omit compiler calls in logs [-s|--silent] Omit compiler calls in logs
[-t|--target <vendor/board>] Attempt to build target vendor/board only [-t|--target <vendor/board>] Attempt to build target vendor/board only
@ -538,9 +540,6 @@ Options:\n"
[-y|--ccache] Use ccache [-y|--ccache] Use ccache
[-z|--clean] Remove build results when finished [-z|--clean] Remove build results when finished
[cbroot] Absolute path to coreboot sources
(defaults to $ROOT)
[-V|--version] Print version number and exit [-V|--version] Print version number and exit
[-h|--help] Print this help and exit [-h|--help] Print this help and exit
@ -585,12 +584,12 @@ getoptbrand="$(getopt -V)"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
if [ "${getoptbrand:0:6}" == "getopt" ]; then if [ "${getoptbrand:0:6}" == "getopt" ]; then
# Detected GNU getopt that supports long options. # Detected GNU getopt that supports long options.
args=$(getopt -l version,verbose,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile:,kconfig:,dir: -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d: -- "$@") || exit 1 args=$(getopt -l version,verbose,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile:,kconfig:,dir:,root: -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R: -- "$@") || exit 1
eval set -- $args eval set -- $args
retval=$? retval=$?
else else
# Detected non-GNU getopt # Detected non-GNU getopt
args=$(getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d: "$@") args=$(getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R: "$@")
set -- $args set -- $args
retval=$? retval=$?
fi fi
@ -618,6 +617,7 @@ while true ; do
-V|--version) shift; myversion; exit 0;; -V|--version) shift; myversion; exit 0;;
-h|--help) shift; myversion; myhelp; exit 0;; -h|--help) shift; myversion; myhelp; exit 0;;
-p|--payloads) shift; payloads="$1"; shift;; -p|--payloads) shift; payloads="$1"; shift;;
-R|--root) shift; ROOT="$1"; shift;;
-c|--cpus) shift -c|--cpus) shift
export MAKEFLAGS="-j $1" export MAKEFLAGS="-j $1"
cpus=$1 cpus=$1
@ -770,8 +770,6 @@ build_targets()
} }
fi fi
test -z "$1" || ROOT=$1
debug "ROOT=$ROOT" debug "ROOT=$ROOT"
junit '<?xml version="1.0" encoding="utf-8"?>' junit '<?xml version="1.0" encoding="utf-8"?>'