From 070566880dbb45f4ec65c81abf03b8e4f3e178b8 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Tue, 22 Jan 2013 11:08:04 +0000 Subject: Add build history of packages --- autobuild/history.php | 25 +++++++++++++++++++++++++ autobuild/results.php | 35 +++++++++++++++++++++++------------ 2 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 autobuild/history.php diff --git a/autobuild/history.php b/autobuild/history.php new file mode 100644 index 0000000..a9ac27b --- /dev/null +++ b/autobuild/history.php @@ -0,0 +1,25 @@ +querySingle("SELECT Id FROM Packages WHERE Name = '$package'"); +if (!$package_id) { + die("Invalid package"); +} +echo "

History of package \"$package\"

\n"; +$result = $db->query("SELECT date(datetime(Start, 'unixepoch')) as run, 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"); +while ($entry = $result->fetchArray(SQLITE3_ASSOC)) { + $run = $entry['run']; + $build_result = $entry['Name']; + echo "$run "; + $base_dir = "cauldron/x86_64/core/$run"; + if ($link = glob("$base_dir/$package-*.src.rpm/")) { + echo "$build_result
\n"; + } else { + echo "$build_result
\n"; + } +} + +?> diff --git a/autobuild/results.php b/autobuild/results.php index c3dd5db..d7f0660 100644 --- a/autobuild/results.php +++ b/autobuild/results.php @@ -2,6 +2,14 @@ $matches[1], 'version' => $matches[2]); + } else { + return false; + } +} + $runs = Array(); $handle = opendir('cauldron/x86_64/core/'); while (false !== ($entry = readdir($handle))) { @@ -28,8 +36,8 @@ foreach ($runs as $r) { $packages = Array(); if ($handle = opendir('/distrib/bootstrap/distrib/cauldron/SRPMS/core/release/')) { while (false !== ($entry = readdir($handle))) { - if (preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $entry, $matches)) { - $packages[$matches[1]] = $entry; + if ($parsed = parse_package($entry)) { + $packages[$parsed['package']] = $entry; } } closedir($handle); @@ -42,11 +50,11 @@ if ($prev) { $status_file = fopen($status_name, "r"); while (!feof($status_file)) { $line = fgets($status_file); - if (preg_match("/^(.*)-[^-]*-[^-]*mga[1-9].src.rpm: (.*)$/", $line, $matches)) { - $rpm = $matches[1]; + if (preg_match("/^(.*): (.*)$/", $line, $matches)) { + $rpm = parse_package($matches[1]); $status = $matches[2]; if ($status != "ok" && $status != "unknown" && $status != "not_on_this_arch") { - $prev_failure[$rpm] = 1; + $prev_failure[$rpm['package']] = 1; } } } @@ -78,9 +86,8 @@ while (!feof($status_file)) { array_push($success, $rpm); } elseif ($status != "unknown" && $status != "not_on_this_arch"){ $failure[$rpm] = $status; - preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $rpm, $matches); - $package = $matches[1]; - $version = $matches[2]; + $parsed = parse_package($rpm); + $package = $parsed['package']; if(!$prev_failure[$package]) { $broken[$rpm] = 1; } @@ -125,6 +132,8 @@ echo "$nb_fixed packages have been fixed since this run and $nb_removed have bee echo "

Failed builds ($nb_failed/$nb_tried):

Successful builds ($nb_success/$nb_tried):