This file is indexed.

/usr/bin/cqa-compare-ref-rebuild 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
#!/usr/bin/ruby
# Compare two referenced rebuilds
#
# TODO: very ugly, clean it ...
#

require 'collab-qa'
require 'optparse'

id = nil
ref_id = 'normal'
src_dir = nil
out_dir = nil

def generate_results_list(log_id, out_dir)
  puts "generating #{log_id} results list: #{out_dir}/#{log_id}.res"

  system "cqa-scanlogs -i #{log_id} > #{out_dir}/#{log_id}.res"
end

opts = OptionParser::new do |opts|
  opts.program_name = File::basename($PROGRAM_NAME)
  opts.banner = "Usage: #{opts.program_name} [options]"
  opts.separator ""
  opts.separator "Options:"

  opts.on("-s", "--src-dir SRCDIR", "Find build logs in SRCDIR") do |s|
    src_dir = s
  end
  
  opts.on("-o", "--output-dir OUTDIR", "Put results on OUTDIR") do |o|
    out_dir = o
  end

  opts.on("-i", "--id TEXT", "Rebuild identifier") do |i|
    id = i
  end
  
  opts.on("-r", "--ref TEXT", "Reference rebuild identifier: defaults to 'normal'") do |r|
    ref_id = r
  end
end
opts.parse!(ARGV)

if not id or not ref_id or not src_dir or not out_dir
  puts "error: bad argument count, use -h for help"
  exit
end

# convert relative paths to absolute
src_dir = File.join(Dir.pwd, src_dir) unless src_dir[0] == File::SEPARATOR
out_dir = File.join(Dir.pwd, out_dir) unless out_dir[0] == File::SEPARATOR

Dir.mkdir(out_dir) unless File.directory?(out_dir)

Dir::chdir(src_dir)

generate_results_list id, out_dir
generate_results_list ref_id, out_dir

puts "comparing results"

system "cqa-compare-results #{out_dir}/#{ref_id}.res #{out_dir}/#{id}.res | grep -v SAMERES | grep \"OK Failed\" > #{out_dir}/compare.list"

puts "generating log list"

system "cat #{out_dir}/compare.list | sed 's/ [0-9]*:/ /' | awk ' { print $1 \"_\" $2 \"_unstable_#{id}.log\" } ' > #{out_dir}/loglist.#{id}"

log_dir = File.join(out_dir, "logs-failed-#{id}")
Dir.mkdir(log_dir) unless File.directory?(log_dir)
                   
system "rsync -avzP --files-from=#{out_dir}/loglist.#{id} . #{log_dir}"