buildlogs: buildlogs.inc, index.php - hiliting for shell debug, rpmbuild se...

glen glen at pld-linux.org
Wed Mar 21 02:29:49 CET 2012


Author: glen                         Date: Wed Mar 21 01:29:49 2012 GMT
Module: buildlogs                     Tag: HEAD
---- Log message:
- hiliting for shell debug, rpmbuild sections; add toc for rpm build sections

---- Files affected:
buildlogs:
   buildlogs.inc (1.6 -> 1.7) , index.php (1.16 -> 1.17) 

---- Diffs:

================================================================
Index: buildlogs/buildlogs.inc
diff -u buildlogs/buildlogs.inc:1.6 buildlogs/buildlogs.inc:1.7
--- buildlogs/buildlogs.inc:1.6	Wed Aug 25 08:44:10 2010
+++ buildlogs/buildlogs.inc	Wed Mar 21 02:29:44 2012
@@ -5,8 +5,6 @@
 $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: buildlogs/index.php
diff -u buildlogs/index.php:1.16 buildlogs/index.php:1.17
--- buildlogs/index.php:1.16	Wed Feb  8 22:03:01 2012
+++ buildlogs/index.php	Wed Mar 21 02:29:44 2012
@@ -103,6 +103,13 @@
 .error {
 	background-color: #b00;
 }
+.verbose {
+	color: #886;
+}
+.section {
+	color: #111;
+	background-color: #161;
+}
 //-->
 </style>
  </head>
@@ -329,7 +336,7 @@
 		getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&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 @@
 	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 @@
 		// 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%">
================================================================

---- CVS-web:
    http://cvs.pld-linux.org//buildlogs/buildlogs.inc?r1=1.6&r2=1.7&f=u
    http://cvs.pld-linux.org//buildlogs/index.php?r1=1.16&r2=1.17&f=u



More information about the pld-cvs-commit mailing list