require 'date' packages = {} def file_time(file_name) File::Stat.new(file_name).mtime end Dir.glob("/var/lib/schedbot/uploads/todo/cauldron/core/release/*umeabo*.info").each{|f| # f = "/var/lib/schedbot/uploads/todo/cauldron/core/release/20250628173238.umeabot.duvel.498607_@2220249:rust-pathfinder_simd-0.5.2-0.2.mga10.src.rpm.info" prefix = f.sub(/.*\/([^\/]*\.umeabot[^_]*)_.*/, "\\1") path = f.sub(/(.*)\/[^\/]*\.umeabot.*/, "\\1") srpm = f.sub(/.*:(.*)\.info/, "\\1") p = {} done_path = path.sub(/\/todo\//, "/done/") p['submit_time'] = DateTime.strptime(f.sub(/.*\/([^\/]*)\.umeabot.*/, "\\1"), "%Y%m%d%H%M%S").to_time upload_file = "#{done_path}/#{prefix}.upload" if File.exists?(upload_file) then p['upload_time'] = file_time(upload_file) else next end noarch = File.exists?("#{done_path}/#{prefix}_noarch.done") Dir.glob("#{done_path}/#{prefix}/*/build.*.log").each{|l| # rpm_qa.i686.0.20250628173325.log s = File.basename(l).split(".") if noarch then arch = "noarch" else arch = s[1] end start_time = DateTime.strptime(s[3], "%Y%m%d%H%M%S").to_time end_time = file_time(l) p["builds"] ||= {} p["builds"][arch] = { 'build_start' => start_time, 'build_end' => end_time, 'build_secs' => (end_time - start_time).to_i, } } packages[srpm] = p } puts "package,arch,submit_time,upload_time,build_start_time,build_end_time,build_secs" packages.keys.sort.each{|pname| pkg = packages[pname] pkg["builds"].keys.sort.each{|b| t = pkg["builds"][b] puts "#{pname},#{b},#{pkg["submit_time"]},#{pkg["upload_time"]},#{t["build_start"]},#{t["build_end"]},#{t["build_secs"]}" } }