2 $buildlogs_server = "buildlogs.pld.org.pl";
17 $qa_base = "http://ftp.pld.org.pl/.stat/builder";
20 "/kenny/rpmqa-nest-i386.txt",
21 "/kenny/rpmqa-nest-i586.txt",
22 "/kenny/rpmqa-nest-i686.txt",
24 "/ep/rpmqa-ra-i386.txt",
25 "/ep/rpmqa-ra-i586.txt",
26 "/ep/rpmqa-ra-i686.txt",
27 "/mifgate/rpmqa-ra-alpha.txt",
28 "/team/rpmqa-ra-sparc.txt",
31 $local = 1; /* $local=0 for FTP */
32 $root_directory = "/home/services/ftp/pub/logs";
34 /* It should be set */
40 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
41 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
42 <html xmlns="http://www.w3.org/1999/xhtml">
44 <title>PLD Build Logs</title>
45 <style TYPE="text/css"><!--
46 A { text-decoration: none; }
47 A:hover { text-decoration: underline; }
48 H1 { font-family: arial,helvetica,sans-serif;
51 H2 { font-family: arial,helvetica,sans-serif;
54 BODY,TD { font-family: arial,helvetica,sans-serif;
56 TH { font-family: arial,helvetica,sans-serif;
62 <!-- Diffrent color for visited link doesn't make much sense here...
63 this page is autogenerated and it might be misleading after some
64 build log changes. -->
65 <body bgcolor="#ffffff" text="#000000" link="#5f26cd" vlink="#5f26cd">
71 echo "<table cellpadding=10><tr><td bgcolor=\"#000000\">".
72 "<font color=\"#cccccc\"><pre>";
77 echo "</pre></font></td></tr></table>\n";
82 echo "</body></html>";
88 echo "Fatal error: $msg";
93 global $idx, $addr, $buildlogs_server, $ok;
94 global $ftp_conn, $big_url, $url, $ns;
97 if (!isset($idx) || !isset($addr[$idx]))
106 $a = "$addr[$idx]/OK";
108 $a = "$addr[$idx]/FAIL";
116 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
118 $ftp = ftp_connect($buildlogs_server);
121 mydie("cannot connect to $buildlogs_server");
125 if (ftp_login($ftp, "anonymous",
126 "buildlogs-iface@pld.org.pl") == false) {
128 mydie("cannot ftp login to $buildlogs_server");
132 $list = ftp_nlist($ftp, $a);
133 if ($list == false) {
135 mydie("cannot list $a");
144 function directory_list()
146 global $idx, $addr, $buildlogs_server, $ok;
147 global $root_directory, $big_url, $url, $ns;
150 if (!isset($idx) || !isset($addr[$idx]))
159 $a = "$addr[$idx]/OK";
161 $a = "$addr[$idx]/FAIL";
169 $big_url = "$url?idx=$idx&ok=$ok&ns=$ns&cnt=$cnt";
171 $dir = opendir("$root_directory$a");
173 while ($file = readdir($dir)) {
174 if (($file != ".") && ($file != "..")) {
175 $list[$i] = "$a/$file";
185 global $idx, $addr, $ok;
186 global $ftp_conn, $big_url, $ns, $qa_addr;
187 global $off, $cnt, $local, $root_directory;
190 $list = directory_list();
198 echo "<h1>Listing of $addr[$idx]/OK "
199 ."(<a href=\"$big_url&ok=0\">fail</a>)</h1>";
201 echo "<h1>Listing of $addr[$idx]/FAIL "
202 ."(<a href=\"$big_url&ok=1\">ok</a>)</h1>";
205 echo "<div align=center><table border=0 cellspacing=1 ".
206 "cellpadding=3 bgcolor=#000000 width=90%>\n";
207 echo "<tr><th bgcolor=#CCCCFF align=left width=60%>Log File ".
208 "[<a href=\"$big_url&ns=1\">sort</a>]</th>".
209 "<th bgcolor=#CCCCFF align=right width=15%>Size</th> ".
210 "<th bgcolor=#CCCCFF align=left>Age ".
211 "[<a href=\"$big_url&ns=0\">sort</a>]</th>".
214 function cmp($f1, $f2) {
215 global $ftp_conn, $root_directory, $local;
217 return filemtime("$root_directory$f2") - filemtime("$root_directory$f1");
218 return ftp_mdtm($ftp_conn, $f2) - ftp_mdtm($ftp_conn, $f1);
229 for ($i = $off; $i < $cnt + $off; $i++) {
230 if (!isset($list[$i]))
232 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
233 $f = preg_replace("/.*\/([^\/]*)$/", "\\1", $list[$i]);
234 $f = preg_replace("/\.(bz2|gz)$/", "", $f);
236 $s = filesize("$root_directory$list[$i]");
237 $t = $now - filemtime("$root_directory$list[$i]");
239 $s = ftp_size($ftp_conn, $list[$i]);
240 $t = $now - ftp_mdtm($ftp_conn, $list[$i]);
264 $t = $t . " minutes";
269 $u = "$big_url&off=$off&id=$h";
270 echo "<tr><td bgcolor=#CCCCCC><a ".
273 "[<a href=\"$u&action=text\">text</a> | ".
274 "<a href=\"$u&action=tail\">tail</a>]".
275 "</td><td bgcolor=#CCCCCC align=right>".
276 "$s</td><td bgcolor=#CCCCCC>$t</td></tr>\n";
278 echo "</table></div>\n";
280 $back = "<table><tr><td><<<</td><td> Page back</td></tr></table>";
281 $forward = "<table><tr><td>Page forward </td><td>>>></td></tr></table>";
283 echo "<p align=center><table width=90%><tr><td align=left width=25%>";
289 echo "<a href=\"$big_url&off=$noff\">$back</a>\n";
294 echo "</td><td width=50% align=center>";
296 if ($qa_addr[$idx] != "") {
297 echo "[<a href=\"$big_url&action=qa\">View rpm -qa of ".
303 echo "</td><td align=right width=25%>";
304 if ($off + $cnt < count($list)) {
308 echo "<a href=\"$big_url&off=$noff\">$forward</a>\n";
312 echo "</td></tr></table></p>";
321 global $idx, $addr, $ok;
322 global $ftp_conn, $root_directory, $big_url, $ns, $id;
323 global $buildlogs_server, $local;
328 $list = directory_list();
336 for ($i = 0; $i < count($list); $i++) {
337 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
344 mydie("cannot find specified file: $id");
353 function dump_log($tail)
355 global $idx, $addr, $ok, $url;
356 global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
357 global $buildlogs_server, $local, $qa_addr;
364 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
365 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
369 echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>";
371 function one_item($h, $t) {
372 echo "<tr><td bgcolor=#ccccff>$h:</td>".
373 "<td bgcolor=#cccccc>$t</td></tr>";
376 function href($h, $c) {
377 return "<a href=\"$h\">$c</a>";
380 one_item("Status", ($ok == 1 ?
381 "<font color=green><b>OK</b></font>" :
382 "<font color=red><b>Failed</b></a>"));
383 one_item("Source URL",
384 href("ftp://$buildlogs_server$f",
385 "ftp://$buildlogs_server$f"));
387 $bu = "$big_url&off=$off";
389 one_item("text/plain URL",
390 href("$bu&id=$id&action=text",
393 one_item("full text",
398 if ($qa_addr[$idx] != "") {
399 one_item("rpm -qa of builder", href("$bu&action=qa", "View!"));
401 one_item("rpm -qa of builder", "Not available");
404 one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
406 one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
409 echo "<tr><td>Here:</td><td>" .
410 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
411 "http://" . getenv("SERVER_NAME") .
412 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
415 echo "</table><h2>Content:</h2>";
423 # what can I say beside PHP suxx? how the fuck should I create
424 # bidirectional pipe? gotta use wget
426 if (preg_match("/\.bz2$/", $f)) {
428 } elseif (preg_match("/\.gz$/", $f)) {
435 $cmd = "$filter $root_directory$f";
437 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
440 $cmd = "$cmd | tail -n 100";
441 $fd = popen($cmd, "r");
443 while (($s = fgets($fd, 1000)) != false) {
444 $s = htmlspecialchars($s);
454 [<a href="<?php echo $bu; ?>">Back to list of logs</a>]
457 [<a href="<?php echo "$bu&action=qa"
458 ?>">View rpm -qa of builder</a>]
468 global $ftp_conn, $root_directory;
469 global $buildlogs_server, $local;
471 header("Content-type: text/plain");
478 echo "# src : ftp://$buildlogs_server$f\n";
481 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
484 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
489 if (preg_match("/\.bz2$/", $f)) {
491 } elseif (preg_match("/\.gz$/", $f)) {
498 $cmd = "$filter $root_directory$f";
500 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
502 $fd = popen($cmd, "r");
503 while (($s = fgets($fd, 1000)) != false) {
509 function list_archs()
511 global $addr, $url, $idx;
513 echo "<table width=100% border=0>\n";
514 echo "<tr><td bgcolor=#cccccc nowrap=1>Failed</td><td bgcolor=#cccccc>Ok</td></tr>\n";
515 for ($i = 0; $i < count($addr); $i++)
516 echo "<tr><td nowrap=1>".
517 "<a href=\"$url?idx=$i&ok=0\">$addr[$i]</a></td><td nowrap=1>".
518 "[<a href=\"$url?idx=$i&ok=1\">OK</a>]</td>".
519 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
521 echo "</table><hr />\n";
522 echo "<div align=\"center\"><a href=\"$url\">main()</a><hr />\n";
523 echo "<a href=\"http://www.pld.org.pl/\"><img src=powpld.png ".
524 "alt=\"Powered by PLD Linux\" border=0></a><br />\n" .
526 "<a href=\"mailto:feedback@pld.org.pl\">PLD Team</a>\n".
530 echo "<div align=center><small>";
531 $pow = array("vim", "php", "brain", "power", "electricity",
532 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
533 "voodoo magic", "Linux", "x-files", "X", "foobar",
534 "/dev/null", "/dev/zero", "/dev/drzewo",
535 "Leppe'", "matrix", "Neo", "PDP-11",
536 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
537 "foobarbaz", "ed", "Joe", "Unix conspiracy",
538 "overclock", "The Right Thing",
539 "The Bad Thing", "Star Treck", "NSA", "NASA",
540 "achelon", "VAX", "Real Programmer",
541 "Real Operating System", "Real Computer",
542 "computron", "bogon", "quantum bogodynamics",
543 "BOFH", "/dev/ill", "nasi tu byli",
544 "Paranoid Android", "Lunatic Corp"
545 # feel free to add sth if you change this file ;)
549 for ($i = 0; $i < $max; $i++) {
550 $x = rand(0, count($pow) - 1);
551 if ($pow[$x] == "") $i--;
552 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
556 echo "</small></div>";
560 if ($qa_addr[$idx] != "") {
561 echo "<form action=\"index.php\" method=\"post\">";
562 echo "<input type=hidden name=idx value=$idx />";
563 echo "<input type=hidden name=action value=sqa />";
564 echo "<input type=text size=14 name=str /><br/>";
565 echo "<input type=submit name=submit value=\"Search rpmqa!\" />";
573 global $idx, $qa_addr, $qa_base;
575 if (!isset($idx) || !isset($qa_addr[$idx]))
580 if ($qa_addr[$idx] == "")
583 return fopen("$qa_base$qa_addr[$idx]", "r");
588 global $url, $idx, $qa_addr, $str;
591 echo "<h1>Search results for '$str' in $qa_addr[$idx]</h1>";
596 echo "Sorry, cannot open.";
598 while (($s = fgets($f, 1000)) != false) {
599 if (stristr($s, $str))
607 function dump_qa($plain)
609 global $url, $idx, $qa_addr;
616 header("Content-type: text/plain");
617 echo "# rpm -qa of $a\n";
619 echo "<h1>rpm -qa of $a</h1>";
620 echo "<a href=\"$url?idx=$idx&action=qatxt\">text/plain "
626 echo "Sorry, cannot open.";
628 while (($s = fgets($f, 1000)) != false) {
640 <table border=0 width=100%><tr><td width=20%> </td><td>
642 <p>Welcome to PLD Build Logs WWW interface.</p><p>
643 Feel free to email bug reports, complaints and feature requests
644 <!-- ech... niech strace... -->
645 <a href="mailto:malekith /at/ pld-linux org">to us</a>. Positive opinions are also
646 <a href="mailto:malekith /at/ pld-linux org">welcome</a> ;)</p>
647 <p>Version: $Id: index.php,v 1.20 2002/09/22 16:10:17 ankry Exp $</p>
648 </td><td width=20%> </td></tr>
653 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
654 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
655 header("Cache-Control: no-cache, must-revalidate");
656 header("Pragma: no-cache");
660 if ($action == "text") {
662 } else if ($action == "qatxt") {
666 echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
668 echo "</td><td valign=top>";
672 else if ($action == "sqa")
675 dump_log($action == "tail");
676 else if (isset($idx))
680 echo "</td></tr></table>";
686 if ($action == "text") {
688 } else if ($action == "qatxt") {
692 echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
694 echo "</td><td valign=top>";
699 dump_log($action == "tail");
700 else if (isset($idx))
704 echo "</td></tr></table>";