From b2717138511a79ede4384438936e0fbb670d4ad2 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 3 Nov 2015 01:27:33 +0100 Subject: Detect failures for mandatory arches only using .fail files Previously, we just used the failures directory to check if any failure had happened for the submit prefix. But this does not work properly when non-mandatory architectures are used, their failure should not be fatal. Instead, use .fail files and mark as a failure only if failed for one of the mandatory architectures. --- lib.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib.php b/lib.php index 403b6c9..7d89e41 100644 --- a/lib.php +++ b/lib.php @@ -32,8 +32,8 @@ function get_submitted_packages($upload_dir, $max_modified) chdir($upload_dir); $matches = array(); - $all_files = shell_exec("find \( -name '*.rpm' -o -name '*.src.rpm.info' -o -name '*.lock' -o -name '*.done' -o -name '*.upload' \) -ctime -$max_modified -printf \"%p\t%T@\\n\""); - $re = "!^\./(\w+)/((\w+)/(\w+)/(\w+)/(\d+)\.(\w+)\.(\w+)\.(\d+))_?(.*)(\.src\.rpm(?:\.info)?|\.lock|\.done|\.upload)\s+(\d+\.\d+)$!m"; + $all_files = shell_exec("find \( -name '*.rpm' -o -name '*.src.rpm.info' -o -name '*.lock' -o -name '*.done' -o -name '*.upload' -o -name '*.fail' \) -ctime -$max_modified -printf \"%p\t%T@\\n\""); + $re = "!^\./(\w+)/((\w+)/(\w+)/(\w+)/(\d+)\.(\w+)\.(\w+)\.(\d+))_?(.*)(\.src\.rpm(?:\.info)?|\.lock|\.done|\.upload|\.fail)\s+(\d+\.\d+)$!m"; $r = preg_match_all($re, $all_files, $matches, @@ -83,13 +83,15 @@ function get_refined_packages_list($list_of_files, $package = null, $user = null 'package' => '' ); } - $status = $val[1]; + if ($val[1] != 'failure') { + // failures are detected with .fail files + $status = $val[1]; + } $data = $val[10]; if (preg_match("/@(\d+):/", $data, $revision)) { $pkgs[$key]['revision'] = $revision[1]; } - $pkgs[$key]['status'][$status] = 1; $ext = $val[11]; if ($ext == '.src.rpm.info') { @@ -125,7 +127,18 @@ function get_refined_packages_list($list_of_files, $package = null, $user = null if ($pkgs[$key]['buildtime']['diff'] < 43200) { $buildtime_total[$key] = $pkgs[$key]['buildtime']['diff']; } + } else if ($ext == '.fail') { + $arch = $data; + if (!$pkgs[$key]['status']['fail']) { + $pkgs[$key]['status']['fail'] = array(); + } + $pkgs[$key]['status']['fail'][$arch] = 1; + if (in_array($arch, $mandatory_arches)) { + $status = 'failure'; + } } + + $pkgs[$key]['status'][$status] = 1; } // filter packages if a package name was provided -- cgit v1.2.1