diff options
author | Pascal Terjan <pterjan@mageia.org> | 2013-01-22 11:08:04 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2013-01-22 11:08:04 +0000 |
commit | 070566880dbb45f4ec65c81abf03b8e4f3e178b8 (patch) | |
tree | 95841ae2ab8878d6b6615cb0effd178e964f91cd | |
parent | 07e729219263055c87998bcea29f5fe6f27299d7 (diff) | |
download | pkgsubmit-070566880dbb45f4ec65c81abf03b8e4f3e178b8.tar pkgsubmit-070566880dbb45f4ec65c81abf03b8e4f3e178b8.tar.gz pkgsubmit-070566880dbb45f4ec65c81abf03b8e4f3e178b8.tar.bz2 pkgsubmit-070566880dbb45f4ec65c81abf03b8e4f3e178b8.tar.xz pkgsubmit-070566880dbb45f4ec65c81abf03b8e4f3e178b8.zip |
Add build history of packages
-rw-r--r-- | autobuild/history.php | 25 | ||||
-rw-r--r-- | autobuild/results.php | 35 |
2 files changed, 48 insertions, 12 deletions
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 @@ +<?php +$package=preg_replace('/[^[:alnum:]_.+-]/', '', $_GET['package']); +if (!$package) { + die("Invalid package"); +} +$db = new SQLite3('autobuild.db'); +$package_id = $db->querySingle("SELECT Id FROM Packages WHERE Name = '$package'"); +if (!$package_id) { + die("Invalid package"); +} +echo "<h1>History of package \"$package\"</h1>\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 "<a href='results.php?run=$run' >$run</a> "; + $base_dir = "cauldron/x86_64/core/$run"; + if ($link = glob("$base_dir/$package-*.src.rpm/")) { + echo "<a href='$link[0]'>$build_result</a><br/>\n"; + } else { + echo "$build_result<br/>\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 @@ <head> <?php +function parse_package($rpm) { + if (preg_match("/(.*)-([^-]*-[^-]*mga)[1-9].src.rpm/", $rpm, $matches)) { + return Array('package' => $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 "<div style='float:left'><h1>Failed builds ($nb_failed/$nb_tried):</h1><ul style='list-style:none;'>"; foreach ($failure as $rpm => $error) { + $parsed = parse_package($rpm); + $history_link = '<a href="history.php?package='.$parsed['package'].'">[h]</a>'; $status_html = ""; if ($fixed[$rpm]) { $status_html = " <img src='icons/state-fixed.png' title='Fixed!' />"; @@ -138,19 +147,21 @@ foreach ($failure as $rpm => $error) { $error_html = "<img src='icons/error-$error.png' title='$error'/>"; } if (file_exists("$base_dir/$rpm/")) { - echo "<li>$error_html <a href='$base_dir/$rpm/'>$rpm</a> $status_html</li>\n"; + echo "<li>$error_html <a href='$base_dir/$rpm/'>$rpm</a> $status_html $history_link</li>\n"; } else { - echo "<li>$error_html $rpm $status_html</li>\n"; + echo "<li>$error_html $rpm $status_html $history_link</li>\n"; } } echo "</ul></div><div style='float:right'><h1>Successful builds ($nb_success/$nb_tried):</h1><ul>"; foreach ($success as $rpm) { + $parsed = parse_package($rpm); + $history_link = '<a href="history.php?package='.$parsed['package'].'">[h]</a>'; if (file_exists("$base_dir/$rpm/")) { - echo "<li><a href='$base_dir/$rpm/'>$rpm</a></li>\n"; + echo "<li><a href='$base_dir/$rpm/'>$rpm</a> $history_link</li>\n"; } else { - echo "<li>$rpm</li>\n"; + echo "<li>$rpm $history_link</li>\n"; } } |