diff options
author | Pascal Terjan <pterjan@mageia.org> | 2022-08-20 09:48:54 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2022-08-20 09:48:54 +0000 |
commit | 7447ea0fc35282e656aa64806857299b1d55f6b3 (patch) | |
tree | 8b50f4410170a94771f880b6505a9576bcb64072 | |
parent | 8d38cd12fea3fa02b68972cb933c95c097e1890a (diff) | |
download | pkgsubmit-7447ea0fc35282e656aa64806857299b1d55f6b3.tar pkgsubmit-7447ea0fc35282e656aa64806857299b1d55f6b3.tar.gz pkgsubmit-7447ea0fc35282e656aa64806857299b1d55f6b3.tar.bz2 pkgsubmit-7447ea0fc35282e656aa64806857299b1d55f6b3.tar.xz pkgsubmit-7447ea0fc35282e656aa64806857299b1d55f6b3.zip |
Allow filtering on attributes in autobuild results
-rw-r--r-- | autobuild/results.php | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/autobuild/results.php b/autobuild/results.php index bef781b..11bbd59 100644 --- a/autobuild/results.php +++ b/autobuild/results.php @@ -230,6 +230,32 @@ function get_package_attributes($package_id) { return $attributes; } +function get_all_attributes() { + global $db, $runepoc; + $attributes = Array(); + $attr_types = Array(); + $result = $db->query("SELECT Attr FROM Attributes, Runs WHERE Runs.Id = Attributes.Run AND Runs.Start = $runepoc;"); + if ($result) { + while ($entry = $result->fetchArray(SQLITE3_ASSOC)) { + foreach (explode(" ", $entry['Attr']) as $attr) { + if ($attr) { + $attributes[$attr] = True; + $attr_types[explode("_", $attr)[0]] = Array(); + } + } + } + foreach (array_keys($attributes) as $attr) { + $parts = explode("_", $attr); + array_push($attr_types[$parts[0]], $parts[1]); + } + foreach ($attr_types as $attr_type => $attrs) { + sort($attr_types[$attr_type]); + } + } + ksort($attr_types); + return $attr_types; +} + echo "<header id=\"mgnavt\"><h1>$title</h1><ul><li>$succes_percent% success</li></ul></header><article>\n"; echo "<form><select name='run' onChange='document.location.href=\"".$_SERVER["PHP_SELF"]."?run=\"+this.form.run.value'>"; foreach ($runs as $r) { @@ -251,6 +277,29 @@ echo "<tr><td>Removed</td><td>$nb_removed</td></tr>\n"; echo "<tr><td>Unchanged</td><td>$nb_still_broken</td></tr>\n"; echo "</table>\n"; echo "<br />If no new package was broken, success rate next time should be $estimated_percent%.\n"; +echo "<h2>Filters</h2>\n"; +echo "<form action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"get\">\n"; +if ($_GET["run"]) { + echo "<input type=\"hidden\" name=\"run\" value=\"" . $_GET["run"] . "\" />\n"; +} +$all_attrs = get_all_attributes(); +$filters = Array(); +foreach ($all_attrs as $attr_type => $attrs) { + echo "<b>$attr_type: </b>"; + $filters[$attr_type] = Array(); + foreach ($attrs as $attr) { + if ($_GET["attr_$attr_type_$attr"]) { + $checked = "checked"; + array_push($filters[$attr_type], $attr); + } else { + $checked=""; + } + echo "<input type=\"checkbox\" $checked name=\"attr_$attr_type_$attr\" value=\"1\">$attr</input>\n"; + } + echo "<br/>\n"; +} +echo "<input type=\"submit\" value=\"Apply\" />\n"; +echo "</form>"; echo "<h2>Failed builds ($nb_failed/$nb_tried)</h2>\n"; echo "<table class=\"failureTable\" >\n"; echo "<tr><th></th><th>Status</th><th>Failure type</th><th>Build step</th><th></th><th>Languages</th><th>Detected errors</th></tr>\n"; @@ -282,12 +331,21 @@ foreach ($failure as $rpm => $error) { # Attributes are space separated words of the form "TYPE_SPECIFIER", e.g., "lang_php" # Types are currently build (use of a particular build system), # lang (use of a programming language) or err (a common build error). + $to_filter = $filters; foreach (explode(" ", $attributes) as $attr) { if (empty($attr)) { continue; } + $attrtype = explode("_", $attr)[0]; $attrname = explode("_", $attr)[1]; - if (substr($attr, 0, 5) === "lang_") { + if ($to_filter[$attrtype]) { + if (in_array($attrname, $filters[$attrtype])) { + # This package matches one of the wanted attributes for this type, + # no need to check further. + $to_filter[$attrtype] = Array(); + } + } + if ($attrtype === "lang") { $lang = ucfirst($attrname); $icon_fn = "icons/" . str_replace("_", "-", $attr) . ".png"; if (file_exists($icon_fn)) { @@ -295,9 +353,10 @@ foreach ($failure as $rpm => $error) { } else { $langs = $langs . " $lang"; } - } elseif (substr($attr, 0, 4) === "err_") { - $errors = "$errors <a href='https://wiki.mageia.org/en/Autobuild_errors#$attrname'>$attrname</a>"; - } elseif (substr($attr, 0, 6) === "stage_") { + } elseif ($attrtype === "err") { + # TODO: create link into wiki with information about these errors + $errors = "$errors $attrname"; + } elseif ($attrtype === "stage") { if ($attrname != 'nobuild') { if ($attrname == 'preprep') { $stage = 'Before %prep'; @@ -307,6 +366,12 @@ foreach ($failure as $rpm => $error) { } } } + # If filters on any type of attribute is not satisfied, skip the package + foreach ($to_filter as $attr_type => $attrs) { + if ($attrs) { + continue 2; + } + } } echo "<tr>"; if (file_exists("$base_dir/$rpm/")) { |