r3503 - trunk/scripts
Andres Salomon
dilinger at costa.debian.org
Fri Jul 15 12:32:33 UTC 2005
Author: dilinger
Date: 2005-07-15 12:32:30 +0000 (Fri, 15 Jul 2005)
New Revision: 3503
Modified:
trunk/scripts/split-config
Log:
diff love!
Modified: trunk/scripts/split-config
===================================================================
--- trunk/scripts/split-config 2005-07-15 10:44:45 UTC (rev 3502)
+++ trunk/scripts/split-config 2005-07-15 12:32:30 UTC (rev 3503)
@@ -90,9 +90,18 @@
f << configline(key, val)
}
}
- Shell.command("make #{OPTIONS['configtype']} ARCH=#{OPTIONS['arch']}")
+ system("make #{OPTIONS['configtype']} ARCH=#{OPTIONS['arch']}")
end
+def kdiff(from, to)
+ same = from.keys & to.keys
+
+ added = (to.keys - same).collect
+ removed = (from.keys - same).collect
+ changed = same.detect { |key| from[key] != to[key] }
+ [ added, removed, changed ]
+end
+
def usage(errno)
s = errno == 0 ? $stdout : $stderr
s.puts "Usage: #{$0} [options] <config dir> <flavour>\n"
@@ -146,11 +155,16 @@
path += '/' + OPTIONS['subarch'] unless OPTIONS['subarch'].nil?
kconf = collect(OPTIONS['dir'], path, OPTIONS['flavour'])
mkconfig(kconf)
-#kconf.each {|key, val|
-# puts "key: #{key}, val: #{val}"
-#}
newconf = parse_config('.config', {})
-diff = newconf - kconf
-puts diff.inspect
+added, removed, changed = kdiff(kconf, newconf)
+puts "added:"
+puts "\t" + [added].flatten.join(', ')
+
+puts "\nremoved:"
+puts "\t" + [removed].flatten.join(', ')
+
+puts "\nchanged:"
+puts "\t" + [changed].flatten.join(', ')
+
exit(0)
More information about the Kernel-svn-changes
mailing list