Skip to content

Commit 46dff8d

Browse files
brooniearndb
authored andcommitted
scripts: merge_config: Add option to suppress warning on overrides
Currently merge_config.sh will unconditionally warn if a fragment overrides any already set symbol. This is generally desirable but is inconvenient in cases where we want to create a fragment which disables unwanted options in the base configuration, for example when attempting to produce a smaller version of another configuration. Add an option -Q which will suppress these warnings. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 384fcb0 commit 46dff8d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

scripts/kconfig/merge_config.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ usage() {
2929
echo " -y make builtin have precedence over modules"
3030
echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
3131
echo " -s strict mode. Fail if the fragment redefines any value."
32+
echo " -Q disable warning messages for overridden options."
3233
echo
3334
echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable."
3435
}
@@ -40,6 +41,7 @@ BUILTIN=false
4041
OUTPUT=.
4142
STRICT=false
4243
CONFIG_PREFIX=${CONFIG_-CONFIG_}
44+
WARNOVERRIDE=echo
4345

4446
while true; do
4547
case $1 in
@@ -82,6 +84,11 @@ while true; do
8284
shift
8385
continue
8486
;;
87+
"-Q")
88+
WARNOVERRIDE=true
89+
shift
90+
continue
91+
;;
8592
*)
8693
break
8794
;;
@@ -138,21 +145,21 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
138145
NEW_VAL=$(grep -w $CFG $MERGE_FILE)
139146
BUILTIN_FLAG=false
140147
if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then
141-
echo Previous value: $PREV_VAL
142-
echo New value: $NEW_VAL
143-
echo -y passed, will not demote y to m
144-
echo
148+
${WARNOVVERIDE} Previous value: $PREV_VAL
149+
${WARNOVERRIDE} New value: $NEW_VAL
150+
${WARNOVERRIDE} -y passed, will not demote y to m
151+
${WARNOVERRIDE}
145152
BUILTIN_FLAG=true
146153
elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
147-
echo Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
148-
echo Previous value: $PREV_VAL
149-
echo New value: $NEW_VAL
150-
echo
154+
${WARNOVERRIDE} Value of $CFG is redefined by fragment $ORIG_MERGE_FILE:
155+
${WARNOVERRIDE} Previous value: $PREV_VAL
156+
${WARNOVERRIDE} New value: $NEW_VAL
157+
${WARNOVERRIDE}
151158
if [ "$STRICT" = "true" ]; then
152159
STRICT_MODE_VIOLATED=true
153160
fi
154161
elif [ "$WARNREDUN" = "true" ]; then
155-
echo Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
162+
${WARNOVERRIDE} Value of $CFG is redundant by fragment $ORIG_MERGE_FILE:
156163
fi
157164
if [ "$BUILTIN_FLAG" = "false" ]; then
158165
sed -i "/$CFG[ =]/d" $TMP_FILE

0 commit comments

Comments
 (0)