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

Contents of /archive-rebuilds/md.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 626 - (show annotations) (download)
Fri Jan 4 13:46:09 2008 UTC (5 years, 4 months ago) by lucas
File size: 4549 byte(s)
rebuild with dash as /bin/sh
1 #!/usr/bin/ruby -w
2 # mb - prepares a mail for a bug report
3
4 DATE='2008/01/03'
5 SDATE=DATE.gsub('/', '')
6
7 # max number of lines to include in the bug report
8 $maxlines=20
9
10 if ARGV.length > 1
11 $maxlines = ARGV[1].to_i * $maxlines
12 end
13
14 # fetch the error from a build that failed during the build phase
15 def get_buglog_build(log, lines)
16 if $idxbuildfinished - $idxbuilding < $maxlines
17 STDERR.puts "Log is short enough, sending everything"
18 return lines[$idxbuilding..$idxbuildfinished]
19 end
20 # get the last "entering" message
21 # p lines.grep(/^make.*: Entering directory `/)
22 if not (l = lines.grep(/^make.*: Entering directory `/)).empty?
23 idxent = lines.rindex(l[-1])
24 puts l[-1]
25 if $idxbuildfinished - idxent < $maxlines
26 STDERR.puts "Cutting from last 'Entering directory'"
27 return lines[idxent..$idxbuildfinished]
28 end
29 end
30 STDERR.puts "Cutting last #{$maxlines} lines"
31 return lines[($idxbuildfinished - $maxlines)..$idxbuildfinished]
32 end
33
34 # guess the log filename
35 file = ARGV[0]
36 if not File::exists?(file)
37 lst = Dir::glob("#{file}*")
38 if lst.length == 0
39 puts "No matching logfile."
40 exit 1
41 elsif lst.length > 1
42 lst2 = lst.join("\n ")
43 puts "Several matching logfiles:\n #{lst2}"
44 exit 1
45 else
46 file = lst[0]
47 end
48 end
49
50 $log = IO::read(file)
51 $lines = $log.split(/\n/)
52
53 # gets the important stuff
54 dbh = $lines.grep(/^DC-Build-Header:/)[0]
55 dbs = $lines.grep(/^DC-Build-Status:/)[0]
56 junk, $package, $version, rest = dbh.split(' ', 4)
57 junk, $result, $time = dbs.split(' ', 3)
58
59 STDERR.puts "P:#{$package} V:#{$version} R:#{$result} T:#{$time}"
60
61 if (g = $lines.grep(/^Build finished at /)).empty?
62 # didn't display the "Build finished" message
63 if not (g = $lines.grep(/^Source-dependencies not satisfied; /)).empty?
64
65 STDERR.puts "Failed during build-deps phase ..."
66 # failed to install build dep.
67 $idxfailedbuilddeps = $lines.index(g[0])
68 g = $lines.grep(/^\*\* Using build dependencies supplied by package:/)
69 $idxstartbd = $lines.index(g[0])
70 $buglog = $lines[$idxstartbd..$idxfailedbuilddeps]
71 else
72 puts "UNKNOWN CASE"
73 exit 1
74 end
75 else
76 $idxbuildfinished = $lines.index(g[0]) - 2
77 if not (l = $lines.grep(/^dpkg-source: building.*\.dsc$/)).empty?
78 STDERR.puts "Failed during build phase ..."
79 $idxbuilding = $lines.index(l[0])
80 $buglog = get_buglog_build($log, $lines)
81
82 elsif not (l = $lines.grep(/^ \/usr\/bin\/fakeroot debian\/rules clean/)).empty?
83 STDERR.puts "Failed during cleaning phase ..."
84 $idxstartbd = $lines.index(l[0])
85 $buglog = $lines[$idxstartbd..$idxbuildfinished]
86 elsif not (l = $lines.grep(/^dpkg-checkbuilddeps: Unmet build dependencies:/)).empty? or not (l = $lines.grep(/^dpkg-buildpackage: warning: Build dependencies\/conflicts unsatisfied; aborting.$/)).empty?
87 STDERR.puts "Failed during check for build deps phase ..."
88 g = $lines.grep(/^\*\* Using build dependencies supplied by package:/)
89 $idxstartbd = $lines.index(g[0])
90 $buglog = $lines[$idxstartbd..$idxbuildfinished]
91 else
92 STDERR.puts "Failed BEFORE build phase, dunno what to do."
93 exit 1
94 end
95 end
96
97 versions = `apt-cache showsrc #{$package} |grep "^Version:" | awk '{print $2}'`.split
98 versions.each do |v|
99 if `dpkg --compare-versions #{v} gt #{$version} ; echo $?`.to_i == 0
100 puts "There's a newer version available: #{v} (vs: #{$version})."
101 STDIN.getc
102 end
103 end
104
105 File::open("mutt.#{$package}", "w") do |f|
106 f.puts "From: #{ENV['DEBFULLNAME']} <#{ENV['DEBEMAIL']}>"
107 f.puts "To: submit@bugs.debian.org"
108 f.puts "Subject: #{$package}: FTBFS with dash: XXX"
109 f.puts
110 f.puts "Package: #{$package}"
111 f.puts "version: #{$version}"
112 f.puts "User: debian-qa@lists.debian.org"
113 f.puts "Usertags: qa-ftbfs-dash-#{SDATE} qa-ftbfs-dash"
114 f.puts
115 f.puts <<-EOF
116 Hi,
117
118 During a rebuild of all packages in sid using /bin/dash as /bin/sh, your package failed to build.
119
120 Relevant part:
121
122 EOF
123 f.puts " > " + $buglog.join("\n > ")
124 f.puts <<-EOF
125
126 The full build log is available from:
127 http://people.debian.org/~lucas/logs/#{DATE}.dash/
128
129 Rumors say that Ubuntu is using dash as /bin/sh on their buildds, so a patch
130 might be available. Check <http://packages.qa.debian.org/#{$package}>, or
131 directly on launchpad: <https://launchpad.net/ubuntu/+source/#{$package}>.
132
133 A list of current common problems and possible solutions is available at
134 http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute!
135 EOF
136 end
137 STDERR.puts
138 cmd = "mutt -H mutt.#{$package}"
139 STDERR.puts cmd
140 STDIN.getc
141 system(cmd)

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5