summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-09-04 05:41:32 +0900
committerTom Rini <trini@ti.com>2014-09-16 12:23:58 -0400
commit8dffe663a2e50751150d92caf834f717d397ac80 (patch)
tree7da227474d6a882b112430e6b5d6740a3ace87b8 /scripts
parent93481b9f6b3286083a12b136e091caf6f24d8b9e (diff)
downloadu-boot-8dffe663a2e50751150d92caf834f717d397ac80.tar.gz
kconfig: fix whitespace handling bug of savedefconfig
Commit 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. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/multiconfig.sh37
1 files changed, 29 insertions, 8 deletions
diff --git a/scripts/multiconfig.sh b/scripts/multiconfig.sh
index 785f5639a6..7606193102 100644
--- a/scripts/multiconfig.sh
+++ b/scripts/multiconfig.sh
@@ -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: