summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/check-metadata.rb5
-rwxr-xr-xscripts/project-checker.rb61
2 files changed, 65 insertions, 1 deletions
diff --git a/scripts/check-metadata.rb b/scripts/check-metadata.rb
index 27064fd..6283c87 100755
--- a/scripts/check-metadata.rb
+++ b/scripts/check-metadata.rb
@@ -1,5 +1,8 @@
#!/usr/bin/ruby
+#TODO
+# - multiple maintainer tags in metadata.xml
+
require "rexml/document"
PORTAGE_DIR="/usr/portage/"
@@ -56,7 +59,7 @@ ct_ldesc_lang = 0
categories.map{ |x|
-# puts "Category: #{x}"
+ puts "Category: #{x}"
`ls -1 #{PORTAGE_DIR}/#{x}`.split().map{ |package|
if package != "CVS" && package != "metadata.xml"
diff --git a/scripts/project-checker.rb b/scripts/project-checker.rb
new file mode 100755
index 0000000..169af73
--- /dev/null
+++ b/scripts/project-checker.rb
@@ -0,0 +1,61 @@
+#!/usr/bin/ruby
+#
+#
+#
+
+
+require "rexml/document"
+
+userxml = REXML::Document.new File.new( "/home/bangert/gentoo/gentoo/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml" )
+developers = Hash::new(false)
+userxml.elements.each("userlist/user") { |e|
+ dev = e.attributes["username"].strip.downcase
+ if e.elements["status"] && e.elements["status"].text == "retired"
+ developers[dev] = false
+ else
+ developers[dev] = true
+ end
+}
+
+# takes a REXML::Document and checks project/dev elements against second
+# argument hash
+#
+class ProjectChecker
+ def self.checkDevs rexml, developers, prefix
+ rexml.elements.each("project/dev") { |dev|
+ developer = dev.text.strip.downcase
+ if !developers.has_key?(developer)
+ puts prefix + ": unknown developer: #{developer}"
+ elsif !developers[developer]
+ puts prefix + ": retired devloper: #{developer}"
+ end
+ }
+ end
+
+ def self.recursiveFullCheck developers
+ self.recursiveFullCheckWorker "/home/bangert/gentoo/gentoo/xml/htdocs/proj/en/metastructure/gentoo.xml" ,developers
+ end
+
+ def self.recursiveFullCheckWorker xmlfile, developers
+ projectxml = REXML::Document.new File.new( xmlfile )
+ name = projectxml.elements["project/name"].text
+
+ ProjectChecker.checkDevs(projectxml, developers, name)
+ projectxml.elements.each("project/subproject") { |project|
+ projectfile = "/home/bangert/gentoo/gentoo/xml/htdocs" + project.attribute("ref").to_s
+ if (File.exists? projectfile)
+ self.recursiveFullCheckWorker projectfile, developers
+ else
+ #puts "ERROR: File not found: " + projectfile
+ puts "Project \"#{name}\" does not habe this subproject reference: " + project.attribute("ref").to_s
+ end
+ }
+ end
+
+
+end
+
+ProjectChecker.recursiveFullCheck developers
+
+
+