[Collab-qa-commits] r529 - / orphan-list

lucas at alioth.debian.org lucas at alioth.debian.org
Fri Nov 30 16:01:13 UTC 2007


Author: lucas
Date: 2007-11-30 16:01:13 +0000 (Fri, 30 Nov 2007)
New Revision: 529

Added:
   orphan-list/
   orphan-list/README
   orphan-list/list-orphaned.rb
Log:
script to generate a list of orphaned packages

Added: orphan-list/README
===================================================================
--- orphan-list/README	                        (rev 0)
+++ orphan-list/README	2007-11-30 16:01:13 UTC (rev 529)
@@ -0,0 +1,6 @@
+Lists orphaned packages, with the date they were orphaned.
++ Needs to be run on merkel.
++ Reads the BTS logs to try to determine the exact date for bugs
+  reassigned/retitled. (fragile, doesn't work for bugs retitled before
+  march 2007, but better than nothing).
++ Override mechanism directly in the script to change the date (unixtime).

Added: orphan-list/list-orphaned.rb
===================================================================
--- orphan-list/list-orphaned.rb	                        (rev 0)
+++ orphan-list/list-orphaned.rb	2007-11-30 16:01:13 UTC (rev 529)
@@ -0,0 +1,80 @@
+#!/usr/bin/ruby -w
+
+bugid = nil
+bugpkg = nil
+bugseverity = nil
+bugtitle = nil
+bugdate = nil
+bugtags = []
+bugaffect = []
+bugmerged = false
+
+bugs = []
+
+OVERRIDES={
+  'gsumi' => 1142813880
+}
+
+def getdate(id, odate)
+  dir = id.to_s[4..5]
+  l = IO::read("/org/bugs.debian.org/spool/db-h/#{dir}/#{id}.log").split(/\n/)
+  l = l.grep(/^(<strong>Changed Bug title|<!-- time:)/)
+  (0...l.length).each do |i|
+    if l[i] =~ /^<!-- time:/ and l[i+1] =~ /^<strong>Changed Bug title to `(O|ITA):/
+      t = l[i].gsub(/.*:(\d+) .*/, '\1').to_i
+      puts "## overriden #{odate} with #{t}"
+      return t
+    end
+    puts "# #{l[i]}"
+  end
+  return odate
+end
+
+IO::read('/org/qa.debian.org/data/bts2ldap/fullindex').each_line do |l|
+  l.chomp!
+  key, val = l.split(' ', 2)
+  if key == 'dn:' and bugid != nil
+    if bugmerged
+      bugmerged = false
+      next
+    else
+      bugmerged = false
+    end
+    next if bugpkg != 'wnpp'
+    next if !bugaffect.include?('unstable')
+    # Analyze bug.
+    if bugtitle =~ /^(ITA|ITP|O|RFA|RFP|RFH): ([^\s]*) -- (.*)$/
+      next if not ['ITA', 'O'].include?($1)
+      type = $1
+      pkg = $2
+      bugdate = getdate(bugid, bugdate)
+      if OVERRIDES.include?(pkg)
+        bugdate = OVERRIDES[pkg]
+      end
+      puts "#{pkg} #{type} #{bugid} #{bugdate} #{bugseverity}"
+    else
+      STDERR.puts "NOMATCH: ##{bugid}: #{bugtitle}"
+    end
+
+    bugtags = []
+    bugaffect = []
+
+  elsif key == 'debbugsID:'
+    bugid = val
+  elsif key == 'debbugsPackage:'
+    bugpkg = val
+  elsif key == 'debbugsSeverity:'
+    bugseverity = val
+  elsif key == 'debbugsTag:'
+    bugtags << val
+  elsif key == 'debbugsTitle:'
+    bugtitle = val
+  elsif key == 'debbugsAffected:'
+    bugaffect << val
+  elsif key == 'debbugsDate:'
+    bugdate = val
+  elsif key == 'debbugsMergedWith:'
+    bugmerged = true if val.to_i < bugid.to_i
+  end
+end
+


Property changes on: orphan-list/list-orphaned.rb
___________________________________________________________________
Name: svn:executable
   + *




More information about the Collab-qa-commits mailing list