Skip to content

Commit d5bfb6b

Browse files
yann-morin-1998michal42
authored andcommitted
scripts/config: add option to undef a symbol
It is currently possible to enable, disable or modularise a symbol. Also, an undefined symbol is reported as such. Add a new command to undefine a symbol, by removing the corresponding line from the .config file. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent f5ef2f7 commit d5bfb6b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/config

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ commands:
1717
Set option to "string"
1818
--set-val option value
1919
Set option to value
20+
--undefine|-u option Undefine option
2021
--state|-s option Print state of option (n,y,m,undef)
2122
2223
--enable-after|-E beforeopt option
@@ -73,6 +74,12 @@ set_var() {
7374
fi
7475
}
7576

77+
undef_var() {
78+
local name=$1
79+
80+
sed -ri "/^($name=|# $name is not set)/d" "$FN"
81+
}
82+
7683
if [ "$1" = "--file" ]; then
7784
FN="$2"
7885
if [ "$FN" = "" ] ; then
@@ -134,6 +141,9 @@ while [ "$1" != "" ] ; do
134141
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
135142
shift
136143
;;
144+
--undefine|-u)
145+
undef_var "${CONFIG_}$ARG"
146+
;;
137147

138148
--state|-s)
139149
if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then

0 commit comments

Comments
 (0)