mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] MAKEALL: fixes and refactorings
@ 2015-02-03 10:14 Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 1/5] MAKEALL: check the return code of "make" rather than "printf" Masahiro Yamada
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-02-03 10:14 UTC (permalink / raw)
  To: barebox




Masahiro Yamada (5):
  MAKEALL: check the return code of "make" rather than "printf"
  MAKEALL: remove false positive error check
  MAKEALL: use $(...) instead of `...` for readability
  MAKEALL: do not pass meaningless -C option to make
  MAKEALL: consolidate -j{JOBS} option

 MAKEALL | 42 +++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 23 deletions(-)

-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] MAKEALL: check the return code of "make" rather than "printf"
  2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
@ 2015-02-03 10:14 ` Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 2/5] MAKEALL: remove false positive error check Masahiro Yamada
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-02-03 10:14 UTC (permalink / raw)
  To: barebox

Currently, MAKEALL always reports "Configure: OK" and "Compile: OK"
regardless of the result of the configuration and compile.

$ LANG=C CROSS_COMPILE=arm-linux-gnueabi- ./MAKEALL -a arm foo_defconfig
Building arm foo_defconfig
make[2]: *** [foo_defconfig] Error 1
make[1]: *** [foo_defconfig] Error 2
make: *** [foo_defconfig] Error 2
Configure: OK
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[3]: *** [silentoldconfig] Error 1
make[2]: *** [silentoldconfig] Error 2
make[1]: *** No rule to make target `include/config/auto.conf',
needed by `include/config/kernel.release'.  Stop.
make[1]: *** Waiting for unfinished jobs....
make: *** [_all] Error 2
Compile: OK
arm-linux-gnueabi-size: 'makeall_builddir/barebox': No such file
Compiled in    2s

The check_pipe_status() function must be called right after "make"
command, not "printf" command.  ("printf" probably succeeds all
the time.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 MAKEALL | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 9bd7b2e..9a56ceb 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -113,17 +113,22 @@ do_build_target() {
 	MAKE="make -C ${here} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
 	${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
 
-	printf "Configure: " | tee -a "${log_report}"
 	check_pipe_status
-	if [ "$?" = "0" ]; then
+	result="$?"
+
+	printf "Configure: " | tee -a "${log_report}"
+
+	if [ "$result" = "0" ]; then
 		printf "OK     \n" | tee -a "${log_report}"
 
 		${MAKE} -j${JOBS} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
 
+		check_pipe_status
+		result="$?"
+
 		printf "Compile: " ${target} | tee -a "${log_report}"
 
-		check_pipe_status
-		if [ "$?" = "0" ]; then
+		if [ "$result" = "0" ]; then
 			printf "OK     \n" | tee -a "${log_report}"
 			${cross_compile}size ${BUILDDIR}/barebox | tee -a "${log_report}"
 		else
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/5] MAKEALL: remove false positive error check
  2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 1/5] MAKEALL: check the return code of "make" rather than "printf" Masahiro Yamada
@ 2015-02-03 10:14 ` Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 3/5] MAKEALL: use $(...) instead of `...` for readability Masahiro Yamada
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-02-03 10:14 UTC (permalink / raw)
  To: barebox

CROSS_COMPILE is not necessary in some cases:
 - Sandbox
 - Native build
   (e.g. when you build barebox for ARM on the ARM Linux system)
 - If CONFIG_CROSS_COMPILE is supported like Linux in the future,
   CROSS_COMPILE might be set by Kbuild.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 MAKEALL | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 9a56ceb..67e6a60 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -255,13 +255,6 @@ then
 	REGEX="*"
 fi
 
-if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE+set}" ]
-then
-	echo "You need to specify a CONFIG or a CROSS_COMPILE"
-	usage
-	exit 1
-fi
-
 if [ ! "${ARCH}" ] || [ ! -d arch/${ARCH} ]
 then
 	do_build_all
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/5] MAKEALL: use $(...) instead of `...` for readability
  2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 1/5] MAKEALL: check the return code of "make" rather than "printf" Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 2/5] MAKEALL: remove false positive error check Masahiro Yamada
@ 2015-02-03 10:14 ` Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 4/5] MAKEALL: do not pass unneeded -C option to make Masahiro Yamada
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-02-03 10:14 UTC (permalink / raw)
  To: barebox

The mixture of single quotes and back quotes in the same line makes
scripts unreadable.

Here, do_build_target() is especially unreadable.  Using $(...)
instead of `...` would make it a little better.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 MAKEALL | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 67e6a60..dd4acb2 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -14,7 +14,7 @@ here=$(pwd)
 
 time_start=$(date +%s)
 
-filename=`basename $0`
+filename=$(basename $0)
 
 is_print_stats=1
 
@@ -96,14 +96,14 @@ do_build_target() {
 	mkdir -p "${LOGDIR}/${target}"
 	printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
 
-	tmp=`echo "${target}" | tr - _`
+	tmp=$(echo "${target}" | tr - _)
 
-	cross_compile=`eval echo '$CROSS_COMPILE_'${tmp}`
-	cross_compile_set=`eval echo '${CROSS_COMPILE_'${tmp}'+set}'`
+	cross_compile=$(eval echo '$CROSS_COMPILE_'${tmp})
+	cross_compile_set=$(eval echo '${CROSS_COMPILE_'${tmp}'+set}')
 	if [ "${cross_compile_set}" = "" ]
 	then
-		cross_compile=`eval echo '$CROSS_COMPILE_'${arch}`
-		cross_compile_set=`eval echo '${CROSS_COMPILE_'${arch}'+set}'`
+		cross_compile=$(eval echo '$CROSS_COMPILE_'${arch})
+		cross_compile_set=$(eval echo '${CROSS_COMPILE_'${arch}'+set}')
 		if [ "${cross_compile_set}" = "" ]
 		then
 			cross_compile=${CROSS_COMPILE}
@@ -238,7 +238,7 @@ fi
 
 if [ "${CONFIG}" ]
 then
-	basedir=`dirname ${CONFIG}`
+	basedir=$(dirname ${CONFIG})
 
 	if [ ! "${basedir}" ] || [ "${basedir}" = "." ]
 	then
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/5] MAKEALL: do not pass unneeded -C option to make
  2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
                   ` (2 preceding siblings ...)
  2015-02-03 10:14 ` [PATCH 3/5] MAKEALL: use $(...) instead of `...` for readability Masahiro Yamada
@ 2015-02-03 10:14 ` Masahiro Yamada
  2015-02-03 10:14 ` [PATCH 5/5] MAKEALL: consolidate -j${JOBS} argument Masahiro Yamada
  2015-02-04 11:51 ` [PATCH 0/5] MAKEALL: fixes and refactorings Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-02-03 10:14 UTC (permalink / raw)
  To: barebox

We do not change the working directory in this script.
"-C ${here}" is not necessary.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 MAKEALL | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index dd4acb2..a4428fa 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -10,8 +10,6 @@ errors_list=""
 nb_defconfigs=0
 ret=0
 
-here=$(pwd)
-
 time_start=$(date +%s)
 
 filename=$(basename $0)
@@ -110,7 +108,7 @@ do_build_target() {
 		fi
 	fi
 
-	MAKE="make -C ${here} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
+	MAKE="make CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
 	${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
 
 	check_pipe_status
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/5] MAKEALL: consolidate -j${JOBS} argument
  2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
                   ` (3 preceding siblings ...)
  2015-02-03 10:14 ` [PATCH 4/5] MAKEALL: do not pass unneeded -C option to make Masahiro Yamada
@ 2015-02-03 10:14 ` Masahiro Yamada
  2015-02-04 11:51 ` [PATCH 0/5] MAKEALL: fixes and refactorings Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2015-02-03 10:14 UTC (permalink / raw)
  To: barebox

This argument is common in configuration and compilation.
Move it to ${MAKE}.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 MAKEALL | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index a4428fa..909e170 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -108,8 +108,8 @@ do_build_target() {
 		fi
 	fi
 
-	MAKE="make CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
-	${MAKE} -j${JOBS} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
+	MAKE="make -j${JOBS} CROSS_COMPILE=${cross_compile} ARCH=${arch} O=${BUILDDIR}"
+	${MAKE} ${target} 2>&1 > "${log_report}" | tee "${log_err}"
 
 	check_pipe_status
 	result="$?"
@@ -119,7 +119,7 @@ do_build_target() {
 	if [ "$result" = "0" ]; then
 		printf "OK     \n" | tee -a "${log_report}"
 
-		${MAKE} -j${JOBS} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
+		${MAKE} -s 2>&1 >> "${log_report}" | tee -a "${log_err}"
 
 		check_pipe_status
 		result="$?"
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] MAKEALL: fixes and refactorings
  2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
                   ` (4 preceding siblings ...)
  2015-02-03 10:14 ` [PATCH 5/5] MAKEALL: consolidate -j${JOBS} argument Masahiro Yamada
@ 2015-02-04 11:51 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2015-02-04 11:51 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: barebox

On Tue, Feb 03, 2015 at 07:14:43PM +0900, Masahiro Yamada wrote:
> 
> 
> 
> Masahiro Yamada (5):
>   MAKEALL: check the return code of "make" rather than "printf"
>   MAKEALL: remove false positive error check
>   MAKEALL: use $(...) instead of `...` for readability
>   MAKEALL: do not pass meaningless -C option to make
>   MAKEALL: consolidate -j{JOBS} option
> 
>  MAKEALL | 42 +++++++++++++++++++-----------------------
>  1 file changed, 19 insertions(+), 23 deletions(-)

Applied all, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-04 11:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-03 10:14 [PATCH 0/5] MAKEALL: fixes and refactorings Masahiro Yamada
2015-02-03 10:14 ` [PATCH 1/5] MAKEALL: check the return code of "make" rather than "printf" Masahiro Yamada
2015-02-03 10:14 ` [PATCH 2/5] MAKEALL: remove false positive error check Masahiro Yamada
2015-02-03 10:14 ` [PATCH 3/5] MAKEALL: use $(...) instead of `...` for readability Masahiro Yamada
2015-02-03 10:14 ` [PATCH 4/5] MAKEALL: do not pass unneeded -C option to make Masahiro Yamada
2015-02-03 10:14 ` [PATCH 5/5] MAKEALL: consolidate -j${JOBS} argument Masahiro Yamada
2015-02-04 11:51 ` [PATCH 0/5] MAKEALL: fixes and refactorings Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox