History

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.

Yann E. MORIN committed 14 years ago

Commit 4edc7e31 parent f8f57011 file · +15 −3Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/config+15−3
@@ -26,10 +26,14 @@ commands: · 25 unmodified lines
2626 commands can be repeated multiple times
2727
2828 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)
3031
3132 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.
3337 EOL
3438 exit 1
3539 }
@@ -44,7 +48,9 @@ checkarg() { · 8 unmodified lines
4448 ARG="${ARG/CONFIG_/}"
4549 ;;
4650 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
4854 }
4955
5056 set_var() {
@@ -75,10 +81,16 @@ if [ "$1" = "" ] ; then · 24 unmodified lines
7581 usage
7682 fi
7783
84+MUNGE_CASE=yes
7885 while [ "$1" != "" ] ; do
7986 CMD="$1"
8087 shift
8188 case "$CMD" in
89+ --keep-case|-k)
90+ MUNGE_CASE=no
91+ shift
92+ continue
93+ ;;
8294 --refresh)
8395 ;;
8496 --*-after)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t