/usr/bin/cqa-fetchbugs is in collab-qa-tools 0.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #!/usr/bin/ruby
# Parse log files and extract info about packages that failed to build
# because of dependancies problems.
require 'collab-qa'
require 'optparse'
require 'soap/rpc/driver'
require 'thread'
mutex = Mutex.new
cv = ConditionVariable.new
nbfree = 10
bts = SOAP::RPC::Driver::new('http://bugs.debian.org/cgi-bin/soap.cgi', '/Debbugs/SOAP')
bts.add_method('get_status', 'bugs')
bts.add_method('get_bugs', 'params')
bts.add_method('get_bug_log', 'params')
bts.add_method('get_usertag', 'email', 'tag')
bts.add_method('newest_bugs', 'num')
verbose = false
todofile = 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
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") + Dir::glob("#{pkg}.log")
files << g[0] if g[0] != nil
end
else
files = Dir::glob("*log")
end
ths = []
n = 0
files.sort.each do |l|
ths << Thread::new(l) do |l|
mutex.synchronize do
while nbfree == 0 do
cv.wait(mutex)
end
nbfree -= 1
end
puts "#{l}... (#{n+1}/#{files.length})"
n += 1
log = CollabQA::Log::new(l)
pkg = log.package
if not File::exists?(".bugs.#{pkg}")
bugs1 = bts.get_bugs(['src', pkg])
bugs2 = bts.get_bugs(['package', pkg])
bugs = bugs1 + bugs2
status = bts.get_status(bugs)
f = File::new(".bugs.#{pkg}.new", 'w')
if bugs.length > 0
status.each_pair do |k,v|
next if (not ['serious', 'grave', 'critical'].include?(v.severity)) and v.subject !~ /ftbfs/i and v.subject !~ /piuparts/i and v.subject !~ /installation/i and v.subject !~ /(post|pre)(rm|inst)/i and v.subject !~ /buil(d|t)/i and v.subject !~ /remov/i and v.subject !~ /purge/i and v.subject !~ /upgrade/i and v.subject !~ /prompt/ and v.subject !~ /conffile/
f.puts "#{k} #{v.severity} #{v.subject} || #{v.done}"
end
end
f.close
system("mv .bugs.#{pkg}.new .bugs.#{pkg}")
end
mutex.synchronize do
nbfree += 1
cv.signal
end
end
end
ths.each do |t|
t.join
end
|