/usr/bin/cqa-scanlogs 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 | #!/usr/bin/ruby
# Parse log files and extract info about packages that failed to build
# because of dependancies problems.
require 'collab-qa'
require 'optparse'
verbose = false
todofile = nil
disptime = false
restrict = nil
progname = File::basename($PROGRAM_NAME)
id = nil
only_failed = false
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", "--with-time", "Display time in output") do |v|
disptime = 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
opts.on("-i", "--id TEXT", "Only logs with identifier") do |i|
id = i
end
opts.on("-f", "--failed", "Only failed logs") do |f|
only_failed = true
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
if id
files = Dir::glob("*_#{id}.log")
else
files = Dir::glob("*log")
end
end
if files.empty?
STDERR.puts "No (matching) log files found in current directory."
end
files.sort.each do |file|
puts "Parsing #{file}" if verbose
begin
log = CollabQA::Log::new(file)
log.extract_log
next if only_failed and log.result == "OK"
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
end
end
|