diff options
author | Yann E. MORIN <yann.morin.1998@free.fr> | 2012-06-07 19:48:55 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2012-06-28 04:38:54 -0400 |
commit | 4edc7e32affd40ceb06ba58ff55e4664396b24c7 (patch) | |
tree | 902783a6e52844ef531310a063acdb7a5fda7992 /scripts/config | |
parent | f8f5701bdaf9134b1f90e5044a82c66324d2073f (diff) |
scripts/config: add option to not upper-case symbols
Currently, scripts/config mangles the config option symbols to always
be upper-case.
While the Linux kernel almost exclusively uses upper-case symbols, there
are still a few symbols with lower-case which this script can not handle:
$ grep -r -E '^[[:space:]]*config[[:space:]]+[^[:space:]]*[[:lower:]][^[:space:]=.]*$' . |wc -l
173
(that's roughly 1.3% of the symbols in 3.5-rc1)
Eg.:
./arch/arm/Kconfig:config VFPv3
./arch/powerpc/platforms/Kconfig.cputype:config 40x
./arch/x86/Kconfig:config SCx200HR_TIMER
./drivers/video/console/Kconfig:config FONT_8x8
./drivers/video/Kconfig:config NTSC_640x480
Also, other projects that use kconfig may allow for lower- or mixed-case
symbols, and may find easier to reuse this script than implement each
their own (potentially flawed) logic. For such a use-case, see:
http://marc.info/?l=linux-kbuild&m=133409932115848&w=2
This patch adds a new option to keep the given case, and keep the current
default to upper-case the symbols.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/config')
-rwxr-xr-x | scripts/config | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/config b/scripts/config index ed6653ef9702..c5639fe5bba8 100755 --- a/scripts/config +++ b/scripts/config | |||
@@ -26,10 +26,14 @@ commands: | |||
26 | commands can be repeated multiple times | 26 | commands can be repeated multiple times |
27 | 27 | ||
28 | options: | 28 | options: |
29 | --file .config file to change (default .config) | 29 | --file config-file .config file to change (default .config) |
30 | --keep-case|-k Keep next symbols' case (dont' upper-case it) | ||
30 | 31 | ||
31 | config doesn't check the validity of the .config file. This is done at next | 32 | config doesn't check the validity of the .config file. This is done at next |
32 | make time. | 33 | make time. |
34 | |||
35 | By default, config will upper-case the given symbol. Use --keep-case to keep | ||
36 | the case of all following symbols unchanged. | ||
33 | EOL | 37 | EOL |
34 | exit 1 | 38 | exit 1 |
35 | } | 39 | } |
@@ -44,7 +48,9 @@ checkarg() { | |||
44 | ARG="${ARG/CONFIG_/}" | 48 | ARG="${ARG/CONFIG_/}" |
45 | ;; | 49 | ;; |
46 | esac | 50 | esac |
47 | ARG="`echo $ARG | tr a-z A-Z`" | 51 | if [ "$MUNGE_CASE" = "yes" ] ; then |
52 | ARG="`echo $ARG | tr a-z A-Z`" | ||
53 | fi | ||
48 | } | 54 | } |
49 | 55 | ||
50 | set_var() { | 56 | set_var() { |
@@ -75,10 +81,16 @@ if [ "$1" = "" ] ; then | |||
75 | usage | 81 | usage |
76 | fi | 82 | fi |
77 | 83 | ||
84 | MUNGE_CASE=yes | ||
78 | while [ "$1" != "" ] ; do | 85 | while [ "$1" != "" ] ; do |
79 | CMD="$1" | 86 | CMD="$1" |
80 | shift | 87 | shift |
81 | case "$CMD" in | 88 | case "$CMD" in |
89 | --keep-case|-k) | ||
90 | MUNGE_CASE=no | ||
91 | shift | ||
92 | continue | ||
93 | ;; | ||
82 | --refresh) | 94 | --refresh) |
83 | ;; | 95 | ;; |
84 | --*-after) | 96 | --*-after) |