[Dehs-devel] r135 - trunk

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Thu May 29 21:35:31 UTC 2008


Author: atomo64-guest
Date: 2008-05-29 21:35:30 +0000 (Thu, 29 May 2008)
New Revision: 135

Modified:
   trunk/dehs_pg.php
Log:
* Call wget without -c, so popcon.db is really updated
* When one of the values in popcon.db is 'missing' set to -1 so the other value, if it exists, _is_ UPDATEd, but use -1 to catch those bugs


Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php	2008-05-27 00:23:57 UTC (rev 134)
+++ trunk/dehs_pg.php	2008-05-29 21:35:30 UTC (rev 135)
@@ -63,7 +63,7 @@
     elseif (in_array("-db_query",$argv))  db_query($argv[2],(!empty($argv[3])?$argv[3]:'%') );
     elseif (in_array("-dl_diffs",$argv) || in_array("-keep_diff",$argv))  dl_diffs($argv[2]);
     elseif (in_array("-keep_sources",$argv) || in_array("-download_sources",$argv))  download_sources();
-    elseif (in_array("-db_popcon",$argv))  db_popcon($argv[2]);
+    elseif (in_array("-db_popcon",$argv))  db_popcon();
     elseif (in_array("-dl_popcon",$argv) || in_array("-keep_popcon",$argv))  dl_popcon();
     elseif (in_array("-db_upstream",$argv))  db_upstream((!empty($argv[2])?$argv[2]:'%'));
     elseif (in_array("-update_all",$argv))  update_all();
@@ -422,11 +422,11 @@
         print "Db clear complete\n";
     }
 }
-function db_popcon($initial='') {
+function db_popcon() {
     global $dirs,$dbconn;
     $db = pg_pconnect($dbconn)  or  die_status(pg_last_error($db));
-    $filename=$dirs[popcon_dir] . "/popcon.db";
-    $popcon_db = dba_open("$filename", 'r-', 'db4');
+    $filename=$dirs['popcon_dir'] . "/popcon.db";
+    $popcon_db = dba_open($filename, 'r-', 'db4');
 
     $rsql = pg_exec($db, "SELECT name FROM pkgs");
 
@@ -440,6 +440,11 @@
         $inst = dba_fetch("si:$package", $popcon_db);
         $vote = dba_fetch("sv:$package", $popcon_db);
 
+        // when one of the values is 'missing' set to -1 so the other value
+        //  _is_ UPDATEd, but use -1 to catch those bugs
+        $inst = (is_int($inst))? $inst : -1;
+        $vote = (is_int($vote))? $vote : -1;
+
         @pg_exec($db, "UPDATE pkgs SET pop_inst='$inst',pop_vote='$vote' WHERE name='$package'");
     }
 
@@ -449,16 +454,16 @@
 function dl_popcon() {
     global $dirs,$dbconn;
 
-    $localtempdir=$dirs[popcon_dir] . "/new";
+    $localtempdir=$dirs['popcon_dir'] . "/new";
     dir_ctrl($localtempdir);
 
-    $localfile=$dirs[popcon_dir] . "/popcon.db";
+    $localfile=$dirs['popcon_dir'] . "/popcon.db";
     $remotefile='http://qa.debian.org/data/popcon/popcon.db';
 
     $return = 0;
     $output = null;
     exec('cd ' . escapeshellarg($localtempdir) . ' && ' .
-         '/usr/bin/wget -qNc ' . escapeshellarg($remotefile), $output, $return);
+         '/usr/bin/wget -qN ' . escapeshellarg($remotefile), $output, $return);
 
     if ($return != 0) {
         echo __FUNCTION__ . "wget exited with status $return!\n";




More information about the Dehs-devel mailing list