From 7447ea0fc35282e656aa64806857299b1d55f6b3 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sat, 20 Aug 2022 09:48:54 +0000 Subject: Allow filtering on attributes in autobuild results --- autobuild/results.php | 73 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 4 deletions(-) (limited to 'autobuild') 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 "

$title

\n"; echo "
\n"; +} +$all_attrs = get_all_attributes(); +$filters = Array(); +foreach ($all_attrs as $attr_type => $attrs) { + echo "$attr_type: "; + $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 "$attr\n"; + } + echo "
\n"; +} +echo "\n"; +echo "
"; echo "

Failed builds ($nb_failed/$nb_tried)

\n"; echo "\n"; echo "\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 $attrname"; - } 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 ""; if (file_exists("$base_dir/$rpm/")) { -- cgit v1.2.1
StatusFailure typeBuild stepLanguagesDetected errors