From 23e071019b3e86551190439a4b3c0e484caef5e8 Mon Sep 17 00:00:00 2001 From: Peter Wilmott
Date: Sun, 16 Aug 2015 23:01:20 +0100 Subject: Only list succeeded and passed packages on the new targets page --- web/lib/ci.rb | 5 ++--- web/routes/tasks.rb | 12 +++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/web/lib/ci.rb b/web/lib/ci.rb index 1a01965..e21fad1 100644 --- a/web/lib/ci.rb +++ b/web/lib/ci.rb @@ -63,8 +63,7 @@ def generate_package_list(ci_type, num_of_packages) end end elsif num_of_packages.is_a?(Integer) - puts packages.count - packages = packages[25..(25 + num_of_packages)] + packages = packages.sample(num_of_packages) else puts 'ERROR: Invalid value for NUM_OF_PACKAGES' puts ci_type @@ -90,7 +89,7 @@ def update_build(log_path) timestamp = build_array[4] target = build_array[2].sub('_target', '') - result = File.read("#{build}/result") + result = File.read("#{build}/result").strip emerge_info = File.read("#{build}/emerge-info") if File.exist?("#{build}/emerge-info") emerge_pqv = File.read("#{build}/emerge-pqv") if File.exist?("#{build}/emerge-pqv") build_log = File.read("#{build}/build.log") if File.exist?("#{build}/build.log") diff --git a/web/routes/tasks.rb b/web/routes/tasks.rb index 9cf3597..4fb48d1 100644 --- a/web/routes/tasks.rb +++ b/web/routes/tasks.rb @@ -5,20 +5,18 @@ class RubyTinderbox < Sinatra::Base packages = [] Package.each do |package| build_current = package.build_dataset.where(target: 'current').reverse_order(:timestamp).first - next if build_current.nil? + next if build_current.nil? || build_current[:result] != 'succeeded' build_next = package.build_dataset.where(target: 'next').reverse_order(:timestamp).first - next if build_next.nil? + next if build_next.nil? || build_next[:result] != 'succeeded' repoman_current = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first - next if repoman_current.nil? + next if repoman_current.nil? || repoman_current[:result] != 'passed' repoman_next = package.repoman_dataset.where(target: 'next').reverse_order(:timestamp).first - next if repoman_next.nil? + next if repoman_next.nil? || repoman_next[:result] != 'passed' - if repoman_current[:result] == 'passed' || repoman_current[:result] == 'partial' && repoman_next[:result] == 'passed' || repoman_next[:result] == 'partial' - packages << [package, build_current, build_next, repoman_current, repoman_next] - end + packages << [package, build_current, build_next, repoman_current, repoman_next] end packages = packages.compact.sort_by { |package| package[0][:identifier] } erb :new_targets, locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } -- cgit v1.2.3-65-gdbad