/[collab-qa]/archive-rebuilds/log-summary.rb
ViewVC logotype

Contents of /archive-rebuilds/log-summary.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 319 - (show annotations) (download)
Tue Jul 10 07:29:53 2007 UTC (5 years, 10 months ago) by lucas
Original Path: archive-rebuilds/agf.rb
File size: 1491 byte(s)
minor improvements to scripts
1 #!/usr/bin/ruby -w
2 # Parse log files and extract info about packages that failed to build
3 # because of dependancies problems.
4 #
5 # Usage:
6 # (in the directory containing all the logs:)
7 # agf.rb <file with APT_GET_FAILED TODO lines>
8
9 def getloglines(file)
10 $log = IO::read(file)
11 $lines = $log.split(/\n/)
12 if not (g = $lines.grep(/^The following packages have unmet dependencies:$/)).empty?
13 $bps = $lines.index(g[0]) + 1
14 g = $lines.grep(/^E: Broken packages$/)
15 $agf = $lines.index(g[0]) - 1
16 $buglog = $lines[$bps..$agf]
17 return $buglog
18 elsif not (g = $lines.grep(/^E: Couldn't find package /)).empty?
19 return g
20 elsif not (g = $lines.grep(/^E: Package .* has no installation candidate$/)).empty?
21 return g
22 elsif not (g = $lines.grep(/^Errors were encountered while processing:$/)).empty?
23 $bps = $lines.index(g[0])
24 g = $lines.grep(/^apt-get failed.$/)
25 $agf = $lines.index(g[0]) - 1
26 $buglog = $lines[$bps..$agf]
27 return $buglog
28 else
29 puts "NO LINES FOUND #{file}"
30 exit 1
31 end
32 end
33
34 IO::read(ARGV[0]).split(/\n/).grep(/ APT_GET_FAILED.* TODO/).each do |l|
35 pkg, rest = l.split(' ')
36 lst = Dir::glob("#{pkg}_*")
37 if lst.length == 0
38 puts "No matching logfile."
39 exit 1
40 elsif lst.length > 1
41 lst2 = lst.join("\n ")
42 puts "Several matching logfiles:\n #{lst2}"
43 exit 1
44 else
45 file = lst[0]
46 end
47
48 lines = getloglines(file)
49 lines.each do |l2|
50 printf "%-20s %s\n" % [pkg, l2]
51 end
52 end

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5