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 $backarr = "<<< ";
282 $forward = "Page forward";
283 $forwardarr = " >>>";
285 echo "<p><table width=90% align=center><tr><td align=left width=1%>";
291 $hrefurl = "<a href=\"$big_url&off=$noff\">";
292 echo "$hrefurl$backarr</a></td><td align=left>$hrefurl$back</a>";
294 echo "$backarr</td><td align=left>$back";
297 echo "</td>\n<td align=center>";
299 if ($qa_addr[$idx] != "") {
300 echo "[<a href=\"$big_url&action=qa\">View <quot>rpm -qa</quot> of ".
306 echo "</td>\n<td align=right>";
307 if ($off + $cnt < count($list)) {
311 $hrefurl = "<a href=\"$big_url&off=$noff\">";
312 echo "$hrefurl$forward</a></td><td align=right width=1%>$hrefurl$forwardarr</a>";
314 echo "$forward</td><td align=right width=1%>$forwardarr";
316 echo "</td>\n</tr></table></p>";
325 global $idx, $addr, $ok;
326 global $ftp_conn, $root_directory, $big_url, $ns, $id;
327 global $buildlogs_server, $local;
332 $list = directory_list();
340 for ($i = 0; $i < count($list); $i++) {
341 $h = bin2hex(mhash(MHASH_MD5, $list[$i]));
348 mydie("cannot find specified file: $id");
357 function dump_log($tail)
359 global $idx, $addr, $ok, $url;
360 global $ftp_conn, $root_directory, $big_url, $ns, $id, $cnt, $off;
361 global $buildlogs_server, $local, $qa_addr;
368 $df = preg_replace("/.*\/([^\/]*)$/", "\\1", $f);
369 $df = preg_replace("/\.(bz2|gz)$/", "", $df);
373 echo "<table border=0 cellpadding=3 cellspacing=1 bgcolor=#000000>";
375 function one_item($h, $t) {
376 echo "<tr><td bgcolor=#ccccff>$h:</td>".
377 "<td bgcolor=#cccccc>$t</td></tr>";
380 function href($h, $c) {
381 return "<a href=\"$h\">$c</a>";
384 one_item("Status", ($ok == 1 ?
385 "<font color=green><b>OK</b></font>" :
386 "<font color=red><b>Failed</b></a>"));
387 one_item("Source URL",
388 href("ftp://$buildlogs_server$f",
389 "ftp://$buildlogs_server$f"));
391 $bu = "$big_url&off=$off";
393 one_item("text/plain URL",
394 href("$bu&id=$id&action=text",
397 one_item("full text",
402 if ($qa_addr[$idx] != "") {
403 one_item("rpm -qa of builder", href("$bu&action=qa", "View!"));
405 one_item("rpm -qa of builder", "Not available");
408 one_item("Data", date("Y/m/d H:i:s", filemtime("$root_directory$f")));
410 one_item("Data", date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)));
413 echo "<tr><td>Here:</td><td>" .
414 "<a href=\"$url?idx=$idx&ok=$ok&id=$id\">".
415 "http://" . getenv("SERVER_NAME") .
416 getenv("SCRIPT_NAME") . "?idx=$idx&ok=$ok&id=$id</a>" .
419 echo "</table><h2>Content:</h2>";
427 # what can I say beside PHP suxx? how the fuck should I create
428 # bidirectional pipe? gotta use wget
430 if (preg_match("/\.bz2$/", $f)) {
432 } elseif (preg_match("/\.gz$/", $f)) {
439 $cmd = "$filter $root_directory$f";
441 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
444 $cmd = "$cmd | tail -n 100";
445 $fd = popen($cmd, "r");
447 while (($s = fgets($fd, 1000)) != false) {
448 $s = htmlspecialchars($s);
458 [<a href="<?php echo $bu; ?>">Back to list of logs</a>]
461 [<a href="<?php echo "$bu&action=qa"
462 ?>">View rpm -qa of builder</a>]
472 global $ftp_conn, $root_directory;
473 global $buildlogs_server, $local;
475 header("Content-type: text/plain");
482 echo "# src : ftp://$buildlogs_server$f\n";
485 date("Y/m/d H:i:s", filemtime("$root_directory$f")) . "\n";
488 date("Y/m/d H:i:s", ftp_mdtm($ftp_conn, $f)) . "\n";
493 if (preg_match("/\.bz2$/", $f)) {
495 } elseif (preg_match("/\.gz$/", $f)) {
502 $cmd = "$filter $root_directory$f";
504 $cmd = "wget -q -O - ftp://$buildlogs_server$f 2>&1 | $filter 2>&1";
506 $fd = popen($cmd, "r");
507 while (($s = fgets($fd, 1000)) != false) {
513 function list_archs()
515 global $addr, $url, $idx;
517 echo "<table width=100% border=0>\n";
518 echo "<tr><td bgcolor=#cccccc nowrap=1>Failed</td><td bgcolor=#cccccc>Ok</td></tr>\n";
519 for ($i = 0; $i < count($addr); $i++)
520 echo "<tr><td nowrap=1>".
521 "<a href=\"$url?idx=$i&ok=0\">$addr[$i]</a></td><td nowrap=1>".
522 "[<a href=\"$url?idx=$i&ok=1\">OK</a>]</td>".
523 #"<td>[<a href=\"$url?idx=$i&action=qa\">qa</a>]</td>".
525 echo "</table><hr />\n";
526 echo "<div align=\"center\"><a href=\"$url\">main()</a><hr />\n";
527 echo "<a href=\"http://www.pld.org.pl/\"><img src=powpld.png ".
528 "alt=\"Powered by PLD Linux\" border=0></a><br />\n" .
530 "<a href=\"mailto:feedback@pld.org.pl\">PLD Team</a>\n".
534 echo "<div align=center><small>";
535 $pow = array("vim", "php", "brain", "power", "electricity",
536 "coffee", "ufo", "penguin", "GNOME", "ELF", "DWARF",
537 "voodoo magic", "Linux", "x-files", "X", "foobar",
538 "/dev/null", "/dev/zero", "/dev/drzewo",
539 "Leppe'", "matrix", "Neo", "PDP-11",
540 "Ken", "GNU antilope", "PDP-7", "ITS", "Multics",
541 "foobarbaz", "ed", "Joe", "Unix conspiracy",
542 "overclock", "The Right Thing",
543 "The Bad Thing", "Star Treck", "NSA", "NASA",
544 "achelon", "VAX", "Real Programmer",
545 "Real Operating System", "Real Computer",
546 "computron", "bogon", "quantum bogodynamics",
547 "BOFH", "/dev/ill", "nasi tu byli",
548 "Paranoid Android", "Lunatic Corp"
549 # feel free to add sth if you change this file ;)
553 for ($i = 0; $i < $max; $i++) {
554 $x = rand(0, count($pow) - 1);
555 if ($pow[$x] == "") $i--;
556 else echo $pow[$x] . ($i == $max - 1 ? "." : ", ");
560 echo "</small></div>";
564 if ($qa_addr[$idx] != "") {
565 echo "<form action=\"index.php\" method=\"post\">";
566 echo "<input type=hidden name=idx value=$idx />";
567 echo "<input type=hidden name=action value=sqa />";
568 echo "<input type=text size=14 name=str /><br/>";
569 echo "<input type=submit name=submit value=\"Search rpmqa!\" />";
577 global $idx, $qa_addr, $qa_base;
579 if (!isset($idx) || !isset($qa_addr[$idx]))
584 if ($qa_addr[$idx] == "")
587 return fopen("$qa_base$qa_addr[$idx]", "r");
592 global $url, $idx, $qa_addr, $str;
595 echo "<h1>Search results for '$str' in $qa_addr[$idx]</h1>";
600 echo "Sorry, cannot open.";
602 while (($s = fgets($f, 1000)) != false) {
603 if (stristr($s, $str))
611 function dump_qa($plain)
613 global $url, $idx, $qa_addr;
620 header("Content-type: text/plain");
621 echo "# rpm -qa of $a\n";
623 echo "<h1>rpm -qa of $a</h1>";
624 echo "<a href=\"$url?idx=$idx&action=qatxt\">text/plain "
630 echo "Sorry, cannot open.";
632 while (($s = fgets($f, 1000)) != false) {
644 <table border=0 width=100%><tr><td width=20%> </td><td>
646 <p>Welcome to PLD Build Logs WWW interface.</p><p>
647 Feel free to email bug reports, complaints and feature requests
648 <!-- ech... niech strace... -->
649 <a href="mailto:malekith /at/ pld-linux org">to us</a>. Positive opinions are also
650 <a href="mailto:malekith /at/ pld-linux org">welcome</a> ;)</p>
651 <p>Version: $Id: index.php,v 1.21 2002/09/22 18:43:43 ankry Exp $</p>
652 </td><td width=20%> </td></tr>
657 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
658 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
659 header("Cache-Control: no-cache, must-revalidate");
660 header("Pragma: no-cache");
664 if ($action == "text") {
666 } else if ($action == "qatxt") {
670 echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
672 echo "</td><td valign=top>";
676 else if ($action == "sqa")
679 dump_log($action == "tail");
680 else if (isset($idx))
684 echo "</td></tr></table>";
690 if ($action == "text") {
692 } else if ($action == "qatxt") {
696 echo "<table cellpadding=10 width=100%><tr><td valign=top width=10%>";
698 echo "</td><td valign=top>";
703 dump_log($action == "tail");
704 else if (isset($idx))
708 echo "</td></tr></table>";