buildlogs: buildlogs.sql/migration.php Be more verbose.

arekm arekm at pld-linux.org
Tue Oct 21 17:36:32 CEST 2008


Author: arekm                        Date: Tue Oct 21 15:36:32 2008 GMT
Module: buildlogs                     Tag: HEAD
---- Log message:
Be more verbose.

---- Files affected:
buildlogs/buildlogs.sql:
   migration.php (1.6 -> 1.7) 

---- Diffs:

================================================================
Index: buildlogs/buildlogs.sql/migration.php
diff -u buildlogs/buildlogs.sql/migration.php:1.6 buildlogs/buildlogs.sql/migration.php:1.7
--- buildlogs/buildlogs.sql/migration.php:1.6	Sun Dec  2 16:49:42 2007
+++ buildlogs/buildlogs.sql/migration.php	Tue Oct 21 17:36:26 2008
@@ -26,8 +26,11 @@
 	"ac/sparc" => 18,
 	"ac/sparc64" => 19
 );
-*/
-include('buildlogs.inc');
+ */
+
+$me = $argv[0];
+
+require('buildlogs.inc');
 
 if (file_exists($database_file)) {
 	unlink($database_file);
@@ -37,23 +40,27 @@
 try {
 	$dbhandle = new PDO("$database");
 } catch (PDOException $e) {
-	die("new PDO: ". $e->getMessage());
+	die("$me: new PDO: ". $e->getMessage());
 }
 
-$result = array("FAIL", "OK");
-
-for ($i = 1; $i < count($addr); $i++) {
-	for ($ok = 0; $ok < 2; $ok++) {
-		$dir = "$root_directory/" . $addr[$i] . "/" . $result[$ok];
+foreach ($addr as $key=>$val) {
+	if ($key == 0)
+		continue;
+	foreach (array(0=>"FAIL", 1=>"OK") as $rkey=>$rval) {
+		$dir = "$root_directory/" . $val . "/" . $rval;
 		$dh = opendir($dir);
-		if (!$dh) continue;
+		if (!$dh) {
+			echo "$me: $dir: can't open directory\n";
+			continue;
+		}
 		while ($file = readdir($dh)) {
 			if (preg_match("/^(.*)\.bz2$/", $file, $match)) {
 				$f = "$dir/$file";
 				$size = filesize($f);
 				$mtime = filemtime($f);
 				$spec = $match[1];
-				$query .= " INSERT INTO logs(arch_id, result, size, mtime, spec) VALUES($i, $ok, $size, $mtime, '$spec');";
+				echo "$me: Doing: $spec, $mtime, $size...\n";
+				$query .= " INSERT INTO logs(arch_id, result, size, mtime, spec) VALUES($key, $rkey, $size, $mtime, '$spec');";
 			}
 		}
 		closedir($dh);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/buildlogs/buildlogs.sql/migration.php?r1=1.6&r2=1.7&f=u



More information about the pld-cvs-commit mailing list