From 892c02f11fc9c6b05570bf05f846dd22146826d6 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 14 Jan 2016 02:31:40 +0100 Subject: Add scanning of build logs looking for known bugs These can be displayed along with appropriate hyperlinks for more info on the results page. --- autobuild.rb | 32 ++++++++++++++++++++++++++++++-- bugscan.rb | 13 +++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 bugscan.rb diff --git a/autobuild.rb b/autobuild.rb index d764375..81b69c9 100755 --- a/autobuild.rb +++ b/autobuild.rb @@ -3,6 +3,7 @@ require 'fileutils' require 'rubygems' require 'sqlite3' +require_relative 'bugscan' def create_tables(db) #db.execute "CREATE TABLE IF NOT EXISTS Packages(Id INTEGER PRIMARY KEY, Name TEXT, Version TEXT, Release TEXT, UNIQUE (Name, Version, Release))" @@ -134,7 +135,30 @@ def find_attributes(build_dir) attr_line = attr_line.strip() return attr_line end - + +# Find interesting things about the build, indicating a known bug +def find_bug_matches(build_dir) + build_files = Dir.glob(build_dir + '/build.*.log') + build_file = build_files[0] + if build_file then + # Big regex that matches everything we're looking for + # Regexp.union doesn't work as it doesn't bracket each regex + any_bug_re = Regexp.new('(' + $bug_matches.keys.join(')|(') + ')') + regex_list = $bug_matches.keys.map{|key| key.to_s} + + # loop over file + File.open(build_file).each_line do |li| + if any_bug_re.match(li) then + # loop over individual regexes to find the matching one + regex_list.each do |regex| + return $bug_matches[regex] if (/#{regex}/.match(li)) + end + end + end + return '' + end +end + def insert_run(db, status_file) t_start = Date.parse(File.basename(File.dirname(status_file))).strftime('%s') puts "Inserting data for run #{t_start} (#{status_file})" @@ -163,7 +187,11 @@ def insert_run(db, status_file) puts name end # Store some interesting attributes about the build - attr = find_attributes(File.dirname(status_file) + '/' + name + '-' + version + '-' + release + '.src.rpm') + log_dir = File.dirname(status_file) + '/' + name + '-' + version + '-' + release + '.src.rpm' + attr = find_attributes(log_dir) + bug_attr = find_bug_matches(log_dir) + attr = attr + ' ' + bug_attr if bug_attr + #puts "\t\t\tAttributes: " + attr if attr then begin diff --git a/bugscan.rb b/bugscan.rb new file mode 100644 index 0000000..4c6a2b0 --- /dev/null +++ b/bugscan.rb @@ -0,0 +1,13 @@ +# Regexes to match against the build log +$bug_matches = { + "com\\.sun\\.tools\\.javac\\.Main is not on the classpath" => "err_javacmissing", # e.g. gnu-getopt + "Unable to find a javac compiler" => "err_javacmissing", # e.g. fmj + "role: org\\.apache\\.maven\\.Maven" => "err_maven", # e.g. XmlSchema + "required file './depcomp' not found" => "err_depcomp", # e.g. admesh + "depcomp: No such file or directory" => "err_depcomp", # e.g. asteroids3D + "aclocal-1.\\d+: command not found" => "err_oldautoconf", # e.g. argtable2 + "Empty %files file.*\\.debugfiles.list" => "err_debuglist", # e.g. kon2 + "Empty %files file.*\\.lang" => "err_findlang", + "Installed \\(but unpackaged\\) file\\(s\\) found" => "err_unpackagedfile", # e.g. flvtool2 + "^ File not found:" => "err_packagedfilemissing", +} -- cgit v1.2.1