<?php
+if (!function_exists("ob_gzhandler"))
+ die("ob_gzhandler function is missing - install php zlib module");
+
ob_start("ob_gzhandler", 1);
$buildlogs_server = "buildlogs.pld-linux.org";
$url = "index.php";
$langs["pl_PL"]["charset"]="ISO-8859-2";
$lang="en_US";
+$lang_detected="";
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]))
{
$rows=explode(";",$_SERVER["HTTP_ACCEPT_LANGUAGE"]);
bindtextdomain("messages","locale");
textdomain("messages");
+$dist = "";
+$arch = "";
if (isset($_GET["dist"]) && isset($_GET["arch"]))
{
$dist = basename($_GET["dist"]);
.error {
background-color: #b00;
}
+.verbose {
+ color: #886;
+}
+.section {
+ color: #111;
+ background-color: #161;
+}
+.changelog a {
+ color: #fff;
+}
//-->
</style>
</head>
function start_pre()
{
echo "<table cellpadding=\"10\"><tr><td bgcolor=\"#000000\">".
- "<font color=\"#cccccc\"><pre style=\"width: 2048px;overflow: scroll\">";
+ "<font color=\"#cccccc\"><pre style=\"white-space: pre-line; word-break: break-all;\">";
}
function end_pre()
$df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
$df = preg_replace("/\.(bz2|gz)$/", "", $df);
+ list($name, $id) = explode(',', $df);
- echo "<h1>$df</h1>";
+ if ($name != 'command') {
+ $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary";
+ $name = "<a href=\"$gitweb_url\">$name</a>";
+ }
+ echo "<h1>$name <small>$id</small></h1>";
- echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\">";
+ echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#000000\" width=\"100%\">";
function one_item($h, $t) {
echo "<tr><td bgcolor=\"#ccccff\">$h:</td>".
getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
"</td></tr>"; */
- echo "</table><h2>"._("Content:")."</h2>";
# what can I say beside PHP suxx? how the fuck should I create
}
$cmd = "$filter '$root_directory/$f'";
- if ($tail)
- $cmd = "$cmd | tail -n 100";
$fd = popen($cmd, "r");
- start_pre();
+ $toc = array();
+ $err = array();
+ $first_cut = false;
+ $first_cut_done = false;
+ $time = "";
+ $out_buf = array();
+ $out_buf_size = 0;
+ $err_count = 0;
while (($s = fgets($fd, 102400)) != false) {
- if (strlen($s) > 800) {
- $s = chunk_split($s, 800, "\n ");
- $s = trim($s);
- }
+
+ $toc_elem = false;
+ $err_elem = false;
+
$s = htmlspecialchars($s);
// highlight errors
- if (preg_match("/errors?:/i", $s)) {
- $s = "<span class=error>$s</span>";
+ if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
+ $first_cut = true;
+ $err_count++;
+ $toc_elem = "error $err_count";
+ $err_elem = $s;
+ $s = "<span class=error id=error-$err_count>$s</span>";
+ } elseif (preg_match("/(?:undefined reference to|recipe for target '.*?' failed)/i", $s)) {
+ $first_cut = true;
+ $err_count++;
+ $toc_elem = "error $err_count";
+ $err_elem = $s;
+ $s = "<span class=error id=error-$err_count>$s</span>";
+ } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?P<target>check)\b#", $s, $m)) {
+ // rpm build section
+ $toc_elem = "make {$m['target']}";
+ $err_elem = $s;
+ $s = "<span class=line id=make-{$m['target']}>$s</span>";
+ } elseif (preg_match('/^(?P<line>- For complete changelog see:) (?P<link>.+)$/', $s, $m)) {
+ // rpm changelog link
+ $link = "<a href=\"{$m['link']}\">{$m['link']}</a>";
+ $s = "<span class=changelog>{$m['line']} $link<br/></span>";
+ } elseif (preg_match('/^(?P<line>\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P<hash>[a-z0-9]{7})$/', $s, $m)) {
+ // rpm changelogs
+ $url = "http://git.pld-linux.org/?p=packages/{$name_url}.git;a=commitdiff;h={$m['hash']}";
+ $link = "<a href=\"$url\">{$m['hash']}</a>";
+ $s = "<span class=changelog>{$m['line']} $link<br/></span>";
+ } elseif (substr($s, 0, 2) == "+ ") {
+ // shell verbose
+ $s = "<span class=verbose>$s</span>";
+ } elseif (preg_match("/^Executing\(%(?P<section>\w+)\)/", $s, $m)) {
+ // rpm build section
+ $toc_elem = $m['section'];
+ $err_elem = $s;
+ $s = "<span class=section id={$m['section']}>$s</span>";
+ } elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
+ $first_cut = true;
+ // processing files
+ $toc_elem = "files ".$m['name'];
+ $err_elem = $s;
+ $s = "<span class=section id=files-{$m['name']}>$s</span>";
+ } elseif (preg_match("/^ended at: (?P<date>.+), done in (?P<time>[\d:.]+)/", $s, $m)) {
+ $time = $m['time'];
+ }
+
+ $out_buf[] = $s;
+ $out_buf_size++;
+
+ // if error/processing found truncate early but keep last 100 lines before error
+ if ($tail && $first_cut && !$first_cut_done && $out_buf_size > 100) {
+ array_splice($out_buf, 0, $out_buf_size - 100);
+ $out_buf_size = 100;
+ $first_cut_done = true;
+ }
+
+ // if (not in tail mode) or (in tail mode but we have an error)
+ if (!$tail || $first_cut) {
+ if ($toc_elem)
+ $toc[] = $toc_elem;
+ if ($err_elem)
+ $err[] = $err_elem;
}
- echo $s;
}
- end_pre();
pclose($fd);
+ // no errors found, no processing found but we are in tail mode
+ if ($tail && !$first_cut_done && $out_buf_size > 100) {
+ array_splice($out_buf, 0, $out_buf_size - 100);
+ $out_buf_size = 100;
+ }
+
+ $code = join('', $out_buf);
+
+ if ($time) {
+ one_item(_("Runtime"), $time);
+ }
+
+ echo "</table>";
+
+ if (!empty($toc)) {
+ echo "<h2>"._("Toc:")."</h2>";
+ echo "<ul class=toc>";
+ foreach ($toc as $i => $section) {
+ $id = str_replace(" ", "-", $section);
+ echo "<li><a href=#{$id}>{$section}</a></li>";
+ echo "<code>{$err[$i]}</code>";
+ }
+ echo "</ul>";
+ }
+
+ echo "<h2>"._("Content:")."</h2>";
+
+ start_pre();
+ echo $code;
+ end_pre();
+
?>
<table width="100%">
<tr>
date("Y/m/d H:i:s", filemtime("$root_directory/$f")) . "\n";
if (preg_match("/\.bz2$/", $f)) {
- $filter = "bzcat";
+ if (is_executable("/usr/bin/lbzcat"))
+ $filter = "lbzcat";
+ else
+ $filter = "bzcat";
} elseif (preg_match("/\.gz$/", $f)) {
$filter = "zcat";
} else {
echo "<table width=\"100%\" border=\"0\">\n";
echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
- foreach ($addr as $dist => $ddist) {
- foreach ($ddist as $arch) {
- echo "<tr><td nowrap=\"nowrap\">".
- "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
- $dist/$arch</a></td><td nowrap=\"nowrap\">".
- "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
- #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
- "</tr>\n";
- }
- }
+ foreach ($addr as $dist => $ddist) {
+ echo "<tr><td colspan=2 nowrap=\"nowrap\"><hr/></td></tr>\n";
+ foreach ($ddist as $arch) {
+ echo "<tr><td nowrap=\"nowrap\">".
+ "<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
+ $dist/$arch</a></td><td nowrap=\"nowrap\">".
+ "[<a href=\"$url?dist=$dist&arch=$arch&ok=1&cnt=$cnt\">OK</a>]</td>".
+ #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
+ "</tr>\n";
+ }
+ }
echo "</table><hr />\n";
echo "<div align=\"center\">";
echo "<a href=\"$url\">main()</a><hr />\n";
echo "<a href=\"http://www.pld-linux.org/\"><img src=\"powpld.png\" ".
- "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
- "<small>(c) 2002 ".
+ "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
+ "<small>(c) 2002-". date("Y") . " ".
"<a href=\"mailto:feedback@pld-linux.org\">PLD Team</a><br />\n".
- '$Revision: 1.15 $'.
+ '$Revision: 1.37 $'.
"</small></div>\n";
# smile ;)
if (!isset($dist) || !isset($arch))
return false;
- if($dist!='ti'){
- $addr = "http://ftp.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
- }else{
- $addr = "http://ftp.pld-linux.org/branches/titanium/.stat/builder/$dist/rpmqa-$arch.txt";
- }
+ $addr = "http://ftp1.pld-linux.org/dists/$dist/.stat/builder/$dist/rpmqa-$arch.txt";
return fopen("$addr", "r");
}
echo _("Sorry, cannot open.");
} else {
while (($s = fgets($f, 1000)) != false) {
+ if (stristr($s, "Query done at:")) {
+ echo "rpmqa database from " . strstr($s, ":") . "\n";
+ continue;
+ }
+
if (stristr($s, $str))
echo $s;
}
- echo "/* EOF */";
+ echo "\n/* EOF */";
}
end_pre();
}
<?=_("Feel free to email bug reports, complaints and feature requests ")?>
<!-- ech... niech strace... -->
<a href="mailto:feedback@pld-linux.org"><?=_("to us")?></a>. <?=_("Positive opinions are also")?>
-<a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
-<p>Version: $Id: index.php,v 1.15 2012/02/08 13:25:08 glen Exp $</p>
+ <a href="mailto:feedback@pld-linux.org"><?=_("welcome")?></a> ;)</p>
</td><td width="20%"> </td></tr>
</table>
<?php