buildlogs: index.php Simplify.
arekm
arekm at pld-linux.org
Wed Oct 15 10:37:43 CEST 2014
Author: arekm Date: Wed Oct 15 08:37:43 2014 GMT
Module: buildlogs Tag: HEAD
---- Log message:
Simplify.
---- Files affected:
buildlogs:
index.php (1.30 -> 1.31)
---- Diffs:
================================================================
Index: buildlogs/index.php
diff -u buildlogs/index.php:1.30 buildlogs/index.php:1.31
--- buildlogs/index.php:1.30 Tue Oct 14 13:03:42 2014
+++ buildlogs/index.php Wed Oct 15 10:37:38 2014
@@ -351,11 +351,10 @@
$cmd = "$filter '$root_directory/$f'";
$fd = popen($cmd, "r");
- $line_idx = 0;
- $processing_idx = 0;
$toc = array();
$err = array();
- $err_count = 0;
+ $first_cut = false;
+ $first_cut_done = false;
$time = "";
$out_buf = array();
$out_buf_size = 0;
@@ -372,11 +371,13 @@
$s = htmlspecialchars($s);
// highlight errors
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)/i", $s)) {
+ $first_cut = true;
$err_count++;
$toc_elem = "error $err_count";
$err_elem = $s;
@@ -395,7 +396,7 @@
$err_elem = $s;
$s = "<span class=section id={$m['section']}>$s</span>";
} elseif (preg_match("/^Processing files: (?P<pkg>(?P<name>.+)-[^-]+-[^-]+)/", $s, $m)) {
- $processing_idx = $line_idx;
+ $first_cut = true;
// processing files
$toc_elem = "files ".$m['name'];
$err_elem = $s;
@@ -404,29 +405,28 @@
$time = $m['time'];
}
- $out_buf[$line_idx] = $s;
+ $out_buf[] = $s;
$out_buf_size++;
// if error/processing found truncate early but keep last 100 lines before error
- if ($tail && ($err_count == 1 || ($err_count == 0 && $processing_idx == $line_idx)) && $out_buf_size > 100) {
+ 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 || $err_count || $processing_idx) {
+ if (!$tail || $first_cut) {
if ($toc_elem)
$toc[] = $toc_elem;
if ($err_elem)
$err[] = $err_elem;
}
-
- $line_idx++;
}
pclose($fd);
// no errors found, no processing found but we are in tail mode
- if ($tail && $err_count == 0 && $processing_idx == 0 && $out_buf_size > 100) {
+ if ($tail && !$first_cut_done && $out_buf_size > 100) {
array_splice($out_buf, 0, $out_buf_size - 100);
$out_buf_size = 100;
}
@@ -531,8 +531,8 @@
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) ". date("Y") . " ".
+ "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
+ "<small>(c) ". date("Y") . " ".
"<a href=\"mailto:feedback at pld-linux.org\">PLD Team</a><br />\n".
'$Revision$'.
"</small></div>\n";
@@ -608,7 +608,7 @@
while (($s = fgets($f, 1000)) != false) {
if (stristr($s, "Query done at:")) {
echo "rpmqa database from " . strstr($s, ":") . "\n";
- continue;
+ continue;
}
if (stristr($s, $str))
================================================================
---- CVS-web:
http://cvs.pld-linux.org/buildlogs/index.php?r1=1.30&r2=1.31
More information about the pld-cvs-commit
mailing list