X-Git-Url: https://git.pld-linux.org/?p=projects%2Fbuildlogs.git;a=blobdiff_plain;f=index.php;h=614208965aea4f90b3a47a2cf754bbc4f29b2d9d;hp=8a688a2d9184a192190494499d76b0506850c189;hb=f1a0f4fca68cc30bab3cb1dfcd0894841920f0c8;hpb=9f76730204d964a8448535e95f978fcbb93544b8 diff --git a/index.php b/index.php index 8a688a2..6142089 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,7 @@ @@ -116,7 +132,7 @@ TH { font-family: arial,helvetica,sans-serif; function start_pre() { echo "
". - "
";
+		"
";
 }
 
 function end_pre()
@@ -283,10 +299,15 @@ function dump_log($tail)
 
 	$df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
 	$df = preg_replace("/\.(bz2|gz)$/", "", $df);
+	list($name, $id) = explode(',', $df);
 
-	echo "

$df

"; + if ($name != 'command') { + $gitweb_url = "http://git.pld-linux.org/?p=packages/$name.git;a=summary"; + $name = "$name"; + } + echo "

$name $id

"; - echo ""; + echo "
"; function one_item($h, $t) { echo "". @@ -329,7 +350,6 @@ function dump_log($tail) getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id" . ""; */ - echo "
$h:

"._("Content:")."

"; # what can I say beside PHP suxx? how the fuck should I create @@ -344,25 +364,117 @@ function dump_log($tail) } $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 = "$s"; + if (preg_match("/(?:fail|error(s|\sCS\d+)?):/i", $s)) { + $first_cut = true; + $err_count++; + $toc_elem = "error $err_count"; + $err_elem = $s; + $s = "$s"; + } 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 = "$s"; + } elseif (preg_match("#^\+ /usr/bin/make\b.*\b(?Pcheck)\b#", $s, $m)) { + // rpm build section + $toc_elem = "make {$m['target']}"; + $err_elem = $s; + $s = "$s"; + } elseif (preg_match('/^(?P- For complete changelog see:) (?P.+)$/', $s, $m)) { + // rpm changelog link + $link = "{$m['link']}"; + $s = "{$m['line']} $link
"; + } elseif (preg_match('/^(?P\* \w{3} \w{3} [ \d]{2} \d{4} .*?) (?P[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 = "{$m['hash']}"; + $s = "{$m['line']} $link
"; + } elseif (substr($s, 0, 2) == "+ ") { + // shell verbose + $s = "$s"; + } elseif (preg_match("/^Executing\(%(?P
\w+)\)/", $s, $m)) { + // rpm build section + $toc_elem = $m['section']; + $err_elem = $s; + $s = "$s"; + } elseif (preg_match("/^Processing files: (?P(?P.+)-[^-]+-[^-]+)/", $s, $m)) { + $first_cut = true; + // processing files + $toc_elem = "files ".$m['name']; + $err_elem = $s; + $s = "$s"; + } elseif (preg_match("/^ended at: (?P.+), done in (?P
"; + + if (!empty($toc)) { + echo "

"._("Toc:")."

"; + echo ""; + } + + echo "

"._("Content:")."

"; + + start_pre(); + echo $code; + end_pre(); + ?> @@ -395,7 +507,10 @@ function dump_text() 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 { @@ -421,16 +536,17 @@ function list_archs() echo "
\n"; echo "\n"; - foreach ($addr as $dist => $ddist) { - foreach ($ddist as $arch) { - echo "". - #"". - "\n"; - } - } + foreach ($addr as $dist => $ddist) { + echo "\n"; + foreach ($ddist as $arch) { + echo "". + #"". + "\n"; + } + } echo "
"._("Failed").""._("Ok")."
". - " - $dist/$arch". - "[OK][qa]

". + " + $dist/$arch". + "[OK][qa]

\n"; echo "
"; @@ -438,10 +554,10 @@ function list_archs() echo "main()
\n"; echo "
\n" . - "(c) 2002 ". + "alt=\""._("Powered by PLD Linux")."\" border=\"0\" />
\n" . + "(c) 2002-". date("Y") . " ". "PLD Team
\n". - '$Revision: 1.15 $'. + '$Revision: 1.37 $'. "
\n"; # smile ;) @@ -496,11 +612,7 @@ function get_qa() 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"); } @@ -517,10 +629,15 @@ function search_qa() 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(); } @@ -813,8 +930,7 @@ function welcome() . - ;)

-

Version: $Id: index.php,v 1.15 2012/02/08 13:25:08 glen Exp $

+ ;)