/usr/bin/cqa-annotate 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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | #!/usr/bin/ruby
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']
if DATE.nil?
puts "DATE environment variable not set. e.g export DATE=2011/08/23"
exit(1)
end
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 "----------------"
nbl = log.extract.length
puts "package: #{log.package}"
puts "lines: #{nbl}"
if nbl > 200
puts "TOO MANY LINES"
end
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 =~ /^v /
rest, b = l.split(' ')
if b.to_i != 0
bugnum = bugs[b.to_i-1].split[0]
system("w3m -dump http://bugs.debian.org/#{bugnum}")
end
elsif l =~ /^sev /
rest, b = l.split(' ')
if b.to_i != 0
bugnum = bugs[b.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
system("bts severity #{bugnum} serious")
end
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!(/^#{Regexp::escape(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
|