[Collab-qa-commits] r685 - ddpo-by-mail

lucas at alioth.debian.org lucas at alioth.debian.org
Thu Jan 31 12:29:21 UTC 2008


Author: lucas
Date: 2008-01-31 12:29:21 +0000 (Thu, 31 Jan 2008)
New Revision: 685

Added:
   ddpo-by-mail/DeadCode
   ddpo-by-mail/bugs.rb
   ddpo-by-mail/pkgtestingstatus.rb
   ddpo-by-mail/testingissues.rb
   ddpo-by-mail/update-data.rb
Modified:
   ddpo-by-mail/ddpo-config.rb
   ddpo-by-mail/reminder-mail.rb
Log:
ddpobymail: improvements, prepare DEHS integration

Added: ddpo-by-mail/DeadCode
===================================================================
--- ddpo-by-mail/DeadCode	                        (rev 0)
+++ ddpo-by-mail/DeadCode	2008-01-31 12:29:21 UTC (rev 685)
@@ -0,0 +1,106 @@
+system('wget -q -O - http://popcon.debian.org/by_inst | grep -v "^#" | grep -v "^Total" | awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $7}\' > popcon_by_inst')
+
+# parse popcon
+def getpopcon
+  s = IO::read('popcon_by_inst')
+  pkg = IO::read('ddpo_packages')
+  binpkg = {}
+  pkg.each_line do |l|
+    next if l =~ /^\)\[/
+    src = l.match(/^([^\(]*)\(/)[1]
+    bin = l.match(/\(([^\)]*)\)/)[1]
+    bin.split(/, /).each do |b|
+      binpkg[b] = src
+    end
+  end
+  popcon = Hash::new { 0 }
+  s.each_line do |l|
+    p, i, rest = l.split(' ')
+    s = binpkg[p]
+    i = i.to_i
+    popcon[s] = i if popcon[s] < i
+  end
+  #return popcon.to_a.sort { |a,b| a[1] <=> b[1] }.reverse
+  return popcon
+end
+
+if WRITEPCLIST
+  f = File::new('pc-list.txt', 'w')
+  pc = getpopcon
+  issues.keys.sort { |a,b| pc[a] <=> pc[b] }.reverse.each do |p|
+    ptext = ""
+    issues[p].each do |iss|
+      ptext += " ; " if ptext != ""
+      if iss[0] == :rc_bugs
+        rcbugs = iss[1].map { |b| "##{b}" }.join(', ')
+        ptext += "RC bugs (#{rcbugs})"
+      elsif iss[0] == :not_testing
+        ptext += "not in testing (>#{iss[1]}d)"
+      elsif iss[0] == :no_migration
+        ptext += "no testing migration (>#{iss[1]}d)"
+      end
+    end
+    f.puts "#{p} (#{pc[p]}) #{ptext}"
+  end
+  f.close
+end
+
+if WRITEDDLIST
+  f = File::new('dd-list.txt', 'w')
+  f.puts <<-EOF
+Subject: List of packages with problems regarding release
+
+Hi,
+
+Here is a list (sorted by maintainer email) of packages:
+- that have RC bugs older than #{BUG_AGE} days.
+- that are not currently in testing.
+- that have not migrated from unstable to testing for more than #{LAST_IN_SYNC} days.
+
+(U) after the package means "Uploader", as with dd-list.
+
+  EOF
+  maintainers_pkg.keys.sort.each do |email|
+    mpkgs = {}
+    gissues = 0
+    gtext =<<-EOF
+    #{maintainers_name[email]} <#{email}>
+  EOF
+    maintainers_pkg[email].each do |p|
+      if p =~ /#/
+        mpkgs[p.chop] = false
+      else
+        mpkgs[p] = true
+      end
+    end
+    mpkgs.keys.sort.each do |p|
+      if not mpkgs[p]
+        comaint = ' (U)'
+      else
+        comaint = ''
+      end
+      next if issues[p].empty?
+      ctext = "  #{p}#{comaint}:"
+      ptext = ""
+      issues[p].each do |iss|
+        if iss[0] == :rc_bugs
+          rcbugs = iss[1].map { |b| "##{b}" }.join(', ')
+          ptext += "#{ctext} has RC bugs (#{rcbugs})\n"
+        elsif iss[0] == :not_testing
+          ptext += "#{ctext} not in testing (>#{iss[1]}d)\n"
+        elsif iss[0] == :no_migration
+          ptext += "#{ctext} no testing migration (>#{iss[1]}d)\n"
+        end
+      end
+      gtext += ptext
+      gtext += "\n"
+      gissues += 1
+    end
+    if gissues > 0
+      gtext += "\n"
+      f.puts gtext
+    end
+  end
+  f.close
+end
+

Added: ddpo-by-mail/bugs.rb
===================================================================
--- ddpo-by-mail/bugs.rb	                        (rev 0)
+++ ddpo-by-mail/bugs.rb	2008-01-31 12:29:21 UTC (rev 685)
@@ -0,0 +1,110 @@
+require 'ddpo-config'
+
+def parse_bugs
+  # parse buglist
+  bugs = {}
+  bugtitles = {}
+  maxtime = Time::now.to_i - BUG_AGE * 86400
+
+  bugid = nil
+  bugsrcpkg = nil
+  bugpkg = nil
+  bugseverity = nil
+  bugtitle = nil
+  bugstate = nil
+  bugdone = false
+  bugdate = nil
+  bugtags = []
+  bugaffect = []
+  bugmerged = []
+  bugrttags = []
+
+  IO::read('bts2ldap_fullindex').each_line do |l|
+    l.chomp!
+    key, val = l.split(' ', 2)
+    if key == 'dn:' and bugid != nil
+      obugtags = bugtags
+      obugaffect = bugaffect
+      obugmerged = bugmerged
+      obugdone = bugdone
+      obugsrcpkg = bugsrcpkg
+      obugpkg = bugpkg
+      obugrttags = bugrttags
+
+      bugsrcpkg = nil
+      bugpkg = nil
+      bugdone = false
+      bugtags = []
+      bugaffect = []
+      bugmerged = []
+      bugrttags = []
+
+      # where we classify bugs.
+      next if not obugmerged.empty?
+      next if not obugaffect.include?('unstable')
+      if EXC_BUGS.include?(bugid)
+        puts "Skipping #{bugid}, it is excluded."
+        next
+      end
+
+      reason = nil
+      if ['serious', 'grave', 'critical'].include?(bugseverity)
+        reason = "RC"
+        serious = bugdate < maxtime # serious issue if OLD bug
+      elsif not (obugrttags & RGTAGS.keys).empty?
+        reason = (obugrttags & RGTAGS.keys).map { |e| RGTAGS[e] }.join(', ')
+        serious = false # release goals are always non-serious
+      end
+
+      next if reason.nil?
+
+      bugtitles[bugid] = bugtitle
+      if obugsrcpkg.nil?
+        obugsrcpkg = obugpkg
+      end
+      
+      bugs[obugsrcpkg] = [] if bugs[obugsrcpkg].nil?
+      bugs[obugsrcpkg] << [ bugid, serious, reason ]
+
+    elsif key == 'debbugsID:'
+      bugid = val.to_i
+    elsif key== 'debbugsPackage:'
+      bugpkg = val
+    elsif key== 'debbugsSourcePackage:'
+      bugsrcpkg = val
+    elsif key == 'debbugsDone:'
+      bugdone = true 
+    elsif key == 'debbugsSeverity:'
+      bugseverity = val
+    elsif key == 'debbugsTag:'
+      bugtags << val
+    elsif key == 'debbugsState:'
+      bugstate = val
+    elsif key == 'debbugsTitle:'
+      bugtitle = val
+    elsif key == 'debbugsAffected:'
+      bugaffect << val
+    elsif key == 'debbugsMergedWith:'
+      bugmerged << val
+    elsif key == 'debbugsDate:'
+      bugdate = val.to_i
+    elsif key == 'debbugsRTtag:'
+      bugrttags << val
+    end
+  end
+  return bugs, bugtitles
+end
+
+if $0 == __FILE__
+  bugs, bugtitles = parse_bugs
+  bugs.each_pair do |k,v|
+    puts "#{k}:"
+    v.each do |b|
+      puts " - " + b.join(' ')
+    end
+  end
+
+  bugtitles.each_pair do |k,v|
+    puts "#{k} #{v}"
+  end
+end

Modified: ddpo-by-mail/ddpo-config.rb
===================================================================
--- ddpo-by-mail/ddpo-config.rb	2008-01-31 00:10:44 UTC (rev 684)
+++ ddpo-by-mail/ddpo-config.rb	2008-01-31 12:29:21 UTC (rev 685)
@@ -39,12 +39,15 @@
 EXC_EMAILS_PKGS['pkg-xen-devel at lists.alioth.debian.org'] = ['xen-unstable']
 EXC_EMAILS_PKGS['tomasera at debian.org'] = ['xinetd']
 
-SENDMAIL = true
-WRITEDDLIST = true
-WRITEPCLIST = true
 BUG_AGE = 20
-#LAST_IN_TESTING = 40
 AGE_IN_DEBIAN = 25
-LAST_IN_SYNC = 50
+LAST_IN_SYNC = 30
+LAST_IN_SYNC_SERIOUS = 50
 # etch released on 2007-04-08. So
 # (Date::today - Date::parse('2007-04-08')).to_i
+
+# Release Goals
+# FIXME add other release goals
+RGTAGS = {
+  'goal-dash' => 'dash as /bin/sh'
+}

Added: ddpo-by-mail/pkgtestingstatus.rb
===================================================================
--- ddpo-by-mail/pkgtestingstatus.rb	                        (rev 0)
+++ ddpo-by-mail/pkgtestingstatus.rb	2008-01-31 12:29:21 UTC (rev 685)
@@ -0,0 +1,139 @@
+require 'date'
+
+class PkgTestingStatus
+  @@datezero = Date::parse('0000-01-01')
+  @@curdate = Date::today
+
+  attr_accessor :intesting, :testingversion, :inunstable, :unstableversion, :sync, :syncversion, :firstinunstable
+  def initialize(t,tv,u,uv, s, sv, fu)
+    @intesting = t
+    @testingversion = tv
+    @inunstable = u
+    @unstableversion = uv
+    @sync = s
+    @syncversion = sv
+    @firstinunstable = fu
+  end
+
+  def to_s
+    "#{@intesting} #{@testingversion} #{@inunstable} #{@unstableversion} #{@sync} #{@syncversion} #{@firstinunstable}"
+  end
+
+  def testing_s
+    if @intesting == @@datezero
+      d = 'never'
+      v = ''
+      days = ''
+    else
+      d = @intesting
+      v = @testingversion
+      days = @@curdate - @intesting
+    end
+    return "<td>#{d}</td><td>#{days}</td><td>#{v}</td>"
+  end
+
+  def sync_s
+    if @sync == @@datezero
+      d = 'never'
+      v = ''
+      days = ''
+    else
+      d = @sync
+      v = @syncversion
+      days = @@curdate - @sync
+    end
+    return "<td>#{d}</td><td>#{days}</td><td>#{v}</td>"
+  end
+
+  def testingdays
+    if @intesting != @@datezero
+      return @@curdate - @intesting
+    else
+      return (@@curdate - @firstinunstable)
+    end
+  end
+
+  def testing_ok?(days)
+    return [true, nil] if @@curdate - @firstinunstable < days
+    return [true, nil] if @@curdate - @intesting < 2
+    
+    if @intesting != @@datezero
+      return [false, @@curdate - @intesting ]
+    else
+      return [false, @@curdate - @firstinunstable ]
+    end
+  end
+
+  def sync_ok?(days)
+    if @sync != @@datezero
+      if @@curdate - @sync > days
+        return [false, @@curdate - @sync]
+      else
+        return [true, nil]
+      end
+    else
+      if @@curdate - @firstinunstable > days
+        return [false, @@curdate - @firstinunstable ]
+      else
+        return [true, nil]
+      end
+    end
+  end
+  
+  def syncdays
+    if @sync != @@datezero
+      return @@curdate - @sync
+    else
+      return (@@curdate - @firstinunstable)
+    end
+  end
+
+  def to_row(pkg, orphaned = nil, comment = nil)
+    s = "<tr><td><a href=\"http://packages.qa.debian.org/#{pkg}\">#{pkg}</a>"
+    s += "<a href=\"http://bugs.debian.org/#{orphaned}\">(O)</a>" if orphaned
+    s += "</td>"
+    s += "#{testing_s}#{sync_s}"
+    s += "<td>#{@unstableversion}</td><td>#{@firstinunstable}</td><td>"
+    s += comment if comment
+    s += "</td></tr>"
+    return s
+  end
+
+  def update(curdate, testing, unstable)
+#    STDERR.puts "#{curdate} #{testing} #{unstable}" if testing != unstable
+    if testing
+      if curdate >= @intesting
+        @intesting = curdate 
+        @testingversion = testing
+      else
+        STDERR.puts "[testing] #{curdate} < #{@intesting}, skipping"
+      end
+    end
+    if unstable
+      if curdate >= @inunstable
+        @inunstable = curdate 
+        @unstableversion = unstable
+      else
+        STDERR.puts "[unstable] #{curdate} < #{@inunstable}, skipping"
+      end
+    end
+    if unstable and testing and unstable == testing
+      if curdate >= @sync
+        @sync = curdate 
+        @syncversion = unstable
+      else
+        STDERR.puts "[sync] #{curdate} < #{@sync}, skipping"
+      end
+    end
+  end
+
+  def PkgTestingStatus::read(io)
+    pkgs = {}
+    io.read.each_line do |l|
+      pkg, t, tv, u, uv, s, sv, fu = l.split(' ')
+      pkgs[pkg] = PkgTestingStatus::new(Date::parse(t), tv, Date::parse(u),
+                                      uv, Date::parse(s), sv, Date::parse(fu))
+    end
+    return pkgs
+  end
+end

Modified: ddpo-by-mail/reminder-mail.rb
===================================================================
--- ddpo-by-mail/reminder-mail.rb	2008-01-31 00:10:44 UTC (rev 684)
+++ ddpo-by-mail/reminder-mail.rb	2008-01-31 12:29:21 UTC (rev 685)
@@ -1,20 +1,12 @@
 #!/usr/bin/ruby -w
 
-$:.unshift File.join(File.dirname(__FILE__), '..', 'testing-status')
-require 'pkgtestingstatus'
 require 'ddpo-config'
+require 'bugs'
+require 'testingissues'
+require 'update-data'
 
-IGNFIXED="&ignotherfixed=on"
-#IGNFIXED=""
-def update_data
-  system("rm -f buglist ddpo_packages ddpo_maintainers popcon_by_inst")
-  system("wget -q -O bts2ldap_fullindex http://qa.debian.org/data/bts2ldap/fullindex")
-  system("wget -q -O buglist 'http://bts.turmzimmer.net/details.php?bydist=sid&sortby=packages&ignnew=on#{IGNFIXED}&new=#{BUG_AGE}&refresh=1800'")
-  system("wget -q -O ddpo_packages http://qa.debian.org/data/ddpo/results/ddpo_packages")
-  system("wget -q -O ddpo_maintainers http://qa.debian.org/data/ddpo/results/ddpo_maintainers")
-  system('wget -q -O - http://popcon.debian.org/by_inst | grep -v "^#" | grep -v "^Total" | awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $7}\' > popcon_by_inst')
-end
-update_data
+# fetch updated files from www
+#update_data FIXME
 
 # parse debian-installer packages
 pkg = nil
@@ -24,7 +16,7 @@
     if pkg != nil
       dipkgs << pkg
     end
-    pkg = l.split(' ')[1].chomp
+  pkg = l.split(' ')[1].chomp
   elsif l =~ /^Source: /
     dipkgs << l.split(' ')[1].chomp
     pkg = nil
@@ -32,90 +24,6 @@
 end
 dipkgs.uniq!
 
-# parse testing status
-require 'date'
-now = Date::today
-file = Dir::glob('../testing-status/data.*').sort[-1]
-pts = PkgTestingStatus::read(File::new(file,'r')).reject { |k,v| v.inunstable != now }
-
-# parse buglist
-bugs = {}
-bugtitles = {}
-maxtime = Time::now.to_i - BUG_AGE * 86400
-
-bugid = nil
-bugsrcpkg = nil
-bugpkg = nil
-bugseverity = nil
-bugtitle = nil
-bugstate = nil
-bugdone = false
-bugdate = nil
-bugtags = []
-bugaffect = []
-bugmerged = []
-
-IO::read('bts2ldap_fullindex').each_line do |l|
-  l.chomp!
-  key, val = l.split(' ', 2)
-  if key == 'dn:' and bugid != nil
-    obugtags = bugtags
-    obugaffect = bugaffect
-    obugmerged = bugmerged
-    obugdone = bugdone
-    obugsrcpkg = bugsrcpkg
-    obugpkg = bugpkg
-
-    bugsrcpkg = nil
-    bugpkg = nil
-    bugdone = false
-    bugtags = []
-    bugaffect = []
-    bugmerged = []
-    # where we classify bugs.
-    next if bugdate > maxtime
-    next if not ['serious', 'grave', 'critical'].include?(bugseverity)
-    next if not obugmerged.empty?
-    next if not obugaffect.include?('unstable')
-    if EXC_BUGS.include?(bugid)
-      puts "Skipping #{bugid}, it is excluded."
-      next
-    end
-
-    bugtitles[bugid] = bugtitle
-    if obugsrcpkg.nil?
-      obugsrcpkg = obugpkg
-    end
-    bugs[obugsrcpkg] = [] if bugs[obugsrcpkg].nil?
-    bugs[obugsrcpkg] << bugid
-
-  elsif key == 'debbugsID:'
-    bugid = val.to_i
-  elsif key== 'debbugsPackage:'
-    bugpkg = val
-  elsif key== 'debbugsSourcePackage:'
-    bugsrcpkg = val
-  elsif key == 'debbugsDone:'
-    bugdone = true 
-  elsif key == 'debbugsSeverity:'
-    bugseverity = val
-  elsif key == 'debbugsTag:'
-    bugtags << val
-  elsif key == 'debbugsState:'
-    bugstate = val
-  elsif key == 'debbugsTitle:'
-    bugtitle = val
-  elsif key == 'debbugsAffected:'
-    bugaffect << val
-  elsif key == 'debbugsMergedWith:'
-    bugmerged << val
-  elsif key == 'debbugsDate:'
-    bugdate = val.to_i
-  end
-end
-
-p bugs
-
 # Parse ddpo_packages
 pkgs = Hash::new { [] }
 f = IO::read("ddpo_packages")
@@ -145,74 +53,51 @@
   end
 end
 
-# parse popcon
-def getpopcon
-  s = IO::read('popcon_by_inst')
-  pkg = IO::read('ddpo_packages')
-  binpkg = {}
-  pkg.each_line do |l|
-    next if l =~ /^\)\[/
-    src = l.match(/^([^\(]*)\(/)[1]
-    bin = l.match(/\(([^\)]*)\)/)[1]
-    bin.split(/, /).each do |b|
-      binpkg[b] = src
-    end
-  end
-  popcon = Hash::new { 0 }
-  s.each_line do |l|
-    p, i, rest = l.split(' ')
-    s = binpkg[p]
-    i = i.to_i
-    popcon[s] = i if popcon[s] < i
-  end
-  #return popcon.to_a.sort { |a,b| a[1] <=> b[1] }.reverse
-  return popcon
-end
-
 # get removals
 rms = `lynx -dump 'http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=ftp.debian.org;dist=unstable' |grep RM | awk '{print $4}'`.chomp.split(/\n/).map { |e| e.chomp(',') }
 
+bugs, bugtitles = parse_bugs
+testingissues = testing_issues(dipkgs)
+
+puts "Computing issues for each package ..."
 # compute issues for each package
-issues = Hash::new { [] }
-(bugs.keys + pts.keys - EXC_PKGS).sort.uniq.each do |p|
-  if rms.include?(p)
-    puts "Skipping #{p}, it is RM."
+serious = {}
+issues = {}
+(bugs.keys + testingissues.keys).sort.uniq.each do |pkg|
+  if EXC_PKGS.include?(pkg)
+    puts "Skipping #{pkg}, it is excluded."
     next
   end
+  if rms.include?(pkg)
+    puts "Skipping #{pkg}, it is RM."
+    next
+  end
   pissues = []
-  if bugs[p] != nil
-    pissues << [ :rc_bugs, bugs[p] ]
+  pserious = false
+  if bugs[pkg] != nil
+    pissues << [ :bugs, bugs[pkg] ]
+    pserious = bugs[pkg].inject(pserious) { |a, b| a or b[1] } # update pserious
   end
-  if pts[p]
-    ok, days = pts[p].testing_ok?(AGE_IN_DEBIAN)
-    if not ok
-      if dipkgs.include?(p)
-        puts "Ignoring the fact that #{p} is not in testing (contains udebs)"
-      else
-        pissues << [:not_testing, days ]
-      end
-    end
-    ok, days = pts[p].sync_ok?(LAST_IN_SYNC)
-    if not ok
-      if dipkgs.include?(p)
-        puts "Ignoring the fact that #{p} is not migrating to testing (contains udebs)"
-      else
-        pissues << [:no_migration, days ]
-      end
-    end
+  if testingissues[pkg]
+    pissues << testingissues[pkg]
+    pserious ||= testingissues[pkg][1]
   end
-  issues[p] = pissues unless pissues.empty?
+  unless pissues.empty?
+    issues[pkg] = pissues 
+    serious[pkg] = pserious
+  end
 end
 
-if SENDMAIL
-  maintainers_pkg.keys.sort.each do |email|
-    mpkgs = {}
-    gissues = 0
-    only_uploader = true
-    if email =~ /@list.*\.debian\.org$/
-      only_uploader = false
-    end
-    gtext =<<-EOF
+puts "Preparing mail for each maintainer..."
+# prepare mail for each maintainer
+maintainers_pkg.keys.sort.each do |email|
+  mpkgs = {}
+  mserious = false
+  only_uploader = true # all the packages are about co-maintained packages
+  if email =~ /@list.*\.debian\.org$/
+    only_uploader = false # if sending to a list, send anyway
+  end
+  gtext =<<-EOF
 From: DDPOMail robot <lucas-ddpomail at debian.org>
 To: "#{maintainers_name[email]}" <#{email}>
 Subject: Some of your Debian packages might need attention
@@ -223,57 +108,70 @@
 you maintain in Debian:
 
   EOF
-    maintainers_pkg[email].each do |p|
-      if p =~ /#/
-        mpkgs[p.chop] = false
-      else
-        mpkgs[p] = true
-      end
+  maintainers_pkg[email].each do |pkg|
+    if pkg =~ /#/
+      mpkgs[pkg.chop] = false
+    else
+      mpkgs[pkg] = true
     end
-    mpkgs.keys.sort.each do |p|
-      next if issues[p].empty?
-      # skip if excluded
-      next if EXC_EMAILS_PKGS[email].include?(p)
-      #next if not mpkgs[p] # skip if only uploader
-      if not mpkgs[p]
-        comaint = ' (you co-maintain this package)'
-        only_uploader = false if haslist[p].nil?
-      else
-        comaint = ''
-        only_uploader = false
-      end
-      ptext = "=== #{p}:#{comaint}\n"
-      bjorn = false
-      days = nil
-      issues[p].each do |iss|
-        if iss[0] == :rc_bugs
-          ptext += "= This package has #{iss[1].length} RC bug(s) more than #{BUG_AGE} days old:\n"
-          iss[1].each do |b|
-            ptext += "- ##{b} <http://bugs.debian.org/#{b}>\n"
-            ptext += "  #{bugtitles[b]}\n"
+  end
+  mpkgs.keys.sort.each do |pkg|
+    next if issues[pkg].nil?
+    # skip if excluded
+    next if EXC_EMAILS_PKGS[email].include?(p)
+    if not mpkgs[p]
+      comaint = ' (you co-maintain this package)'
+      only_uploader = false if haslist[p].nil?
+    else
+      comaint = ''
+      only_uploader = false
+    end
+    ptext = "=== #{pkg}:#{comaint}\n"
+    testingpl = false
+    issues[pkg].each do |iss|
+      if iss[0] == :bugs
+        ptext += "= This package has #{iss[1].length} bug(s) that are important for the next release:\n"
+        iss[1].each do |b|
+          ptext += "- ##{b[0]} <http://bugs.debian.org/#{b[0]}>\n"
+          ptext += "  #{bugtitles[b[0]]}\n"
+          if b[1] == "RC"
+            ptext += "  (Release-Critical bug!)\n"
+          else
+            ptext += "  Bug part of a release goal: #{b[1]}\n"
           end
-        elsif iss[0] == :not_testing
-          ptext += "= This package has not been in testing for #{iss[1]} days.\n"
-          ptext += "  If things don't change, it won't be part of lenny!\n"
-	  bjorn = true
-	  days = iss[1]
-        elsif iss[0] == :no_migration
-	  if days != iss[1]
-            ptext += "= This package has not been able to migrate from unstable\n"
-            ptext += "  to testing for #{iss[1]} days.\n"
-	    bjorn = true
-	  end
         end
+      elsif iss[0] == :not_testing
+        ptext += "= This package has not been in testing for #{iss[1]} days.\n"
+        ptext += "  If things don't change, it won't be part of lenny!\n"
+        testingpl = true
+      elsif iss[0] == :no_migration
+        ptext += "= This package has not been able to migrate from unstable\n"
+        ptext += "  to testing for #{iss[1]} days.\n"
+        testingpl = true
+      else
+        raise "Unknown issue #{iss[0]}!"
       end
-      if bjorn
-        ptext += "  See <http://bjorn.haxx.se/debian/testing.pl?package=#{p}>\n"
-      end
-      gtext += ptext
-      gtext += "\n"
-      gissues += 1
     end
-    if gissues > 0
-      gtext += <<-EOF
+    if testingpl
+      ptext += "  See <http://release.debian.org/migration/testing.pl?package=#{p}>\n"
+    end
+    gtext += ptext
+    gtext += "\n"
+    mserious = mserious || serious[pkg]
+  end
+  if not mserious
+    puts "Skipping mail for #{email}, has only non-serious issues."
+    next
+  end
+  if only_uploader
+    puts "Skipping mail for #{email}, only co-maint pkgs have issues"
+    next
+  end
+  if EXC_EMAILS.include?(email)
+    puts "Skipping mail for #{email}, IS EXCLUDED"
+    next
+  end
+  gtext += <<-EOF
 This is an automated mail. These mails are sent monthly.
 For more information about these mails, refer to
 http://wiki.debian.org/qa.debian.org/DdpoByMail
@@ -307,97 +205,8 @@
 -- 
 DDPOMail, run by Lucas Nussbaum
     EOF
-      if only_uploader
-        puts "Skipping mail for #{email}, only co-maint pkgs have issues"
-        next
-      end
-      if EXC_EMAILS.include?(email)
-        puts "Skipping mail for #{email}, IS EXCLUDED"
-        next
-      end
-      File::open("mail_#{email}.txt", 'w') do |f|
-        f.puts gtext
-      end
-    end
+  
+  File::open("mail_#{email}.txt", 'w') do |f|
+    f.puts gtext
   end
 end
-
-if WRITEDDLIST
-  f = File::new('dd-list.txt', 'w')
-  f.puts <<-EOF
-Subject: List of packages with problems regarding release
-
-Hi,
-
-Here is a list (sorted by maintainer email) of packages:
-- that have RC bugs older than #{BUG_AGE} days.
-- that are not currently in testing.
-- that have not migrated from unstable to testing for more than #{LAST_IN_SYNC} days.
-
-(U) after the package means "Uploader", as with dd-list.
-
-  EOF
-  maintainers_pkg.keys.sort.each do |email|
-    mpkgs = {}
-    gissues = 0
-    gtext =<<-EOF
-    #{maintainers_name[email]} <#{email}>
-  EOF
-    maintainers_pkg[email].each do |p|
-      if p =~ /#/
-        mpkgs[p.chop] = false
-      else
-        mpkgs[p] = true
-      end
-    end
-    mpkgs.keys.sort.each do |p|
-      if not mpkgs[p]
-        comaint = ' (U)'
-      else
-        comaint = ''
-      end
-      next if issues[p].empty?
-      ctext = "  #{p}#{comaint}:"
-      ptext = ""
-      issues[p].each do |iss|
-        if iss[0] == :rc_bugs
-          rcbugs = iss[1].map { |b| "##{b}" }.join(', ')
-          ptext += "#{ctext} has RC bugs (#{rcbugs})\n"
-        elsif iss[0] == :not_testing
-          ptext += "#{ctext} not in testing (>#{iss[1]}d)\n"
-        elsif iss[0] == :no_migration
-          ptext += "#{ctext} no testing migration (>#{iss[1]}d)\n"
-        end
-      end
-      gtext += ptext
-      gtext += "\n"
-      gissues += 1
-    end
-    if gissues > 0
-      gtext += "\n"
-      f.puts gtext
-    end
-  end
-  f.close
-end
-
-if WRITEPCLIST
-  f = File::new('pc-list.txt', 'w')
-  pc = getpopcon
-  issues.keys.sort { |a,b| pc[a] <=> pc[b] }.reverse.each do |p|
-    ptext = ""
-    issues[p].each do |iss|
-      ptext += " ; " if ptext != ""
-      if iss[0] == :rc_bugs
-        rcbugs = iss[1].map { |b| "##{b}" }.join(', ')
-        ptext += "RC bugs (#{rcbugs})"
-      elsif iss[0] == :not_testing
-        ptext += "not in testing (>#{iss[1]}d)"
-      elsif iss[0] == :no_migration
-        ptext += "no testing migration (>#{iss[1]}d)"
-      end
-    end
-    f.puts "#{p} (#{pc[p]}) #{ptext}"
-  end
-  f.close
-end

Added: ddpo-by-mail/testingissues.rb
===================================================================
--- ddpo-by-mail/testingissues.rb	                        (rev 0)
+++ ddpo-by-mail/testingissues.rb	2008-01-31 12:29:21 UTC (rev 685)
@@ -0,0 +1,39 @@
+# parse testing status
+require 'ddpo-config'
+require 'date'
+require 'pkgtestingstatus'
+
+def testing_issues(dipkgs)
+  now = Date::today
+#  file = Dir::glob('../testing-status/data.*').sort[-1]
+  file = 'testing-status.raw'
+  pts = PkgTestingStatus::read(File::new(file,'r')).reject { |k,v| v.inunstable != now }
+  testingissues = {}
+  pts.each_pair do |pkg, val|
+    if dipkgs.include?(pkg)
+      puts "Ignoring the testing status of #{pkg} (contains udebs)"
+      next
+    end
+    ok, days = val.testing_ok?(AGE_IN_DEBIAN)
+    if not ok
+      testingissues[pkg] = [:not_testing, true, days ]
+    else
+      ok, days = val.sync_ok?(LAST_IN_SYNC_SERIOUS)
+      if not ok
+        testingissues[pkg] = [:no_migration, true, days ]
+      else
+        ok, days = val.sync_ok?(LAST_IN_SYNC)
+        if not ok
+          testingissues[pkg] = [:no_migration, false, days ]
+        end
+      end
+    end
+  end
+  return testingissues
+end
+
+if $0 == __FILE__
+  ti = testing_issues([])
+  p ti
+end
+

Added: ddpo-by-mail/update-data.rb
===================================================================
--- ddpo-by-mail/update-data.rb	                        (rev 0)
+++ ddpo-by-mail/update-data.rb	2008-01-31 12:29:21 UTC (rev 685)
@@ -0,0 +1,16 @@
+require 'ddpo-config.rb'
+
+IGNFIXED="&ignotherfixed=on"
+def update_data
+  system("rm -f buglist ddpo_packages ddpo_maintainers popcon_by_inst")
+  system("wget -q -O bts2ldap_fullindex http://qa.debian.org/data/bts2ldap/fullindex")
+  system("wget -q -O buglist 'http://bts.turmzimmer.net/details.php?bydist=sid&sortby=packages&ignnew=on#{IGNFIXED}&new=#{BUG_AGE}&refresh=1800'")
+  system("wget -q -O ddpo_packages http://qa.debian.org/data/ddpo/results/ddpo_packages")
+  system("wget -q -O ddpo_maintainers http://qa.debian.org/data/ddpo/results/ddpo_maintainers")
+  system("wget -q -O testing-status.raw http://qa.debian.org/~lucas/testing-status.raw")
+  system("wget -q -O dehs.txt http://dehs.alioth.debian.org/ddpomail.txt")
+end
+
+if $0 == __FILE__
+  update_data
+end




More information about the Collab-qa-commits mailing list