Commit 6bbe4385 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: merge_config: avoid false positive matches from comment lines

The current SED_CONFIG_EXP could match to comment lines in config
fragment files, especially when CONFIG_PREFIX_ is empty. For example,
Buildroot uses empty prefixing; starting symbols with BR2_ is just
convention.

Make the sed expression more robust against false positives from
comment lines. The new sed expression matches to only valid patterns.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarPetr Vorel <petr.vorel@gmail.com>
Reviewed-by: default avatarArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
parent 02826a6b
...@@ -102,7 +102,8 @@ if [ ! -r "$INITFILE" ]; then ...@@ -102,7 +102,8 @@ if [ ! -r "$INITFILE" ]; then
fi fi
MERGE_LIST=$* MERGE_LIST=$*
SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p"
SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p"
TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
...@@ -116,7 +117,7 @@ for MERGE_FILE in $MERGE_LIST ; do ...@@ -116,7 +117,7 @@ for MERGE_FILE in $MERGE_LIST ; do
echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2
exit 1 exit 1
fi fi
CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE)
for CFG in $CFG_LIST ; do for CFG in $CFG_LIST ; do
grep -q -w $CFG $TMP_FILE || continue grep -q -w $CFG $TMP_FILE || continue
...@@ -159,7 +160,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET ...@@ -159,7 +160,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
# Check all specified config values took (might have missed-dependency issues) # Check all specified config values took (might have missed-dependency issues)
for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do
REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment