summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xautobuild.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/autobuild.rb b/autobuild.rb
index 20b5d7b..ae14e98 100755
--- a/autobuild.rb
+++ b/autobuild.rb
@@ -172,6 +172,30 @@ def find_bug_matches(build_dir)
end
end
+# Find to what stage the build made it
+def find_final_stage(build_dir)
+ final_stage = 'stage_nobuild'
+ build_files = Dir.glob(build_dir + '/build.*.log')
+ build_file = build_files[0]
+ if build_file then
+ stage_re = Regexp.new('^Executing\(%(\w+)\)')
+ final_stage = 'stage_preprep'
+
+ # loop over file
+ File.open(build_file).each_line do |li|
+ begin
+ match = stage_re.match(li)
+ if match then
+ final_stage = 'stage_' + match[1]
+ end
+ rescue ArgumentError => e
+ # Some lines have invalid UTF-8, just ignore them
+ end
+ end
+ end
+ return final_stage
+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})"
@@ -205,12 +229,13 @@ def insert_run(db, status_file)
if result != 'ok' then
bug_attr = find_bug_matches(log_dir)
attr = attr + ' ' + bug_attr if bug_attr
+ attr = attr + ' ' + find_final_stage(log_dir)
end
#puts "\t\t\tAttributes: " + attr
if attr then
begin
- db.execute "INSERT INTO Attributes(Package, Run, Attr) VALUES(#{package_id}, #{run_id}, '#{attr}')"
+ db.execute "INSERT INTO Attributes(Package, Run, Attr) VALUES(#{package_id}, #{run_id}, '#{attr.strip}')"
rescue Exception => e
puts name
end