All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Michal Marek <mmarek@suse.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	dvhart@linux.intel.com, Olof Johansson <olof@lixom.net>
Subject: [PATCH 04/10] merge_config.sh: exit non-0 in case of failures
Date: Wed, 28 Oct 2015 09:42:05 +0900	[thread overview]
Message-ID: <1445992931-28107-5-git-send-email-olof@lixom.net> (raw)
In-Reply-To: <1445992931-28107-1-git-send-email-olof@lixom.net>

Exit with non-0 value in cases where there was a failure to set an option.
Also, add a '-e' during which the conflict warnings are considered failures
(-e -r will result in these being failures, -r will result in them just being
reported).

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 scripts/kconfig/merge_config.sh | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index fd0d537..c244042 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -20,14 +20,17 @@
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #  See the GNU General Public License for more details.
 
+EXITVAL=0
+
 clean_up() {
 	rm -f $TMP_FILE
-	exit
+	exit $EXITVAL
 }
 trap clean_up HUP INT TERM
 
 usage() {
 	echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
+	echo "  -e    consider conflicting overrides to be errors"
 	echo "  -h    display this help text"
 	echo "  -m    only merge the fragments, do not execute the make command"
 	echo "  -n    use allnoconfig instead of alldefconfig"
@@ -39,6 +42,7 @@ getval() {
 	grep -w -e "$1" "$2"
 }
 
+CONF_IS_ERR=false
 RUNMAKE=true
 ALLTARGET=alldefconfig
 WARNREDUN=false
@@ -46,6 +50,9 @@ OUTPUT=.
 
 while true; do
 	case $1 in
+	"-e")
+		CONF_IS_ERR=true
+		;;
 	"-n")
 		ALLTARGET=allnoconfig
 		;;
@@ -117,13 +124,19 @@ for MERGE_FILE in $MERGE_LIST ; do
 		grep -q -w $CFG $TMP_FILE || continue
 		PREV_VAL=$(getval "$CFG" "$TMP_FILE")
 		NEW_VAL=$(getval "$CFG" "$MERGE_FILE")
+		WARN=false
 		if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
 			echo Value of $CFG is redefined by fragment $MERGE_FILE:
 			echo Previous  value: $PREV_VAL
 			echo New value:       $NEW_VAL
 			echo
+			WARN=true
 		elif [ "$WARNREDUN" = "true" ]; then
 			echo Value of $CFG is redundant by fragment $MERGE_FILE:
+			WARN=true
+		fi
+		if [ "$CONF_IS_ERR" = "true" -a "$WARN" = "true" ] ; then
+			EXITVAL=1
 		fi
 		sed -i "/$CFG[ =]/d" $TMP_FILE
 	done >&2
@@ -136,7 +149,7 @@ if [ "$RUNMAKE" = "false" ]; then
 	echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
 	echo "#"
 	clean_up
-	exit
+	exit $EXITVAL
 fi
 
 # If we have an output dir, setup the O= argument, otherwise leave
@@ -152,10 +165,8 @@ fi
 # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
 make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
 
-
 # Check all specified config values took (might have missed-dependency issues)
 for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
-
 	REQUESTED_VAL=$(getval "$CFG" "$TMP_FILE")
 	ACTUAL_VAL=$(getval "$CFG" "$KCONFIG_CONFIG")
 	if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
@@ -163,6 +174,7 @@ for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
 		echo "Requested value:  $REQUESTED_VAL"
 		echo "Actual value:     $ACTUAL_VAL"
 		echo ""
+		EXITVAL=1
 	fi >&2
 done
 
-- 
2.1.4


  parent reply	other threads:[~2015-10-28  0:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  0:42 [PATCH 00/10] merge_config misc reworks and testcases Olof Johansson
2015-10-28  0:42 ` [PATCH 01/10] merge_config.sh: factor out value parsing Olof Johansson
2015-10-28  5:24   ` Darren Hart
2015-10-28  0:42 ` [PATCH 02/10] merge_config.sh: print warnings on stderr Olof Johansson
2015-10-28  5:56   ` Darren Hart
2015-10-28  0:42 ` [PATCH 03/10] merge_config.sh: minor argument parsing refactoring Olof Johansson
2015-10-28  6:00   ` Darren Hart
2015-10-28  0:42 ` Olof Johansson [this message]
2015-10-28  6:19   ` [PATCH 04/10] merge_config.sh: exit non-0 in case of failures Darren Hart
2015-10-28  0:42 ` [PATCH 05/10] merge_config.sh: Better handling of CONFIG_FOO=n Olof Johansson
2015-10-28  6:26   ` Darren Hart
2015-10-28  6:30     ` Bruce Ashfield
2015-10-28  6:30       ` Bruce Ashfield
2015-10-28  0:42 ` [PATCH 06/10] merge_config.sh: only consider last value of symbols Olof Johansson
2015-10-28  6:36   ` Darren Hart
2015-10-28  0:42 ` [PATCH 07/10] merge_config.sh: add tests Olof Johansson
2015-10-28  7:00   ` Darren Hart
2015-10-28  7:07     ` Olof Johansson
2015-10-28  0:42 ` [PATCH 08/10] merge_config.sh: use trap for cleanup Olof Johansson
2015-10-28  7:11   ` Darren Hart
2015-10-28  7:28   ` Darren Hart
2015-10-28  0:42 ` [PATCH 09/10] merge_config.sh: allow single configs to be passed in on cmdline Olof Johansson
2015-10-28  7:22   ` Darren Hart
2015-10-28  0:42 ` [PATCH 10/10] merge_config.sh: add tests for cmdline configs Olof Johansson
2015-10-28  7:32   ` Darren Hart
2015-10-28  0:46 ` [PATCH 00/10] merge_config misc reworks and testcases Olof Johansson
2015-11-06 16:07   ` Michal Marek
2015-10-28  5:02 ` Darren Hart
2015-10-28  5:30   ` Bruce Ashfield
2015-10-28  5:30     ` Bruce Ashfield
2015-10-28  7:05     ` Darren Hart
  -- strict thread matches above, loose matches on Subject: below --
2015-05-20 22:00 Olof Johansson
2015-05-20 22:00 ` [PATCH 04/10] merge_config.sh: exit non-0 in case of failures Olof Johansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445992931-28107-5-git-send-email-olof@lixom.net \
    --to=olof@lixom.net \
    --cc=dvhart@linux.intel.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.