support process a lintian output file

* --skip-lintian to skip lintian execution
* --filename will be processed as lintian output
remotes/origin/mika/lintian
Victor Seva 9 years ago committed by Michael Prokop
parent c6c8c0246f
commit e2beae591b

@ -37,6 +37,11 @@ o = OptionParser.new do|opts|
lintian_file = f
end
options[:skiplintian] = false
opts.on("--skip-lintian", String, "filename file will be processed") do
options[:skiplintian] = true
end
options[:disableplaintext] = false
opts.on('--disable-plaintext', 'Disable recording lintian output in lintian.txt' ) do
options[:disableplaintext] = true
@ -79,31 +84,35 @@ files = ARGV
usage if files.empty?
### }}}
if ! options[:skiplintian] then
### make sure lintian is available {{{
if not system("which lintian >/dev/null 2>&1") then
$stderr.puts "Error: lintian not available."
exit(1)
end
if not system("which lintian >/dev/null 2>&1") then
$stderr.puts "Error: lintian not available."
exit(1)
end
# }}}
### run lintian {{{
start = Time.now.to_f
start = Time.now.to_f
lintian_options << "--info" unless options[:disablenotes]
lintian_options << "--info" unless options[:disablenotes]
# Ruby 1.8's IO.popen expects a string instead of an array :(
lintian_cmd = (['lintian'] + lintian_options + files).collect { |v| Shellwords.escape(v) }.join(" ")
$output = IO.popen(lintian_cmd) do |io|
io.read
end
$duration = Time.now.to_f - start
# Ruby 1.8's IO.popen expects a string instead of an array :(
lintian_cmd = (['lintian'] + lintian_options + files).collect { |v| Shellwords.escape(v) }.join(" ")
$output = IO.popen(lintian_cmd) do |io|
io.read
end
if ! options[:disablenotes] then
File.open(lintian_file, 'w') {|f| f.write($output) }
end
$duration = Time.now.to_f - start
if ! options[:disablenotes] then
File.open(lintian_file, 'w') {|f| f.write($output) }
end
### }}}
else
$duration = 0
$output = File.open(lintian_file, 'r').read
end
class JUnitOutput
require 'rexml/formatters/transitive'

Loading…
Cancel
Save