buildlogs: buildlogs.sql/addlog2.php, buildlogs.sql/buildlogs2.inc, buildlo...
witekfl
witekfl at pld-linux.org
Wed Oct 22 17:13:57 CEST 2008
Author: witekfl Date: Wed Oct 22 15:13:57 2008 GMT
Module: buildlogs Tag: HEAD
---- Log message:
- Some fixes. It works for me.
---- Files affected:
buildlogs/buildlogs.sql:
addlog2.php (1.1 -> 1.2) , buildlogs2.inc (1.2 -> 1.3) , migration2.php (1.1 -> 1.2) , index2.php (1.2 -> 1.3)
---- Diffs:
================================================================
Index: buildlogs/buildlogs.sql/addlog2.php
diff -u buildlogs/buildlogs.sql/addlog2.php:1.1 buildlogs/buildlogs.sql/addlog2.php:1.2
--- buildlogs/buildlogs.sql/addlog2.php:1.1 Wed Oct 22 11:22:15 2008
+++ buildlogs/buildlogs.sql/addlog2.php Wed Oct 22 17:13:51 2008
@@ -9,23 +9,24 @@
*/
$result = array("FAIL" => 0, "OK" => 1);
-include('buildlogs.inc');
+include('buildlogs2.inc');
if (!isset($argv[1])) {
die("Usage: $argv[0] full_path_to_the_log\n");
}
-if (!preg_match("|^$root_directory/(.*)/(.*)/(.*)/(.*),?(.*)?\.bz2$|", $argv[1], $matches))
+if (!preg_match("|^$root_directory/(.*)/(.*)/(.*)/(.*)\.bz2$|", $argv[1], $matches))
exit(0);
+if (preg_match("/^(.*),(.*)$/", $matches[4], $m2)) {
+ $name = $m2[1];
+ $id = $m2[2];
+} else {
+ $name = $matches[4];
+ $id = "";
+}
$dist = $matches[1];
$arch = $matches[2];
$ok = $result[$matches[3]];
-$name = $matches[4];
-if (isset($matches[5]) {
- $id = $matches[5];
-} else {
- $id = '';
-}
$size = filesize($argv[1]);
$mtime = filemtime($argv[1]);
================================================================
Index: buildlogs/buildlogs.sql/buildlogs2.inc
diff -u buildlogs/buildlogs.sql/buildlogs2.inc:1.2 buildlogs/buildlogs.sql/buildlogs2.inc:1.3
--- buildlogs/buildlogs.sql/buildlogs2.inc:1.2 Wed Oct 22 11:52:04 2008
+++ buildlogs/buildlogs.sql/buildlogs2.inc Wed Oct 22 17:13:52 2008
@@ -4,7 +4,7 @@
$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")
+ "ppc", "sparc", "sparc64"),
+ "th" => array("SRPMS", "i486", "i686", "alpha", "athlon", "ppc", "x86_64")
);
?>
================================================================
Index: buildlogs/buildlogs.sql/migration2.php
diff -u buildlogs/buildlogs.sql/migration2.php:1.1 buildlogs/buildlogs.sql/migration2.php:1.2
--- buildlogs/buildlogs.sql/migration2.php:1.1 Wed Oct 22 11:22:15 2008
+++ buildlogs/buildlogs.sql/migration2.php Wed Oct 22 17:13:52 2008
@@ -5,29 +5,8 @@
$root_directory = '/home/services/ftp/pub/pld-buildlogs';
$database = 'sqlite:/home/services/httpd/html/pld-buildlogs/db/buildlogs.db';
// $root_directory and $database are taken from buildlogs.inc
-$reverse_addr = array(
- "th/SRPMS" => 1,
- "th/i486" => 2,
- "th/i686" => 3,
- "th/athlon" => 4,
- "th/x86_64" => 5,
- "th/ia64" => 6,
- "th/alpha" => 7,
- "th/ppc" => 8,
- "th/sparc" => 9,
- "ac/SRPMS" => 10,
- "ac/i386" => 11,
- "ac/i586" => 12,
- "ac/i686" => 13,
- "ac/athlon" => 14,
- "ac/amd64" => 15,
- "ac/alpha" => 16,
- "ac/ppc" => 17,
- "ac/sparc" => 18,
- "ac/sparc64" => 19
-);
*/
-include('buildlogs.inc');
+include('buildlogs2.inc');
if (file_exists($database_file)) {
unlink($database_file);
@@ -44,32 +23,33 @@
$result = array("FAIL", "OK");
$dh = opendir($root_directory);
-if ($dh) {
+if (!$dh) {
die("opendir $root_directory");
}
while ($dist = readdir($dh)) {
if ($dist[0] == '.') continue;
if (!is_dir("$root_directory/$dist")) continue;
$ah = opendir("$root_directory/$dist");
- if (!ah) die("opendir $dist");
+ if (!$ah) die("opendir $dist");
while ($arch = readdir($ah)) {
if ($arch[0] == '.') continue;
if (!is_dir("$root_directory/$dist/$arch")) continue;
for ($ok = 0; $ok < 2; $ok++) {
- $directory = "$root_directory/$dist/$arch/" . $result[$ok]
+ $directory = "$root_directory/$dist/$arch/" . $result[$ok];
$sh = opendir($directory);
if (!$sh) continue;
while ($file = readdir($sh)) {
- if (preg_match("/^(.*),?(.*)?\.bz2$/", $file, $match)) {
- $f = "$directory/" . $match[0];
- $size = filesize($f);
- $mtime = filemtime($f);
- $name = $match[1];
- if (isset($match[2])) {
- $id = $match[2];
+ if (preg_match("/^(.*)\.bz2$/", $file, $match)) {
+ if (preg_match("/(.*),(.*)/", $match[1], $m2)) {
+ $name = $m2[1];
+ $id = $m2[2];
} else {
+ $name = $match[1];
$id = "";
}
+ $f = "$directory/" . $match[0];
+ $size = filesize($f);
+ $mtime = filemtime($f);
$query .= " INSERT INTO logs(dist, arch, ok, name, size, mtime, id) "
. "VALUES('$dist', '$arch', $ok, '$name', $size, $mtime, '$id');";
}
================================================================
Index: buildlogs/buildlogs.sql/index2.php
diff -u buildlogs/buildlogs.sql/index2.php:1.2 buildlogs/buildlogs.sql/index2.php:1.3
--- buildlogs/buildlogs.sql/index2.php:1.2 Wed Oct 22 11:52:04 2008
+++ buildlogs/buildlogs.sql/index2.php Wed Oct 22 17:13:52 2008
@@ -53,6 +53,7 @@
if (isset($_POST["arch"])) $arch = basename($_POST["arch"]);
if (isset($_GET["name"])) {
+ $name_url = urlencode($_GET["name"]);
$name = basename($_GET["name"]);
}
if (isset($_GET["ok"]))$ok=(int)$_GET["ok"];
@@ -174,7 +175,12 @@
$now = time();
$i = $off;
foreach ($dbh->query("$query") as $row) {
- $f = $row["name"];
+ $name = $row["name"];
+ $id = $row["id"];
+ $dist = $row["dist"];
+ $arch = $row["arch"];
+ $f = $name;
+ $name_url = urlencode($name);
$t = $now - $row["mtime"];
$s = $row["size"];
$h = $row["log_id"];
@@ -194,7 +200,7 @@
$t = round($t);
$t = $t . " " . ngettext("minute","minutes",$t);
}
- $u = "$url?dist=$dist&arch=$arch&ok=$ok&name=$name&id=$id";
+ $u = "$url?dist=$dist&arch=$arch&ok=$ok&name=$name_url&id=$id";
echo "<tr><td bgcolor=\"#CCCCCC\" align=\"right\">".($i+1).".</td>".
"<td bgcolor=\"#CCCCCC\"><a href=\"$u\">$f</a> ".
"[<a href=\"$u&action=text\">"._("text")."</a> | ".
@@ -246,7 +252,7 @@
function file_name()
{
- global $ok, $dist, $arch, $name, $id;
+ global $ok, $dist, $arch, $name, $name_url, $id;
if (isset($name) && isset($ok) && isset($arch) && isset($dist)) {
if (isset($id) && $id != '') {
@@ -259,7 +265,7 @@
function dump_log($tail)
{
- global $ok, $url, $dist, $arch;
+ global $ok, $url, $dist, $arch, $name, $name_url;
global $root_directory, $big_url, $ns, $id, $cnt, $off;
global $buildlogs_server;
@@ -295,11 +301,11 @@
$bu = "$big_url&off=$off";
one_item(_("text/plain URL"),
- href("$bu&id=$id&action=text",
+ href("$bu&name=$name_url&id=$id&action=text",
_("View!")));
if ($tail) {
one_item(_("full text"),
- href("$bu&id=$id",
+ href("$bu&name=$name_url&id=$id",
_("View!")));
}
@@ -330,7 +336,7 @@
$filter = "cat";
}
- $cmd = "$filter $root_directory/$f";
+ $cmd = "$filter '$root_directory/$f'";
if ($tail)
$cmd = "$cmd | tail -n 100";
$fd = popen($cmd, "r");
@@ -385,7 +391,7 @@
$filter = "cat";
}
- $cmd = "$filter $root_directory/$f";
+ $cmd = "$filter '$root_directory/$f'";
$fd = popen($cmd, "r");
while (($s = fgets($fd, 1000)) != false) {
echo $s;
@@ -404,8 +410,7 @@
echo "<table width=\"100%\" border=\"0\">\n";
echo "<tr><td bgcolor=\"#cccccc\" nowrap=\"nowrap\">"._("Failed")."</td><td bgcolor=\"#cccccc\">"._("Ok")."</td></tr>\n";
- foreach ($addr as $ddist) {
- $dist = key($addr);
+ foreach ($addr as $dist => $ddist) {
foreach ($ddist as $arch) {
echo "<tr><td nowrap=\"nowrap\">".
"<a href=\"$url?dist=$dist&arch=$arch&ok=0&cnt=$cnt\">
@@ -460,7 +465,7 @@
echo "</small></div>";
if (isset($dist) && isset($arch)) {
- echo "<form action=\"index.php\" method=\"post\">";
+ echo "<form action=\"index2.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"dist\" value=\"$dist\" />";
echo "<input type=\"hidden\" name=\"arch\" value=\"$arch\" />";
echo "<input type=\"hidden\" name=\"action\" value=\"sqa\" />";
@@ -545,19 +550,19 @@
"}\n }\n -->\n </script>\n";
/* Shut up warnings */
- if (!isset($_POST["name"])) $_POST["name"] = "";
+ if (!isset($_POST["n2"])) $_POST["n2"] = "";
if (!isset($_POST["age1"])) $_POST["age1"] = "";
if (!isset($_POST["age2"])) $_POST["age2"] = "";
if (!isset($_POST["size1"])) $_POST["size1"] = "";
if (!isset($_POST["size2"])) $_POST["size2"] = "";
- echo "<form action=\"index.php?action=adv_search\" method=\"post\">";
+ echo "<form action=\"index2.php?action=adv_search\" method=\"post\">";
echo "<div align=\"center\">";
echo "<table border=\"0\">\n";
echo "<tr>\n";
echo "<td>"._("Package name")."</td>\n";
- echo "<td><input type=\"text\" size=\"20\" name=\"name\" value=\"". $_POST["name"] ."\"/></td>\n";
+ echo "<td><input type=\"text\" size=\"20\" name=\"n2\" value=\"". $_POST["name"] ."\"/></td>\n";
echo "</tr>\n";
echo "<tr>\n";
@@ -582,8 +587,7 @@
echo "</tr>\n";
$i = 1;
- foreach ($addr as $ddist) {
- $dist = key($addr);
+ foreach ($addr as $dist => $ddist) {
foreach ($ddist as $arch) {
echo "<tr>\n";
$name="as0_".$i;
@@ -592,33 +596,33 @@
} else {
$check=" checked=\"on\"";
}
- echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">".$dist/$arch."</label></td>\n";
+ echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
$name="as1_".$i;
- if (!isset($_POST["$name"])) {
+ if (!isset($_POST["$n2"])) {
$check = " ";
} else {
$check=" checked=\"on\"";
}
- echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">".$dist/$arch."</label></td>\n";
+ echo "<td><input name=\"$name\" id=\"$name\" type=\"checkbox\"$check /><label for=\"$name\">". "$dist/$arch" ."</label></td>\n";
echo "</tr>\n";
$i++;
}
}
echo "<tr>\n";
- echo "<td><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")." <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
+ echo "<td><label><input name=\"all\" type=\"checkbox\" checked=\"on\" onClick=\"checkboxToggle()\">"._("Toggle checkboxes")."</label> <input type=\"submit\" name=\"submit\" value=\""._("Search!")."\" /></td>";
echo "</tr>\n";
echo "</table>\n";
// if (isset($_POST["name"]) || isset($_POST["age1"]) || isset($_POST["age2"]) ||
// isset($_POST["size1"]) || isset($_POST["size2"])
- if (($_POST["name"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
+ if (($_POST["n2"]!="") || ($_POST["age1"]!="") || ($_POST["age2"]!="") ||
($_POST["size1"]!="") || ($_POST["size2"]!=""))
{
$query = "SELECT log_id, dist, arch, ok, name, size, mtime, id FROM logs WHERE 1 ";
- if ($_POST["name"] != "") {
- $n = addslashes($_POST["name"]);
+ if ($_POST["n2"] != "") {
+ $n = addslashes($_POST["n2"]);
$query .= "AND name LIKE '$n%' ";
}
$now = time();
@@ -645,12 +649,11 @@
$or = "AND (";
$i = 1;
- foreach ($addr as $ddist) {
- $dist = key($addr);
+ foreach ($addr as $dist => $ddist) {
foreach ($ddist as $arch) {
for ($j = 0; $j < 2; $j++) {
if (isset($_POST["as" . $j . "_" .$i])) {
- $query .= "$or (dist = $dist AND arch = $arch AND ok = $j)";
+ $query .= "$or (dist = '$dist' AND arch = '$arch' AND ok = $j)";
$or = " OR ";
}
}
@@ -673,7 +676,7 @@
break;
}
$query .= " LIMIT $cnt OFFSET $off ";
-
+
try {
$dbh = new PDO("$database");
} catch (PDOException $e) {
@@ -700,9 +703,9 @@
$dist = $row["dist"];
$arch = $row["arch"];
$name = $row["name"];
+ $name_url = urlencode($name);
$id = $row["id"];
$f = $name;
- if ($id != '') $f .= ",$id";
$t = $now - $row["mtime"];
$s = $row["size"];
$t /= 60;
@@ -723,7 +726,7 @@
// $big_url = "$url?idx=$i&ok=$j&ns=$ns&cnt=$cnt";
$ok = $row["ok"];
- $u = "$url?dist=$dist&arch=$arch&name=$name&ok=$ok;&id=$id";
+ $u = "$url?dist=$dist&arch=$arch&name=$name_url&ok=$ok&id=$id";
$b = "$url?dist=$dist&arch=$arch&ok=$ok&ns=$ns&off=$off&cnt=$cnt";
$builder = "$dist/$arch/". $fail_or_ok[$ok];
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/buildlogs/buildlogs.sql/addlog2.php?r1=1.1&r2=1.2&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/buildlogs/buildlogs.sql/buildlogs2.inc?r1=1.2&r2=1.3&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/buildlogs/buildlogs.sql/migration2.php?r1=1.1&r2=1.2&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/buildlogs/buildlogs.sql/index2.php?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list