Skip to contentSkip to conversation

MAKEALL: Add -l option to only list build targets

PATCH New Marek Vasut 5 participants 12 messages Dec 3, 2011 – Dec 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

---
 MAKEALL |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
MAKEALL +13 -2
index 95b7cd3..ec5997e 100755
@@ -16,6 +16,7 @@ usage()
 	  -c CPU,    --cpu CPU         Build all boards with cpu CPU
 	  -v VENDOR, --vendor VENDOR   Build all boards with vendor VENDOR
 	  -s SOC,    --soc SOC         Build all boards with soc SOC
+	  -l,        --list            List all targets to be built
 	  -h,        --help            This help output
 
 	Selections by these options are logically ANDed; if the same option
@@ -47,8 +48,8 @@ usage()
 	exit ${ret}
 }
 
-SHORT_OPTS="ha:c:v:s:"
-LONG_OPTS="help,arch:,cpu:,vendor:,soc:"
+SHORT_OPTS="ha:c:v:s:l"
+LONG_OPTS="help,arch:,cpu:,vendor:,soc:,list"
 
 # Option processing based on util-linux-2.13/getopt-parse.bash
 
@@ -65,6 +66,7 @@ TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \
 eval set -- "$TEMP"
 
 SELECTED=''
+ONLY_LIST=''
 
 while true ; do
 	case "$1" in
@@ -104,6 +106,9 @@ while true ; do
 		fi
 		SELECTED='y'
 		shift 2 ;;
+	-l|--list)
+		ONLY_LIST='y'
+		shift ;;
 	-h|--help)
 		usage ;;
 	--)
@@ -488,6 +493,11 @@ LIST_nds32="$(boards_by_arch nds32)"
 build_target() {
 	target=$1
 
+	if [ "$ONLY_LIST" == 'y' ] ; then
+		echo "$target"
+		return
+	fi
+
 	${MAKE} distclean >/dev/null
 	${MAKE} -s ${target}_config
 
@@ -531,6 +541,7 @@ build_targets() {
 #-----------------------------------------------------------------------
 
 print_stats() {
+	if [ "$ONLY_LIST" == 'y' ] ; then return ; fi
 	echo ""
 	echo "--------------------- SUMMARY ----------------------------"
 	echo "Boards compiled: ${TOTAL_CNT}"
Signature · 1 line
1.7.7.1
#1 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

MAKEALL build_targets() { · line 544

Quoted 1 line · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:
MAKEALL +1 -0
+	if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111203/01e19b72/attachment.pgp>

#2 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 5 lines · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:

MAKEALL build_targets() { · line 544

Quoted 1 line
MAKEALL +1 -0
+	if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return
-mike

I prefer to be explicit.
M

#3 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 6 lines · On Saturday 03 December 2011 03:23:28 Marek Vasut wrote:
Quoted 4 lines · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:

MAKEALL build_targets() { · line 544

Quoted 1 line
MAKEALL +1 -0
+	if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return

I prefer to be explicit.

my version is "explicit" as well

the point was more that if statements shouldn't be one-liners like that. if you want to keep it, then unwrap the block.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111203/2d6d2cc1/attachment.pgp>

#4 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 6 lines · On Saturday 03 December 2011 03:23:28 Marek Vasut wrote:
Quoted 5 lines
Quoted 4 lines · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:

MAKEALL build_targets() { · line 544

Quoted 1 line
MAKEALL +1 -0
+	if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return

Quoted 6 lines
Quoted 1 line

I prefer to be explicit.

my version is "explicit" as well

the point was more that if statements shouldn't be one-liners like that. if you want to keep it, then unwrap the block.

Is there any such rule?

Quoted 1 line

-mike

Any other comments ?

M

#5 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 6 lines · On Saturday 03 December 2011 04:36:32 Marek Vasut wrote:
Quoted 6 lines · On Saturday 03 December 2011 03:23:28 Marek Vasut wrote:
Quoted 5 lines
Quoted 4 lines · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:

MAKEALL build_targets() { · line 544

Quoted 1 line
MAKEALL +1 -0
+	if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I prefer to be explicit.

my version is "explicit" as well

the point was more that if statements shouldn't be one-liners like that. if you want to keep it, then unwrap the block.

Is there any such rule?

i don't think we have a style guide for shell scripts, but what you're proposing doesn't show up anywhere in the current tree. and it's ugly :P. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111203/ba2e5bb3/attachment.pgp>

#6 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

In reply to Mike Frysinger

Should it be an equality operator instead of an assigning one? i.e:

[ "$ONLY_LIST" == "y" ] && return

Quoted 11 lines · Mike Frysinger
Quoted 1 line · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:

+ ? ? if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return
-mike

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Thanks.

#7 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 3 lines

Should it be an equality operator instead of an assigning one? i.e:

[ "$ONLY_LIST" == "y" ] && return

1) Please don't top post
2) It's the same thing ... = and == in shell scripting.

M

Quoted 18 lines · Mike Frysinger
Quoted 10 lines · On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:
Quoted 1 line

+ if [ "$ONLY_LIST" == 'y' ] ; then return ; fi

[ "$ONLY_LIST" = "y" ] && return
-mike

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Thanks.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#8 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 5 lines · On Sunday 04 December 2011 06:32:47 Marek Vasut wrote:
Quoted 3 lines

Should it be an equality operator instead of an assigning one? i.e:

[ "$ONLY_LIST" == "y" ] && return

2) It's the same thing ... = and == in shell scripting.

while this is true for the particular piece of code quoted, in general, this statement is false. "==" is a bashism (it is not part of POSIX), and it allows you to do comparisons that the "=" operator does not (such as pattern matching).

this code uses "=" everywhere with single brackets. any new code should stick to that form. if you want to use "==", it should be with double brackets, and probably have a good reason for it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111212/adf1e143/attachment.pgp>

#10 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

Quoted 2 lines

Would be nice if the commit message explained why you're adding this feature.

I need to dump every possible config_*** for every architecture, so I can set up a continuous building and error-catching solution. I'll add that, though this might be useful just for myself.
M

#11 lore raw

PATCH 1/1 MAKEALL: Add -l option to only list build targets

In reply to Marek Vasut

Dear Marek Vasut,

Quoted 5 lines · In message <[email protected]> you wrote:
---
 MAKEALL |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
What we anticipate seldom occurs;  what  we  least  expect  generally
happens.                                          - Bengamin Disraeli