summaryrefslogtreecommitdiffstats
path: root/non-mandatory.php
diff options
context:
space:
mode:
Diffstat (limited to 'non-mandatory.php')
-rw-r--r--non-mandatory.php87
1 files changed, 87 insertions, 0 deletions
diff --git a/non-mandatory.php b/non-mandatory.php
new file mode 100644
index 0000000..c7f3654
--- /dev/null
+++ b/non-mandatory.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Mageia build-system quick status report script.
+ *
+ * @copyright Copyright (C) 2011 Mageia.Org
+ *
+ * @author Olivier Blin
+ * @author Pascal Terjan
+ * @author Romain d'Alverny
+ * @author Michael Scherer
+ *
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License aspublished by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * Shows packages uploaded on mandatory arches but failed on some other.
+ * Packages that are not current are ignored.
+*/
+
+error_reporting(E_ALL);
+
+require __DIR__ . '/conf.php';
+require __DIR__ . '/lib.php';
+
+// sanity checks
+if (!is_dir($upload_dir)) {
+ $msg = "$upload_dir does not exist on this system. Please check your config.";
+ error_log($msg);
+ die($msg);
+}
+
+
+function get_srpm_path($distrib, $media, $section, $package) {
+ $mirror_base = "/distrib/bootstrap/distrib";
+ return "$mirror_base/$distrib/SRPMS/$media/$section/$package.src.rpm";
+}
+
+$matches = get_submitted_packages($upload_dir, 30);
+
+list($pkgs, $hosts, $build_count, $build_dates, $buildtime_total) = get_refined_packages_list($matches, null, null, $mandatory_arches);
+list($stats, $users, $total, $pkgs) = build_stats($pkgs);
+
+echo "<table>\n";
+ foreach ($pkgs as $key => $p) {
+ if (trim($p['package']) == '') {
+ continue;
+ }
+ if ($p['type'] != 'uploaded') {
+ continue;
+ }
+ $failed_arches = array_keys($p['status']['fail']);
+ if (empty($failed_arches)) {
+ continue;
+ }
+ if(!file_exists(get_srpm_path($p['version'], $p['media'], $p['section'], $p['package']))) {
+ continue;
+ }
+ echo '<tr><td>' . $p['package'] . '</td>';
+ $status_file = $upload_dir . '/failure/' . $p['path'] . '/log/status.log';
+ $status_line = trim(preg_replace('/.*: /', '', file_get_contents($status_file)));
+ if ($status_line == 'missing_dep') {
+ $install_deps_files = glob($upload_dir . '/failure/' . $p['path'] . '/log/' . $p['package'] . '/install_deps*.log');
+ $f = fopen($install_deps_files[0], "r");
+ $dep_line = "";
+ while(($line = fgets($f, 4096)) !== false) {
+ if(preg_match('/due to unsatisfied (.*)\)/', $line, $matches) == 1) {
+ $dep_line = $matches[1];
+ }
+ }
+ fclose($f);
+ $link = '/uploads/failure/' . $p['path'] . '/log/' . $p['package'] . '/' . basename($install_deps_files[0]);
+ echo '<td><a rel="nofollow" href="' . $link . '">' . $status_line . '</a> ' . $dep_line . '</td>';
+ } elseif ($status_line == 'recreate_srpm_failure') {
+ $botcmd_files = glob($upload_dir . '/failure/' . $p['path'] . '/log/botcmd.*.log');
+ $link = '/uploads/failure/' . $p['path'] . '/log/' . basename($botcmd_files[0]);
+ echo '<td><a rel="nofollow" href="' . $link . '">' . $status_line . '</a></td>';
+ } else {
+ $link = '/uploads/failure/' . $p['path'] . '/log/' . $p['package'];
+ echo '<td><a rel="nofollow" href="' . $link . '">' . $status_line . '</a></td>';
+ }
+ echo "</tr>\n";
+ }
+echo "</table>\n";
+?>