diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2016-01-14 02:31:40 +0100 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2020-03-26 10:36:03 +0100 |
commit | 892c02f11fc9c6b05570bf05f846dd22146826d6 (patch) | |
tree | 48dbbeb3b30a526a333222809fee7f19bafbe98d | |
parent | 5a755132786d90fdd2aa883d90b40a7f2295cb9d (diff) | |
download | autobuild-892c02f11fc9c6b05570bf05f846dd22146826d6.tar autobuild-892c02f11fc9c6b05570bf05f846dd22146826d6.tar.gz autobuild-892c02f11fc9c6b05570bf05f846dd22146826d6.tar.bz2 autobuild-892c02f11fc9c6b05570bf05f846dd22146826d6.tar.xz autobuild-892c02f11fc9c6b05570bf05f846dd22146826d6.zip |
Add scanning of build logs looking for known bugs
These can be displayed along with appropriate hyperlinks for more info
on the results page.
-rwxr-xr-x | autobuild.rb | 32 | ||||
-rw-r--r-- | bugscan.rb | 13 |
2 files changed, 43 insertions, 2 deletions
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", +} |