]> git.pld-linux.org Git - projects/buildlogs.git/commitdiff
- hiliting for shell debug, rpmbuild sections; add toc for rpm build sections
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 21 Mar 2012 01:29:44 +0000 (01:29 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 21 Mar 2012 01:29:44 +0000 (01:29 +0000)
buildlogs.inc
index.php

index ce5fcb0a5d1ca8ba14c76f3bfa9ff5dc6ce648d9..273c544521a86a5720acdaf4b94814a7b40a378f 100644 (file)
@@ -5,8 +5,6 @@ $root_directory = "/home/services/ftp/pub/pld-buildlogs";
 $addr = array(
        "ac" => array("SRPMS", "i386", "i586", "i686", "alpha", "amd64", "athlon",
                "ppc", "sparc", "sparc64"),
-       "th" => array("SRPMS", "i486", "i686", "alpha", "athlon", "ppc", "x86_64"),
-       "ti" => array("SRPMS", "i586", "i686", "x86_64"),
-       "ti-dev" => array("SRPMS", "i586", "i686", "x86_64")
+       "th" => array("SRPMS", "i486", "i686", "alpha", "athlon", "ppc", "x86_64")
 );
 ?>
index 8a688a2d9184a192190494499d76b0506850c189..74bb00bc54be36b2a783467fd6eb8a0a9880f650 100644 (file)
--- a/index.php
+++ b/index.php
@@ -103,6 +103,13 @@ TH { font-family: arial,helvetica,sans-serif;
 .error {
        background-color: #b00;
 }
+.verbose {
+       color: #886;
+}
+.section {
+       color: #111;
+       background-color: #161;
+}
 //-->
 </style>
  </head>
@@ -329,7 +336,7 @@ function dump_log($tail)
                getenv("SCRIPT_NAME") . "?idx=$idx&amp;ok=$ok&amp;id=$id</a>" .
             "</td></tr>"; */
 
-       echo "</table><h2>"._("Content:")."</h2>";
+       echo "</table>";
 
 
        # what can I say beside PHP suxx? how the fuck should I create
@@ -347,7 +354,8 @@ function dump_log($tail)
        if ($tail)
                $cmd = "$cmd | tail -n 100";
        $fd = popen($cmd, "r");
-       start_pre();
+       $toc = array();
+       ob_start();
        while (($s = fgets($fd, 102400)) != false) {
                if (strlen($s) > 800) {
                        $s = chunk_split($s, 800, "\n    ");
@@ -357,11 +365,34 @@ function dump_log($tail)
                // highlight errors
                if (preg_match("/errors?:/i", $s)) {
                        $s = "<span class=error>$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
+                       $s = "<span class=section id={$m['section']}>$s</span>";
+                       $toc[] = $m['section'];
                }
                echo $s;
        }
-       end_pre();
        pclose($fd);
+       $code = ob_get_contents();
+       ob_end_clean();
+
+       if (!empty($toc)) {
+               echo "<h2>"._("Toc:")."</h2>";
+               echo "<ul class=toc>";
+               foreach ($toc as $section) {
+                       echo "<li><a href=#{$section}>{$section}</a></li>";
+               }
+               echo "</ul>";
+       }
+
+       echo "<h2>"._("Content:")."</h2>";
+
+       start_pre();
+       echo $code;
+       end_pre();
 
 ?>
        <table width="100%">
@@ -441,7 +472,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.15 $'.
+            '$Revision: 1.16 $'.
             "</small></div>\n";
 
        # smile ;)
@@ -814,7 +845,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.15 2012/02/08 13:25:08 glen Exp $</p>
+<p>Version: $Id: index.php,v 1.16 2012/02/08 21:03:01 glen Exp $</p>
 </td><td width="20%">&nbsp;</td></tr>
 </table>
 <?php
This page took 0.08361 seconds and 4 git commands to generate.