Message ID | 1322897523-6663-1-git-send-email-marek.vasut@gmail.com |
---|---|
State | Accepted |
Delegated to: | Wolfgang Denk |
Headers | show |
On Saturday 03 December 2011 02:32:03 Marek Vasut wrote:
> + if [ "$ONLY_LIST" == 'y' ] ; then return ; fi
[ "$ONLY_LIST" = "y" ] && return
-mike
> On Saturday 03 December 2011 02:32:03 Marek Vasut wrote: > > + if [ "$ONLY_LIST" == 'y' ] ; then return ; fi > > [ "$ONLY_LIST" = "y" ] && return > -mike I prefer to be explicit. M
On Saturday 03 December 2011 03:23:28 Marek Vasut wrote: > > On Saturday 03 December 2011 02:32:03 Marek Vasut wrote: > > > + 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
> On Saturday 03 December 2011 03:23:28 Marek Vasut wrote: > > > On Saturday 03 December 2011 02:32:03 Marek Vasut wrote: > > > > + 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. Is there any such rule? > -mike Any other comments ? M
Would be nice if the commit message explained why you're adding this feature. - k On Dec 3, 2011, at 1:32 AM, Marek Vasut wrote: > Signed-off-by: Marek Vasut <marek.vasut@gmail.com> > Cc: Wolfgang Denk <wd@denx.de> > --- > MAKEALL | 15 +++++++++++++-- > 1 files changed, 13 insertions(+), 2 deletions(-)
> 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
On Saturday 03 December 2011 04:36:32 Marek Vasut wrote: > > On Saturday 03 December 2011 03:23:28 Marek Vasut wrote: > > > > On Saturday 03 December 2011 02:32:03 Marek Vasut wrote: > > > > > + 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. > > 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
Should it be an equality operator instead of an assigning one? i.e: [ "$ONLY_LIST" == "y" ] && return On Sat, Dec 3, 2011 at 3:57 PM, Mike Frysinger <vapier@gentoo.org> wrote: > 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@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > Thanks.
> 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 > > On Sat, Dec 3, 2011 at 3:57 PM, Mike Frysinger <vapier@gentoo.org> wrote: > > 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@lists.denx.de > > http://lists.denx.de/mailman/listinfo/u-boot > > Thanks. > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot
Dear Marek Vasut, In message <1322897523-6663-1-git-send-email-marek.vasut@gmail.com> you wrote: > Signed-off-by: Marek Vasut <marek.vasut@gmail.com> > Cc: Wolfgang Denk <wd@denx.de> > --- > MAKEALL | 15 +++++++++++++-- > 1 files changed, 13 insertions(+), 2 deletions(-) Applied, thanks. Best regards, Wolfgang Denk
On Sunday 04 December 2011 06:32:47 Marek Vasut wrote: > > 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
diff --git a/MAKEALL b/MAKEALL index 95b7cd3..ec5997e 100755 --- a/MAKEALL +++ b/MAKEALL @@ -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}"
Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> --- MAKEALL | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)