diff options
| author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-11-05 03:19:36 -0500 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-11-11 09:04:51 -0500 |
| commit | 6bbe4385d035c6fac56f840a59861a0310ce137b (patch) | |
| tree | 6a1ee008c52f402b8dc93c343aaea45c167ba7cf /scripts | |
| parent | 02826a6ba301b72461c3706e1cc66d5571cd327e (diff) | |
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: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/kconfig/merge_config.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index da66e7742282..0ef906499646 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh | |||
| @@ -102,7 +102,8 @@ if [ ! -r "$INITFILE" ]; then | |||
| 102 | fi | 102 | fi |
| 103 | 103 | ||
| 104 | MERGE_LIST=$* | 104 | MERGE_LIST=$* |
| 105 | SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" | 105 | SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" |
| 106 | SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" | ||
| 106 | 107 | ||
| 107 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) | 108 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) |
| 108 | 109 | ||
| @@ -116,7 +117,7 @@ for MERGE_FILE in $MERGE_LIST ; do | |||
| 116 | echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 | 117 | echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 |
| 117 | exit 1 | 118 | exit 1 |
| 118 | fi | 119 | fi |
| 119 | CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) | 120 | CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) |
| 120 | 121 | ||
| 121 | for CFG in $CFG_LIST ; do | 122 | for CFG in $CFG_LIST ; do |
| 122 | grep -q -w $CFG $TMP_FILE || continue | 123 | grep -q -w $CFG $TMP_FILE || continue |
| @@ -159,7 +160,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET | |||
| 159 | 160 | ||
| 160 | 161 | ||
| 161 | # Check all specified config values took (might have missed-dependency issues) | 162 | # Check all specified config values took (might have missed-dependency issues) |
| 162 | for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do | 163 | for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do |
| 163 | 164 | ||
| 164 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) | 165 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) |
| 165 | ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") | 166 | ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") |
