[Dehs-devel] r133 - trunk
atomo64-guest at alioth.debian.org
atomo64-guest at alioth.debian.org
Tue May 27 00:15:54 UTC 2008
Author: atomo64-guest
Date: 2008-05-27 00:15:53 +0000 (Tue, 27 May 2008)
New Revision: 133
Modified:
trunk/dehs_pg.php
Log:
Add lastpkgsourcesupdate which is intended to track packages that by some unknown reason were not updated despite a new version was found in Sources.
Also prevent db_up_error() from aborting everything
Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php 2008-04-19 00:28:32 UTC (rev 132)
+++ trunk/dehs_pg.php 2008-05-27 00:15:53 UTC (rev 133)
@@ -211,7 +211,7 @@
$matches[10]=pg_escape_string($matches[10]);
}
@pg_exec($db,"INSERT INTO pkgs_atsrc (name,dist) VALUES ('$matches[1]','$dist')") OR die_status("Temp table pkgs_atsrc query error");
- $rst=@pg_exec($db, "INSERT INTO pkgs (name,version,dversionmangled,maint,dir,md5_atsource,bytes,dist,section,uploaders,homepage,vcs_browser,vcs_type,vcs) VALUES ('$matches[1]','$matches[4]','$matches[4]','$matches[5]','$matches[6]','$matches[7]','$matches[8]','$dist','$section','$matches[10]','$matches[14]','$matches[16]','$matches[18]','$matches[19]')");
+ $rst=@pg_exec($db, "INSERT INTO pkgs (name,version,dversionmangled,maint,dir,md5_atsource,bytes,dist,section,uploaders,homepage,vcs_browser,vcs_type,vcs,lastpkgsourcesupdate) VALUES ('$matches[1]','$matches[4]','$matches[4]','$matches[5]','$matches[6]','$matches[7]','$matches[8]','$dist','$section','$matches[10]','$matches[14]','$matches[16]','$matches[18]','$matches[19]',now())");
if (!$rst) {
$rsql=pg_exec($db, "SELECT pkgs.version FROM pkgs WHERE name='$matches[1]' AND dist='$dist';");
$version = $matches[4]; // just for safety
@@ -222,8 +222,10 @@
if ($version != $matches[4]) {
// only update the dversionmangled field if the versions differ
$extra = ",dversionmangled='$matches[4]'";
- // and reset wwiz_type
+ // also reset wwiz_type
$extra = ",wwiz_type=NULL";
+ // and update the lastpkgsourcesupdate field
+ $extra = ",lastpkgsourcesupdate=now()";
}
$rst=@pg_exec($db, "UPDATE pkgs SET name='$matches[1]',version='$matches[4]'$extra,maint='$matches[5]',dir='$matches[6]',md5_atsource='$matches[7]',bytes='$matches[8]',dist='$dist',section='$section',uploaders='$matches[10]',homepage='$matches[14]',vcs_browser='$matches[16]',vcs_type='$matches[18]',vcs='$matches[19]' WHERE name='$matches[1]' AND dist='$dist'") OR die_status("\nDb adding error =>" . pg_last_error() . "\n");
}
@@ -348,9 +350,10 @@
global $dirs,$dbconn;
$db = pg_pconnect($dbconn) or die_status(1/*pg_last_notice($db)*/);
if (!pg_table_exists($db, "pkgs")) {
- pg_exec($db, "CREATE TABLE pkgs (id serial PRIMARY KEY,name text,version text, dversionmangled text,maint text, uploaders text, dir text,watch text,md5_diff text,md5_atsource text,bytes numeric,dist text,section text,up_version text,up_changes text, up_url text,watch_warn text,updated bool, keep_changes bool, wwiz text,wwiz_version text, wwiz_type text, lastcheck timestamp, homepage text, vcs text, vcs_type text, vcs_browser text, lastupvsdebsync timestamp, pop_inst numeric,pop_vote numeric)") or die_status('Error creating table pkgs\n');
+ pg_exec($db, "CREATE TABLE pkgs (id serial PRIMARY KEY,name text,version text, dversionmangled text,maint text, uploaders text, dir text,watch text,md5_diff text,md5_atsource text,bytes numeric,dist text,section text,up_version text,up_changes text, up_url text,watch_warn text,updated bool, keep_changes bool, wwiz text,wwiz_version text, wwiz_type text, lastcheck timestamp, homepage text, vcs text, vcs_type text, vcs_browser text, lastupvsdebsync timestamp, lastpkgsourcesupdate timestamp, pop_inst numeric,pop_vote numeric)") or die_status('Error creating table pkgs\n');
pg_exec($db, "CREATE UNIQUE INDEX idxname on pkgs (name,dist)") or die_status('Errore creating index - ' . pg_last_error($db));
pg_exec($db, "CREATE INDEX checkx on pkgs (lastcheck)") or die_status('Errore creating index - ' . pg_last_error($db));
+ pg_exec($db, "CREATE INDEX updatex on pkgs (lastcheck,lastpkgsourcesupdate);") or die_status('Errore creating index - ' . pg_last_error($db));
pg_exec($db, "CREATE INDEX maintx on pkgs (maint)") or die_status('Errore creating index - ' . pg_last_error($db));
$sw=true;
}
@@ -696,7 +699,11 @@
$db = pg_pconnect($dbconn) ;
$bugurl="http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=tag&data=upstream&archive=no&show_list_header=no&pend-exc=done";
print "\nDownloading bugs list =>";
- $ferrors=file_get_contents($bugurl) or die_status ("I can't keep error page from bugs.debian.org");
+ if (!($ferrors=file_get_contents($bugurl))) {
+ /*die_status ("I can't keep error page from bugs.debian.org");*/
+ fwrite(STDERR, "I can't keep error page from bugs.debian.org, but not aborting");
+ return false;
+ }
print "Done\n";
$ferrors=explode("<li>",$ferrors);
$totline=count($ferrors);
@@ -996,7 +1003,10 @@
global $dbconn;
check_db();
$db = pg_pconnect($dbconn);
- $sql="SELECT name FROM pkgs WHERE (md5_diff!=md5_atsource or md5_diff is null) or (lastcheck is null and watch is not null)";
+ $sql = "SELECT name FROM pkgs WHERE"
+ ." (md5_diff!=md5_atsource or md5_diff is null)"
+ ." or (lastcheck is null and watch is not null)"
+ ." or (lastpkgsourcesupdate<lastcheck)";
$rsql=pg_exec($db, $sql);
$res_array=pg_fetch_all($rsql);
pg_close($db);
More information about the Dehs-devel
mailing list