diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2020-04-16 13:50:05 +0200 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2020-04-16 14:09:13 +0200 |
commit | 1ffc36ab7b1e5d9790170c70cfd7f9affbf0a734 (patch) | |
tree | d031b3a9a4074720aff305bee07742c22fa846e3 /autobuild.rb | |
parent | fd56191f34405f616147ae898be1576b02013e68 (diff) | |
download | autobuild-1ffc36ab7b1e5d9790170c70cfd7f9affbf0a734.tar autobuild-1ffc36ab7b1e5d9790170c70cfd7f9affbf0a734.tar.gz autobuild-1ffc36ab7b1e5d9790170c70cfd7f9affbf0a734.tar.bz2 autobuild-1ffc36ab7b1e5d9790170c70cfd7f9affbf0a734.tar.xz autobuild-1ffc36ab7b1e5d9790170c70cfd7f9affbf0a734.zip |
Add a stage_ attribute that corresponds to the build stage reached.
Diffstat (limited to 'autobuild.rb')
-rwxr-xr-x | autobuild.rb | 27 |
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 |