Kconfig: Fix various bugs
v2 cover Kconfig: Fix various bugs
Commit 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script) introduced various bugs.
We are trying to be user-friendly, not developer-friendly, but it causes my headache...
Masahiro Yamada (4):
kconfig: fix savedefconfig to output empty defconfig
kconfig: fix whitespace handling bug of savedefconfig
kconfig: fix savedefconfig to handle TPL correctly
kconfig: fix a bug of "make config"
Makefile | 2 +- scripts/multiconfig.sh | 44 +++++++++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 12 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/4 kconfig: fix savedefconfig to output empty defconfig
Commit 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script) introduced a minor regression.
make alldefconfig; make savedefconfig
should create an empty 'defconfig'.
---
Changes in v2:
- Resend as a series.
- Change the commit subject
scripts/multiconfig.sh | 1 + 1 file changed, 1 insertion(+)
scripts/multiconfig.sh +1 -0
@@ -217,6 +217,7 @@ do_savedefconfig () { done rm -f defconfig + touch defconfig for line in $output_lines do echo $line >> defconfig
Signature · 1 line
1.9.1
PATCH v2 1/4 kconfig: fix savedefconfig to output empty defconfig
Quoted 9 lines · Masahiro Yamada
Commit
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script) introduced a minor regression.make alldefconfig; make savedefconfig
should create an empty 'defconfig'.Signed-off-by Masahiro Yamada <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/ae5b9408/attachment.pgp>
PATCH v2 2/4 kconfig: fix whitespace handling bug of savedefconfig
In reply to Masahiro YamadaCommit 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script) introduced another regression.
Shell usually handles whitespaces as separators,
so "make saveconfig" outputs
# CONFIG_FOO is not set
into:
#
CONFIG_FOO
is
not
set
Whitespaces should not be treated as separators here.
---
Changes in v2:
- Resend as a series
- Change the commit subject
scripts/multiconfig.sh | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
scripts/multiconfig.sh +29 -8
@@ -170,7 +170,7 @@ do_savedefconfig () { # backslashes as an escape character while read -r line do - output_lines="$output_lines $line" + output_lines="$output_lines%$line" done < defconfig for img in $subimages
@@ -185,43 +185,64 @@ do_savedefconfig () { tmp= match= + # "# CONFIG_FOO is not set" should not be divided. + # Use "%" as a separator, instead of a whitespace. + # "%" is unlikely to appear in defconfig context. + save_IFS=$IFS + IFS=% # coalesce common lines together for i in $output_lines do case "$i" in "[+A-Z]*:$line") - tmp="$tmp $unmatched" + tmp="$tmp%$unmatched" i=$(echo "$i" | \ sed -e "s/^\([^:]\)*/\1$symbol/") - tmp="$tmp $i" + tmp="$tmp%$i" match=1 ;; "$line") - tmp="$tmp $unmatched" - tmp="$tmp +$symbol:$i" + tmp="$tmp%$unmatched" + tmp="$tmp%+$symbol:$i" match=1 ;; *) - tmp="$tmp $i" + tmp="$tmp%$i" ;; esac done + # Restore the default separator for the outer for loop. + IFS=$save_IFS + if [ "$match" ]; then output_lines="$tmp" unmatched= else - unmatched="$unmatched $symbol:$line" + unmatched="$unmatched%$symbol:$line" fi done < defconfig done rm -f defconfig touch defconfig + + save_IFS=$IFS + IFS=% + for line in $output_lines do - echo $line >> defconfig + case "$line" in + "") + # do not output blank lines + ;; + *) + echo $line >> defconfig + ;; + esac done + + IFS=$save_IFS } # Usage:
Signature · 1 line
1.9.1
PATCH v2 2/4 kconfig: fix whitespace handling bug of savedefconfig
Hi Masahiro,
Quoted 11 lines · Masahiro Yamada
Commit
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script) introduced another regression.Shell usually handles whitespaces as separators,
so "make saveconfig" outputs#
CONFIG_FOOis not setinto:
Quoted 7 lines
#
CONFIG_FOO
is
not
setWhitespaces should not be treated as separators here.
Oh dear...python is so much better at dealing with parameters and strings.
Quoted 2 lines
Signed-off-by Masahiro Yamada <[email protected]>
Regards,
Simon
PATCH v2 2/4 kconfig: fix whitespace handling bug of savedefconfig
Hi Simon,
2014-09-04 8:49 GMT+09:00 Simon Glass <[email protected]>:
Quoted 20 lines
Hi Masahiro,
Quoted 17 lines · Masahiro Yamada
Commit
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script) introduced another regression.Shell usually handles whitespaces as separators,
so "make saveconfig" outputs#
CONFIG_FOOis not setinto:
#
CONFIG_FOO
is
not
set
Quoted 4 lines
Quoted 1 line
Whitespaces should not be treated as separators here.
Oh dear...python is so much better at dealing with parameters and strings.
Shell script is much more difficult than Python (and Perl) for text processing.
This is really unfortunate...
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH v2 2/4 kconfig: fix whitespace handling bug of savedefconfig
In reply to Masahiro YamadaQuoted 17 lines · Masahiro Yamada
Commit
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script) introduced another regression.Shell usually handles whitespaces as separators,
so "make saveconfig" outputs#
CONFIG_FOOis not setinto:
#
CONFIG_FOO
is
not
set
Quoted 4 lines
Whitespaces should not be treated as separators here.
Signed-off-by Masahiro Yamada <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/b65e3741/attachment.pgp>
PATCH v2 3/4 kconfig: fix savedefconfig to handle TPL correctly
In reply to Masahiro YamadaSince 3ff291f371fa9858426774f3732924bacb61ed1c (kconfig: convert Kconfig helper script into a shell script), "make savedefconfig" of TPL boards has not been working.
---
Changes in v2:
- Newly added
scripts/multiconfig.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/multiconfig.sh +3 -3
@@ -194,14 +194,14 @@ do_savedefconfig () { for i in $output_lines do case "$i" in - "[+A-Z]*:$line") + [+A-Z]*:$line) tmp="$tmp%$unmatched" i=$(echo "$i" | \ - sed -e "s/^\([^:]\)*/\1$symbol/") + sed -e "s/^\([^:]*\)/\1$symbol/") tmp="$tmp%$i" match=1 ;; - "$line") + $line) tmp="$tmp%$unmatched" tmp="$tmp%+$symbol:$i" match=1
Signature · 1 line
1.9.1
PATCH v2 3/4 kconfig: fix savedefconfig to handle TPL correctly
Quoted 5 lines · Masahiro Yamada
Since
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script), "make savedefconfig" of TPL boards has not been working.Signed-off-by Masahiro Yamada <[email protected]>
PATCH v2 3/4 kconfig: fix savedefconfig to handle TPL correctly
Quoted 6 lines · Simon Glass
Quoted 5 lines · Masahiro Yamada
Since
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script), "make savedefconfig" of TPL boards has not been working.Signed-off-by Masahiro Yamada <[email protected]>
I mean:
PATCH v2 3/4 kconfig: fix savedefconfig to handle TPL correctly
In reply to Masahiro YamadaQuoted 7 lines · Masahiro Yamada
Since
3ff291f371fa9858426774f3732924bacb61ed1c(kconfig: convertKconfighelper script into a shell script), "make savedefconfig" of TPL boards has not been working.Signed-off-by Masahiro Yamada <[email protected]>Acked-by Simon Glass <[email protected]Acked-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/7cf216f7/attachment.pgp>
PATCH v2 4/4 kconfig: fix a bug of "make config"
In reply to Masahiro YamadaSince 3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convert Kconfig helper script into a shell script), "make config" is not working because of a missing '$' before '(Q)'.
Besides, "make config" should be invoked via scripts/multiconfig.sh to avoid a warning message:
Kconfig:11:warning: environment variable KCONFIG_OBJDIR undefined
---
Changes in v2:
- Newly added
Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -458,7 +458,7 @@ KBUILD_DEFCONFIG := sandbox_defconfig export KBUILD_DEFCONFIG KBUILD_KCONFIG config: scripts_basic outputmakefile FORCE - (Q)$(MAKE) $(build)=scripts/kconfig $@ + +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@ %config: scripts_basic outputmakefile FORCE +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/multiconfig.sh $@
Signature · 1 line
1.9.1
PATCH v2 4/4 kconfig: fix a bug of "make config"
Quoted 9 lines · Masahiro Yamada
Since
3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convertKconfighelper script into a shell script), "make config" is not working because of a missing '$' before '(Q)'.Besides, "make config" should be invoked via
scripts/multiconfig.shto avoid a warning message:
Kconfig:11:warning: environment variableKCONFIG_OBJDIRundefinedSigned-off-by Masahiro Yamada <[email protected]>
PATCH v2 4/4 kconfig: fix a bug of "make config"
In reply to Masahiro YamadaQuoted 10 lines · Masahiro Yamada
Since
3ff291f371fa9858426774f3732924bacb61ed1c
(kconfig: convertKconfighelper script into a shell script), "make config" is not working because of a missing '$' before '(Q)'.Besides, "make config" should be invoked via
scripts/multiconfig.shto avoid a warning message:
Kconfig:11:warning: environment variableKCONFIG_OBJDIRundefinedSigned-off-by Masahiro Yamada <[email protected]>Acked-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140916/58f822de/attachment.pgp>