[Collab-qa-commits] r1454 - in collab-qa-tools: bin lib/collab-qa

Lucas Nussbaum lucas at alioth.debian.org
Fri May 8 20:11:23 UTC 2009


Author: lucas
Date: 2009-05-08 20:11:23 +0000 (Fri, 08 May 2009)
New Revision: 1454

Added:
   collab-qa-tools/bin/cqa-annotate
Modified:
   collab-qa-tools/bin/cqa-importbugnumbers
   collab-qa-tools/bin/cqa-scanlogs
   collab-qa-tools/lib/collab-qa/log-parser.rb
Log:
various cqa-tools changes

Added: collab-qa-tools/bin/cqa-annotate
===================================================================
--- collab-qa-tools/bin/cqa-annotate	                        (rev 0)
+++ collab-qa-tools/bin/cqa-annotate	2009-05-08 20:11:23 UTC (rev 1454)
@@ -0,0 +1,108 @@
+#! /usr/bin/ruby1.8 -w
+
+require 'collab-qa'
+require 'optparse'
+
+verbose = false
+todofile = nil
+disptime = false
+restrict = nil
+progname = File::basename($PROGRAM_NAME)
+opts = OptionParser::new do |opts|
+  opts.program_name = progname
+  opts.banner = "Usage: #{progname} [options]"
+  opts.separator ""
+  opts.separator "Options:"
+
+  opts.on("-v", "--verbose", "Verbose mode") do |v|
+    verbose = true
+  end
+
+  opts.on("-t", "--TODO FILE", "Only TODO lines from file") do |f|
+    todofile = f
+  end
+
+  opts.on("-r", "--restrict RE", "Only lines matching RE") do |r|
+    restrict = /#{r}/
+  end
+end
+opts.parse!(ARGV)
+
+if todofile
+  pkgs = IO::read(todofile).split(/\n/).grep(/ TODO/).map { |e| e.split(' ')[0] }
+  files = []
+  pkgs.each do |pkg|
+    g = Dir::glob("#{pkg}_*log")
+    g2 = Dir::glob("#{pkg}.*log")
+    files << g[0] if g[0] != nil
+    files << g2[0] if g2[0] != nil
+  end
+else
+  files = Dir::glob("*log")
+end
+
+DATE=ENV['DATE']
+
+files.sort.each do |file|
+  puts
+  puts "######## #{file} ########"
+  log = CollabQA::Log::new(file)
+  log.extract_log
+  next if log.oneline_to_s(disptime) !~ restrict
+  puts "--------- Error:"
+  puts log.extract
+  puts "----------------"
+  puts log.sum_1l
+  puts "----------------"
+  bugs = IO::read(".bugs.#{log.package}").split(/\n/)
+  bugs.each_with_index do |i, j|
+    puts "#{j+1}: #{i}"
+  end
+  versions = `apt-cache showsrc #{log.package} |grep "^Version:" | awk '{print $2}'`.split
+  versions.each do |v|
+    if `dpkg --compare-versions #{v} gt #{log.version} ; echo $?`.to_i == 0
+      puts "There's a newer version available: #{v} (vs: #{log.version})."
+    end
+  end
+  ex = false
+  while not ex
+    l = STDIN.gets
+    l.chomp!
+    if l.to_i != 0
+      bugnum = bugs[l.to_i-1].split[0]
+      todo = IO::read(ENV['TODOFILE'])
+      todo.gsub!(/^#{log.package} (.*) TODO.*$/, "#{log.package} \\1 ##{bugnum}")
+      File::open(ENV['TODOFILE'], "w") do |f|
+        f.print todo
+      end
+      ex = true
+    elsif l == 'r'
+      File::open(".mail.#{log.package}", "w") do |f|
+        f.puts log.to_mail(DATE, ENV['DEBFULLNAME'], ENV['DEBEMAIL'], ENV['BUGTYPE'], file)
+      end
+      cmd = "/usr/bin/mutt -e 'set autoedit' -H .mail.#{log.package}"
+      system(cmd)
+      if ENV['TODOFILE']
+        puts "edit TODOFILE? ('n' if not!)"
+        l = STDIN.gets
+        l.chomp!
+        if l != 'n'
+          todo = IO::read(ENV['TODOFILE'])
+          todo.gsub!(/^#{log.package} (.*) TODO.*$/, "#{log.package} \\1 NNN")
+          File::open(ENV['TODOFILE'], "w") do |f|
+            f.print todo
+          end
+        end
+      end
+      ex = true
+    elsif l == "s"
+      puts "Skipping ..."
+      ex = true
+    elsif l =~ /^v/
+      bugnum = bugs[l[1..-1].to_i-1].split[0]
+      system("epiphany http://bugs.debian.org/#{bugnum} &>/dev/null &")
+    else
+      puts "Unknown command: #{l.inspect}"
+    end
+  end
+end


Property changes on: collab-qa-tools/bin/cqa-annotate
___________________________________________________________________
Added: svn:executable
   + *

Modified: collab-qa-tools/bin/cqa-importbugnumbers
===================================================================
--- collab-qa-tools/bin/cqa-importbugnumbers	2009-05-08 20:09:22 UTC (rev 1453)
+++ collab-qa-tools/bin/cqa-importbugnumbers	2009-05-08 20:11:23 UTC (rev 1454)
@@ -21,7 +21,9 @@
   matches = rest.scan(/((#\d+|NNN).*)/)
   m = matches[0]
   if matches[0].nil?
-    STDERR.puts "NOTHING ON LINE: #{l}"
+    if rest !~ /TODO/
+      STDERR.puts "NOTHING ON LINE: #{l}"
+    end
   else
     m = m[0]
     m.gsub!(/\s+RECHECK.*/,'')

Modified: collab-qa-tools/bin/cqa-scanlogs
===================================================================
--- collab-qa-tools/bin/cqa-scanlogs	2009-05-08 20:09:22 UTC (rev 1453)
+++ collab-qa-tools/bin/cqa-scanlogs	2009-05-08 20:11:23 UTC (rev 1454)
@@ -8,6 +8,7 @@
 verbose = false
 todofile = nil
 disptime = false
+restrict = nil
 progname = File::basename($PROGRAM_NAME)
 opts = OptionParser::new do |opts|
   opts.program_name = progname
@@ -27,6 +28,11 @@
   opts.on("-t", "--TODO FILE", "Only TODO lines from file") do |f|
     todofile = f
   end
+
+  opts.on("-r", "--restrict RE", "Only lines matching RE") do |r|
+    restrict = /#{r}/
+  end
+
 end
 opts.parse!(ARGV)
 
@@ -48,7 +54,12 @@
   begin
     log = CollabQA::Log::new(file)
     log.extract_log
-    puts "#{log.oneline_to_s(disptime)}"
+    if restrict
+      l = log.oneline_to_s(disptime)
+      puts "#{l}" if l =~ restrict
+    else
+      puts "#{log.oneline_to_s(disptime)}"
+    end
   rescue RuntimeError => e
     STDERR.puts "Exception caught while parsing #{file}"
     STDERR.puts e.backtrace

Modified: collab-qa-tools/lib/collab-qa/log-parser.rb
===================================================================
--- collab-qa-tools/lib/collab-qa/log-parser.rb	2009-05-08 20:09:22 UTC (rev 1453)
+++ collab-qa-tools/lib/collab-qa/log-parser.rb	2009-05-08 20:11:23 UTC (rev 1454)
@@ -130,15 +130,15 @@
       s
     end
 
-    def to_mail(date, fullname, email, bugtype)
+    def to_mail(date, fullname, email, bugtype, filename = "")
       sdate = date.gsub(/\//, '')
       bfooter = <<-EOF
 A list of current common problems and possible solutions is available at 
 http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute!
 
 About the archive rebuild: The rebuild was done on about 50 AMD64 nodes
-of the Grid'5000 platform, using a clean chroot containing a sid i386
-environment.  Internet was not accessible from the build systems.
+of the Grid'5000 platform, using a clean chroot.  Internet was not
+accessible from the build systems.
       EOF
       if @logtype == :piuparts
         s = <<-EOF
@@ -186,7 +186,7 @@
 > #{@extract.join("\n> ")}
 
 The full build log is available from:
-   http://people.debian.org/~lucas/logs/#{date}
+   http://people.debian.org/~lucas/logs/#{date}/#{filename}
 
 This bug is part of the "dash" release goal (see
 http://release.debian.org/lenny/goals.txt). If you intend to fix this
@@ -223,7 +223,7 @@
 > #{@extract.join("\n> ")}
 
 The full build log is available from:
-   http://newpeople.debian.org/~lucas/logs/#{date}
+   http://people.debian.org/~lucas/logs/#{date}/#{filename}
 
 It is possible that your package builds fine in sid, but you should make sure
 that your package also builds fine in lenny before the release.
@@ -241,23 +241,23 @@
 Severity: serious
 User: debian-qa at lists.debian.org
 Usertags: qa-ftbfs-#{sdate} qa-ftbfs
-Justification: FTBFS on i386
+Justification: FTBFS on amd64
 
 Hi,
 
 During a rebuild of all packages in sid, your package failed to build on
-i386.
+amd64.
 
 Relevant part:
 > #{@extract.join("\n> ")}
 
 The full build log is available from:
-   http://newpeople.debian.org/~lucas/logs/#{date}
+   http://people.debian.org/~lucas/logs/#{date}/#{filename}
 
 #{bfooter}
 EOF
         end
-        return s
+        return s.chomp
       end
     end
   end




More information about the Collab-qa-commits mailing list