Patchwork Fix abuild option parsing.

login
register
about
Submitter Warren Turkal
Date 2010-09-27 10:22:06
Message ID <1285582926-6446-1-git-send-email-wt@penguintechs.org>
Download mbox | patch
Permalink /patch/1988/
State Accepted
Commit r5869
Headers show

Comments

Warren Turkal - 2010-09-27 10:22:06
The commandline parsing for abuild doing a couple of buggy things:
* Long options of the form --opt=arg were not having the arg stripped
  off into a another argument in the output. As a result, all long
  options with args had to be written like "--opt arg" on the command
  line to be recognized.
* The --remove option was shifting too many times.

As a bonus, I also added some logic to make "make distclean" cleanup
the default abuild build dir.

Signed-off-by: Warren Turkal <wt@penguintechs.org>
---
 Makefile           |    7 +++++--
 util/abuild/abuild |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)

Patch

diff --git a/Makefile b/Makefile
index a5cba2b..3754ab9 100644
--- a/Makefile
+++ b/Makefile
@@ -358,10 +358,13 @@  clean-for-update: doxygen-clean
 clean: clean-for-update
 	rm -f $(obj)/coreboot* .ccwrap
 
+clean-abuild:
+	rm -rf coreboot_builds
+
 clean-cscope:
 	rm -f cscope.out
 
-distclean: clean-cscope
+distclean: clean-cscope clean-abuild
 	rm -rf $(obj)
 	rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* .ccwrap .xcompile
 
@@ -390,5 +393,5 @@  $(objutil)/romcc/romcc: $(top)/util/romcc/romcc.c
 	@# http://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
 	$(HOSTCC) -g $(STACK) -Wall -o $@ $<
 
-.PHONY: $(PHONY) clean clean-cscope cscope distclean doxygen doxy coreboot .xcompile
+.PHONY: $(PHONY) clean clean-abuild clean-cscope cscope distclean doxygen doxy coreboot .xcompile
 
diff --git a/util/abuild/abuild b/util/abuild/abuild
index f2f5665..5a17e5e 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -570,8 +570,8 @@  test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
 getoptbrand="`getopt -V`"
 if [ "${getoptbrand:0:6}" == "getopt" ]; then
 	# Detected GNU getopt that supports long options.
-	args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache Vvhat:bp:Tc:sxCl:rP:uy -- "$@"`
-	eval set "$args"
+	args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:bp:Tc:sxCl:rP:uy -- "$@"`
+	eval set -- $args
 else
 	# Detected non-GNU getopt
 	args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*`
@@ -589,7 +589,7 @@  while true ; do
 		-t|--target)	shift; target="$1"; shift;;
 		-a|--all)	shift; buildall=true;;
 		-b|--broken)	shift; buildbroken=true;;
-		-r|--remove)	shift; remove=true; shift;;
+		-r|--remove)	shift; remove=true;;
 		-v|--verbose)	shift; verbose=true; silent='V=1';;
 		-V|--version)	shift; myversion; exit 0;;
 		-h|--help)	shift; myversion; myhelp; exit 0;;