summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/project-checker.rb')
-rwxr-xr-xscripts/project-checker.rb61
1 files changed, 61 insertions, 0 deletions
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
+
+
+