]> git.pld-linux.org Git - projects/buildlogs.git/commitdiff
Tail more is no more 100 last lines. It is not 'from the first error until the end...
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 12 Oct 2014 21:27:06 +0000 (21:27 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 12 Oct 2014 21:27:06 +0000 (21:27 +0000)
index.php

index 0669f98eb771288b1f3f2534c681910b08bb6c5b..e469582475f2150a7172eebf5e7c2bc18f4230b1 100644 (file)
--- a/index.php
+++ b/index.php
@@ -350,51 +350,67 @@ function dump_log($tail)
        }
 
        $cmd = "$filter '$root_directory/$f'";
-       if ($tail)
-               $cmd = "$cmd | tail -n 100";
        $fd = popen($cmd, "r");
        $toc = array();
-       ob_start();
+       $err = array();
        $err_count = 0;
        $time = "";
+       $out_buf = array();
        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("/(?:fail|error(s|\sCS\d+)?):/i", $s)) {
                        $err_count++;
-                       $toc[] = "error $err_count";
-                       $err[] = $s;
+                       $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)) {
+                       $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[] = "make {$m['target']}";
-                       $err[] = $s;
+                       $toc_elem = "make {$m['target']}";
+                       $err_elem = $s;
                        $s = "<span class=line id=make-{$m['target']}>$s</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[] = $m['section'];
-                       $err[] = $s;
+                       $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)) {
                        // processing files
-                       $toc[] = "files ".$m['name'];
-                       $err[] = $s;
+                       $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'];
                }
-               echo $s;
+
+               // if (not in tail mode) or (in tail mode but we have an error)
+               if ($err_count || !$tail) {
+                       if ($toc_elem)
+                               $toc[] = $toc_elem;
+                       if ($err_elem)
+                               $err[] = $err_elem;
+                       $out_buf[] = $s;
+               }
        }
        pclose($fd);
-       $code = ob_get_contents();
-       ob_end_clean();
+
+       $code = join(' ', $out_buf);
 
        if ($time) {
                one_item(_("Runtime"), $time);
@@ -497,7 +513,7 @@ function list_archs()
                "alt=\""._("Powered by PLD Linux")."\" border=\"0\" /></a><br />\n" .
             "<small>(c) 2002 ".
             "<a href=\"mailto:feedback@pld-linux.org\">PLD&nbsp;Team</a><br />\n".
-            '$Revision: 1.24 $'.
+            '$Revision: 1.23 $'.
             "</small></div>\n";
 
        # smile ;)
@@ -866,7 +882,7 @@ function welcome()
 <!-- 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.24 2013/09/08 13:23:20 glen Exp $</p>
+<p>Version: $Id: index.php,v 1.23 2013/09/07 21:18:46 glen Exp $</p>
 </td><td width="20%">&nbsp;</td></tr>
 </table>
 <?php
This page took 0.037624 seconds and 4 git commands to generate.