/usr/bin/piuparts_tap is in jenkins-debian-glue 0.18.4.
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 | #!/usr/bin/env ruby
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
require 'optparse'
options = {}
o = OptionParser.new do|opts|
opts.banner = "Usage: #{File.basename $0} [<options>] <piuparts_logfile>"
options[:ignorebrokensymlinks] = false
opts.on('--ignore-broken-symlinks', 'Do not report broken symlinks as errors' ) do
options[:ignorebrokensymlinks] = true
end
options[:ignoreinstallationerrors] = false
opts.on('--ignore-installation-errors', 'Do not report failed package installations as errors' ) do
options[:ignoreinstallationerrors] = true
end
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end
begin o.parse! ARGV
rescue OptionParser::InvalidOption => e
puts e
puts o
exit(1)
end
if ARGV[0].nil?
$stderr.puts "Usage: #{File.basename $0} <piuparts_logfile>"
exit 1
end
file = ARGV[0]
counter = 1
found_error = 0
begin
output = File.open("#{file}", "r").read
rescue
$stderr.puts "Error: can't read file #{file}"
exit 1
end
# is the number of lines the piuparts logfile contains
# and not the actual number of reports, but the TAP
# plugin of Jenkins doesn't rely on that so we're good
# with it as it is
num_lines = output.lines.count
puts "1..#{num_lines}"
output.gsub(/:\n/, ':').each_line do |critic|
if critic =~ /.*Command ok:.*/
cmd = /(.*)? (DEBUG: Command ok: )(.*)?/.match(critic)[3]
puts "ok #{counter} #{cmd}"
counter += 1
elsif critic =~ /.*DEBUG: Command failed \(status=1\), but ignoring error:.*/
cmd = /(.*)? (DEBUG: Command failed \(status=1\), but ignoring error:) (.*)?/.match(critic)[3]
puts "ok #{counter} #{cmd} # skip Ignoring failed command"
counter += 1
elsif critic =~ /.*ERROR: Command failed \(status=100\):.*/
cmd = /(.*)? (ERROR: Command failed \(status=100\):) (.*)?/.match(critic)[3]
puts "not ok #{counter} #{cmd}"
counter += 1
elsif critic =~ /.*ERROR: Installation of .* failed/
cmd = /(.*)? (ERROR: )(.*)?/.match(critic)[3]
if options[:ignoreinstallationerrors] then
puts "ok #{counter} #{cmd} # skip due to --disable-installation-errors"
else
puts "not ok #{counter} #{cmd} (see piuparts.txt for more details)"
end
counter += 1
elsif critic =~ /.*ERROR: WARN: Broken symlinks/
cmd = /(.*)? (ERROR: )(.*)?/.match(critic)[3]
counter += 1
if options[:ignorebrokensymlinks] then
puts "ok #{counter} #{cmd} # skip due to --disable-broken-symlinks"
else
puts "not ok #{counter} #{cmd}"
end
elsif critic =~ /.*ERROR: FAIL.*/
cmd = /(.*)? (ERROR: FAIL: )(.*)?/.match(critic)[3]
puts "not ok #{counter} #{cmd}"
counter += 1
end
end
|