diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-05-16 20:57:01 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-05-16 20:57:04 +0200 |
commit | 0d4009fa7c3f43321ae5768b06e8c113b8e8eeec (patch) | |
tree | c6826f25dc7db994e22f40170fe1f97dd298eeec /scripts | |
parent | a8b834873d78015237089dca6bad11e456f5ccca (diff) | |
download | ptxdist-0d4009fa7c3f43321ae5768b06e8c113b8e8eeec.tar.gz ptxdist-0d4009fa7c3f43321ae5768b06e8c113b8e8eeec.tar.xz |
ptxd_kconfig: handle removed symbols when creating and applying diffs
If a dependency for a symbol is disabled, then the symbol will be dropped
from the config. In that case, it will not appear in the diff. This is not
exactly a problem, because kconfig will drop the symbol anyways. However,
mconf detects this as a modification and will always ask to save the
config.
To avoid this, add all dropped symbols in the diff and use that information
to drop them when applying the diff.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/ptxd_lib_kconfig.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/lib/ptxd_lib_kconfig.sh b/scripts/lib/ptxd_lib_kconfig.sh index 7efb77a3f..b89392faa 100644 --- a/scripts/lib/ptxd_lib_kconfig.sh +++ b/scripts/lib/ptxd_lib_kconfig.sh @@ -125,6 +125,10 @@ ptxd_kconfig_create_config_merge() { a="${a% is not set}" a="${a#\# }" b="n" + elif [[ -z "${b}" && "${a}" =~ ^'# '[^\ ]*' is undefined'$ ]]; then + a="${a% is undefined}" + a="${a#\# }" + b="u" elif [[ "${a}" =~ ^('<<<<<<<'|'>>>>>>>') ]]; then if [ "${#args[@]}" -eq 0 ]; then conflict=1 @@ -158,6 +162,9 @@ ptxd_kconfig_create_config_merge() { n) option="-d" ;; + u) + option="-u" + ;; *) option="--set-val" arg="${b}" @@ -455,8 +462,19 @@ ptxd_kconfig_update_config() { # take any new lines and sort by option name diff "${tmp}.base" "${tmp}.new" | \ sed -n 's/^> \(\(# \)\?[A-Z]*_\)/\1/p' | \ - sed 's/^# \(.*\) is not set$/\1=n/' | sort | \ - sed 's/^\([^=]*\)=n$/# \1 is not set/' >> "${tmp}" && + sed 's/^# \(.*\) is not set$/\1=n/' >> "${tmp}.tmp" && + # handle all removed symbols + diff "${tmp}.base" "${tmp}.new" | \ + sed -n 's/^< \(# \)\?\([A-Z]*_[^= ]*\)[= ].*$/\2/p' | \ + while read sym; do + if ! grep -q "^${sym}=" "${tmp}.tmp"; then + echo "${sym}=u" >> "${tmp}.tmp" + fi + done + sort "${tmp}.tmp" | \ + sed -e 's/^\([^=]*\)=n$/# \1 is not set/' \ + -e 's/^\([^=]*\)=u$/# \1 is undefined/' \ + >> "${tmp}" && if [ $(wc -l < "${tmp}") -eq 1 ] && ! cmp -s "${base_config}" "${target_config}"; then echo "# ptxdist: comment and sorting changes only" >> "${tmp}" fi |