[Patch] split-config and config removal
Hi Andres,
In the course of using split-config I have noticed a small problem. In
some cases it is not safe to remove an option from a config, unless it
is removed gloablly. When I say not safe, nothing particularly
catastropic happens, but each time you run split-config, you have to
wade through a mountain of "this option was removed, what shall i do",
messages. To demonstrate this, try split-config on arm/rpc, twice.
The patch below should aleviate this problem, by adding an annotation
to the debian configs if a option has been removed, but is not
removed globablly.
Its my first peek into the world or ruby, so please forgive any
stupidity on my part.
--
Horms
Index: split-config
===================================================================
--- split-config ($B%j%S%8%g%s(B 4099)
+++ split-config ($B:n6H%3%T!<(B)
@@ -25,6 +25,8 @@
File.open(file).each { |line|
if line =~ /^(CONFIG_\w+)=(.+)$/
kconf[$1] = $2
+ elsif line =~ /^\s*#\s*(CONFIG_\w+) is removed\s*$/
+ kconf[$1] = 'XXX'
elsif line =~ /^\s*#\s*(CONFIG_\w+) is not set\s*$/
kconf[$1] = 'n'
end
@@ -35,6 +37,8 @@
def configline(key, val)
if val == 'n'
"# #{key} is not set\n"
+ elsif val == 'XXX'
+ "# #{key} is removed\n"
else
"#{key}=#{val}\n"
end
@@ -190,12 +194,17 @@
end
def remove_option(key, val)
+ return if val == 'XXX'
puts "\n#{key}=#{val} has been removed."
answer = prompt_user()
files = affected_files(answer)
files.each { |f|
strip_key(f, key)
}
+ return if answer == 'g'
+ File.open(files[0], 'a') { |f|
+ f << configline(key, 'XXX')
+ }
end
def update_option(key, oldval, newval)
Reply to: