Przeglądaj źródła

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>
Yann E. MORIN 13 lat temu
rodzic
commit
d5bfb6b381
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10 0
      scripts/config

+ 10 - 0
scripts/config

@@ -17,6 +17,7 @@ commands:
 	                     Set option to "string"
 	                     Set option to "string"
 	--set-val option value
 	--set-val option value
 	                     Set option to value
 	                     Set option to value
+	--undefine|-u option Undefine option
 	--state|-s option    Print state of option (n,y,m,undef)
 	--state|-s option    Print state of option (n,y,m,undef)
 
 
 	--enable-after|-E beforeopt option
 	--enable-after|-E beforeopt option
@@ -73,6 +74,12 @@ set_var() {
 	fi
 	fi
 }
 }
 
 
+undef_var() {
+	local name=$1
+
+	sed -ri "/^($name=|# $name is not set)/d" "$FN"
+}
+
 if [ "$1" = "--file" ]; then
 if [ "$1" = "--file" ]; then
 	FN="$2"
 	FN="$2"
 	if [ "$FN" = "" ] ; then
 	if [ "$FN" = "" ] ; then
@@ -134,6 +141,9 @@ while [ "$1" != "" ] ; do
 		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
 		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
 		shift
 		shift
 		;;
 		;;
+	--undefine|-u)
+		undef_var "${CONFIG_}$ARG"
+		;;
 
 
 	--state|-s)
 	--state|-s)
 		if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
 		if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then