[Dehs-devel] r85 - trunk
atomo64-guest at alioth.debian.org
atomo64-guest at alioth.debian.org
Tue Dec 18 21:01:46 UTC 2007
Author: atomo64-guest
Date: 2007-12-18 21:01:45 +0000 (Tue, 18 Dec 2007)
New Revision: 85
Modified:
trunk/dehs_pg.php
Log:
Removed extra %'s so updating a single package really updates only that one
Make sure the database only contains the existing binary and source packages
Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php 2007-12-18 20:49:31 UTC (rev 84)
+++ trunk/dehs_pg.php 2007-12-18 21:01:45 UTC (rev 85)
@@ -64,7 +64,7 @@
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("-dl_popcon",$argv) || in_array("-keep_popcon",$argv)) dl_popcon($argv[2]);
- elseif (in_array("-db_upstream",$argv)) db_upstream($argv[2]);
+ elseif (in_array("-db_upstream",$argv)) db_upstream((!empty($argv[2])?$argv[2]:'%'));
elseif (in_array("-update_all",$argv)) update_all();
elseif (in_array("-update_new",$argv)) update_new();
elseif (in_array("-update_bogus",$argv)) update_bogus();
@@ -72,8 +72,8 @@
elseif (in_array("-dehsqa_db",$argv)) dehsqa_db();
elseif (in_array("-clear_db",$argv)) clear_db();
elseif (in_array("-db_up_error",$argv)) db_up_error();
- elseif (in_array("-up_changes",$argv)) up_changes($argv[2], true);
- elseif (in_array("-watchf",$argv) || in_array("-wwiz",$argv)) watch_wizard((!empty($argv[2])?$argv[2]:''));
+ elseif (in_array("-up_changes",$argv)) up_changes((!empty($argv[2])?$argv[2]:'%'), true);
+ elseif (in_array("-watchf",$argv) || in_array("-wwiz",$argv)) watch_wizard((!empty($argv[2])?$argv[2]:'%'));
elseif (in_array("-kb_total",$argv)) print "Diff
#stat_up_error();
#stat_up_error();to download Kb => " . kb_total($argv[2]) . "\n" ;
@@ -230,8 +230,7 @@
gzclose($zp) ;
}
}
- if ($clear_db)
- clear_db($db);
+ clear_db($db, $clear_db);
pg_close($db);
}
function db_query($pkg,$dist='%') {
@@ -381,7 +380,7 @@
#else
return "/debian/dists";
}
-function clear_db(&$db) {
+function clear_db(&$db, $fullClean = true) {
#global $dbconn;
#if (check_db()) die_status("Il Database era vuoto\n");
#download_sources();
@@ -391,7 +390,9 @@
$sql2= "Delete from pkgs where id NOT IN (select id FROM pkgs INNER JOIN pkgs_atsrc USING (name,dist))" ;
$sql3= "UPDATE pkgs SET wwiz=NULL, wwiz_type=NULL, wwiz_version=NULL WHERE watch IS NOT NULL or watch!=''" ;
$sql4= "UPDATE pkgs SET up_changes=NULL WHERE wwiz_version=up_version OR up_version=version" ;
- if(pg_exec($db,$sql1) AND pg_exec($db,$sql2) AND pg_exec($db,$sql3) AND pg_exec($db,$sql4)) print "Db clear complete\n";
+ if(pg_exec($db,$sql1) && pg_exec($db,$sql2) && (!$fullClean || (pg_exec($db,$sql3) && pg_exec($db,$sql4)))) {
+ print "Db clear complete\n";
+ }
}
function db_popcon($initial='') {
global $dirs,$dbconn;
@@ -441,7 +442,7 @@
global $dirs,$dbconn;
check_db();
$db = pg_pconnect($dbconn) ;
- $rsql=pg_exec($db, "SELECT id, pkgs.name,pkgs.dist,up_version,version,watch FROM pkgs WHERE watch is not null AND name LIKE '$initial%' ORDER BY name DESC");
+ $rsql=pg_exec($db, "SELECT id, pkgs.name,pkgs.dist,up_version,version,watch FROM pkgs WHERE watch is not null AND name LIKE '$initial' ORDER BY name DESC");
$tot=pg_numrows($rsql);
while ($res_array=pg_fetch_array($rsql)) {
$uscan_res=uscan_foo($res_array['name'],$res_array['version'],$res_array['watch']);
@@ -531,7 +532,7 @@
$changes_files=array("CHANGES","NEWS","Changelog","ChangeLog","changelog");
$db = pg_pconnect($dbconn) ;
- $rsql=pg_exec($db, "SELECT id,up_url FROM pkgs WHERE up_url!='' AND keep_changes='t' AND name LIKE '$src_name%'");
+ $rsql=pg_exec($db, "SELECT id,up_url FROM pkgs WHERE up_url!='' AND keep_changes='t' AND name LIKE '$src_name'");
$tot=pg_numrows($rsql);
while ($res_array=pg_fetch_array($rsql)) {
$localfile=tempnam("/tmp/", "dehs-" . $res_array[id] . ".tar.gz");
@@ -683,7 +684,7 @@
$sqlstring="SELECT mpop_inst,name,pkgs.version,pkgs.dversionmangled,pkgs.section,pkgs.dist,tot_up_error, tot_avg_error_date, wwiz_version FROM pkgs INNER JOIN
(Select max(pop_inst) as mpop_inst,SUM(up_error) as tot_up_error,AVG(avg_error_date) as tot_avg_error_date,name,dist FROM binpkgs GROUP BY name,dist HAVING max(pop_inst) IS NOT NULL) as binpkgs using(name,dist)
- WHERE (watch IS NULL OR watch='') AND name LIKE '$src_name%' ORDER BY mpop_inst DESC";
+ WHERE (watch IS NULL OR watch='') AND name LIKE '$src_name' ORDER BY mpop_inst DESC";
$rsql=pg_exec($db, $sqlstring);
while ($res_array=pg_fetch_array($rsql)) {
@@ -876,6 +877,7 @@
function update_all() {
global $email;
$intime=gmdate('D, d M Y H:i:s \C\E\S\T',time()+3600*2);
+ echo __FUNCTION__ . ' started the ' . $intime . "\n";
db_add();
dl_popcon();
db_popcon();
@@ -895,6 +897,7 @@
function update_new() {
global $email_all;
$intime=gmdate('D, d M Y H:i:s \C\E\S\T',time()+3600*2);
+ echo __FUNCTION__ . ' started the ' . $intime . "\n";
db_add('',false);
dl_popcon();
db_popcon();
@@ -927,6 +930,7 @@
function update_bogus() {
global $email_all,$dbconn;
$intime=gmdate('D, d M Y H:i:s \C\E\S\T',time()+3600*2);
+ echo __FUNCTION__ . ' started the ' . $intime . "\n";
check_db();
$db = pg_pconnect($dbconn);
$sql="SELECT name FROM pkgs WHERE up_version='' AND watch!=''";
More information about the Dehs-devel
mailing list