From 32f97e81bf76947fc6a325d128c336b3fb037dca Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Jan 26 2011 07:20:33 +0000 Subject: add NVRA info instead of the package name. --- diff --git a/bin/fontconfig-template-audit.rb b/bin/fontconfig-template-audit.rb index 8a1f040..253ae6e 100755 --- a/bin/fontconfig-template-audit.rb +++ b/bin/fontconfig-template-audit.rb @@ -108,6 +108,8 @@ begin result[pkg.name] = {} STDERR.printf("Checking %s...\n", pkg.name) y.extract(pkg.name) do |rpm| + result.delete(pkg.name) + result[rpm.name] = {} Dir.glob(File.join('etc', 'fonts', 'conf.d', '*')) do |f| STDERR.printf(" Checking %s...\n", f) fn = File.basename(f) @@ -122,29 +124,29 @@ begin xml = Hpricot.XML("#{val}") a -= xml if fc.include?(xml, :normalize=>true) if a.length != size then - result[pkg.name][fn] ||= {} - result[pkg.name][fn][:authorized] ||= [] - result[pkg.name][fn][:authorized] << key + result[rpm.name][fn] ||= {} + result[rpm.name][fn][:authorized] ||= [] + result[rpm.name][fn][:authorized] << key size = a.length end end unless a.empty? then STDERR.printf("W: %s: %s may contains the non-authorized rule\n", pkg.name, fn) - result[pkg.name][fn] ||= {} - result[pkg.name][fn][:nonauthorized] ||= [] - result[pkg.name][fn][:nonauthorized] << a + result[rpm.name][fn] ||= {} + result[rpm.name][fn][:nonauthorized] ||= [] + result[rpm.name][fn][:nonauthorized] << a end end - if result[pkg.name].empty? then + if result[rpm.name].empty? then availconf = Dir.glob(File.join('usr', 'share', 'fontconfig', 'conf.avail', '*')) if availconf.empty? then STDERR.printf("E: %s: no fontconfig config files provided\n", pkg.name) else availconf.each do |f| fn = File.basename(f) - result[pkg.name][fn] ||= {} - result[pkg.name][fn][:not_enabled] ||= [] - result[pkg.name][fn][:not_enabled] << [] + result[rpm.name][fn] ||= {} + result[rpm.name][fn][:not_enabled] ||= [] + result[rpm.name][fn][:not_enabled] << [] end end end diff --git a/lib/fontpackages/yum.rb b/lib/fontpackages/yum.rb index 113dd3f..5960840 100644 --- a/lib/fontpackages/yum.rb +++ b/lib/fontpackages/yum.rb @@ -188,6 +188,18 @@ module FontPackages end end # def extract + def <=>(x) + x <=> @name + end # def <=> + + def ==(x) + x == @name + end # def == + + def to_s + @name + end # def to_s + end # class RPMFile end # module FontPackages