diff options
Diffstat (limited to 'autobuild/results.php')
-rw-r--r-- | autobuild/results.php | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/autobuild/results.php b/autobuild/results.php index e3ab4d1..9a81622 100644 --- a/autobuild/results.php +++ b/autobuild/results.php @@ -40,6 +40,7 @@ foreach ($runs as $r) { } $prev = $r; } +$runepoc = strtotime($run); $packages = Array(); if ($handle = opendir('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/')) { @@ -192,10 +193,15 @@ function is_flaky($history) { return $num_change >= 4; } -function get_build_history($package) { +function get_package_id($package) { + global $db; + return $db->querySingle("SELECT Id FROM Packages WHERE Name = '$package'"); +} + +function get_build_history($package_id) { global $db; - $package_id = $db->querySingle("SELECT Id FROM Packages WHERE Name = '$package'"); if ($package_id) { + # TODO: optimize by retrieving Runs.Id once at the start $result = $db->query("SELECT ResultValues.Name FROM Runs, Results, ResultValues WHERE Runs.Id = Results.Run AND Results.Result = ResultValues.Id AND Results.Package = '$package_id' ORDER BY Start DESC LIMIT 10"); if ($result) { $build_stats = Array(); @@ -208,6 +214,15 @@ function get_build_history($package) { return false; } +function get_package_attributes($package_id) { + global $db, $runepoc; + if ($package_id) { + # TODO: optimize by retrieving Runs.Id once at the start + $attributes = $db->querySingle("SELECT Attr FROM Attributes, Runs WHERE Runs.Id = Attributes.Run AND Runs.Start = $runepoc AND Attributes.Package = '$package_id';"); + } + return $attributes; +} + echo "<form><select name='run' onChange='document.location.href=\"".$_SERVER["PHP_SELF"]."?run=\"+this.form.run.value'>"; foreach ($runs as $r) { $in_progress = ($r > $latest) ? ' (in progress)' : ''; @@ -234,15 +249,34 @@ foreach ($failure as $rpm => $error) { if (file_exists("icons/error-$error.png")) { $error_html = "<img src='icons/error-$error.png' title='$error'/>"; } - $history = get_build_history($parsed['package']); + $packageid = get_package_id($parsed['package']); + $history = get_build_history($packageid); if (is_flaky($history)) { $history_link = $history_link . " <img src='icons/warning-flaky.png' title='Flaky build' />"; } + $language_link = ""; + if (!$fixed[$rpm]) { + $attributes = get_package_attributes($packageid); + if ($attributes) { + # Attributes are space separated words of the form "lang_php" + foreach (explode(" ", $attributes) as $attr) { + $attrname = ucfirst(explode("_", $attr)[1]); + $icon_fn = "icons/" . str_replace("_", "-", $attr) . ".png"; + if (file_exists($icon_fn)) { + $language_link = $language_link . " <img src='$icon_fn' " . + "title='$attrname dependency' />"; + } else { + $language_link = $language_link . " [$attrname dep]"; + } + } + } + } if (file_exists("$base_dir/$rpm/")) { - echo "<li>$error_html <a href='$base_dir/$rpm/'>$rpm</a> $status_html $history_link</li>\n"; + echo "<li>$error_html <a href='$base_dir/$rpm/'>$rpm</a>"; } else { - echo "<li>$error_html $rpm $status_html $history_link</li>\n"; + echo "<li>$error_html $rpm"; } + echo " $status_html $history_link$language_link</li>\n"; } $db->close(); ?> |