summaryrefslogtreecommitdiffstats
path: root/autobuild.rb
diff options
context:
space:
mode:
Diffstat (limited to 'autobuild.rb')
-rwxr-xr-xautobuild.rb32
1 files changed, 30 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