[Dehs-devel] r78 - in trunk: . www

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Sun Dec 16 23:37:18 UTC 2007


Author: atomo64-guest
Date: 2007-12-16 23:37:18 +0000 (Sun, 16 Dec 2007)
New Revision: 78

Modified:
   trunk/dehs_pg.php
   trunk/www/maintainer.php
Log:
dehs_pg.php: Determine based on the Levenshtein distance if the upstream version gathered by a wwiz-generated watch is 'valid'
maintainer.php: Added links to the PTS and popcon page, also displaying the mangled Debian version when different from the non-mangled one

Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php	2007-12-16 01:53:08 UTC (rev 77)
+++ trunk/dehs_pg.php	2007-12-16 23:37:18 UTC (rev 78)
@@ -340,6 +340,11 @@
         pg_exec($db, "CREATE UNIQUE INDEX idxbin on binpkgs (name,bin_name,dist)") or die_status('Errore creating index - ' . pg_last_error($db));
         $sw=true;
     }
+    /*if (!pg_table_exists($db,"events")){
+        pg_exec($db, "CREATE TABLE events (id serial PRIMARY KEY, name text,type text, dist text)") or die_status('Error creating table binpkgs\n');
+        pg_exec($db, "CREATE UNIQUE INDEX idxevents on events (name,dist)") or die_status('Errore creating index - ' . pg_last_error($db));
+        $sw=true;
+    }*/
     #if (!pg_table_exists($db,"upstream")){
     #  pg_exec($db, "CREATE TABLE upstream (name text,dist text,up_version text,watch_warn text,updated bool)") or die_status('Errore nel creare la tabella');
     #  pg_exec($db, "CREATE UNIQUE INDEX idxupstrm on upstream (name,dist)") or die_status('Errore nel creare gli indici ' . pg_last_error($db));
@@ -402,8 +407,8 @@
             if (preg_match($regexp,$line,$matches)) {
                 #print "\rName => $matches[1] Install => $matches[2] Vote => $matches[3]";
                 @pg_exec($db, "UPDATE binpkgs SET pop_inst='$matches[2]',pop_vote='$matches[3]' WHERE bin_name='$matches[1]'");
-                $prcessed++;
-                /*$elapsed_time=time()-$tin;
+                /*$processed++;
+                $elapsed_time=time()-$tin;
                 if (($elapsed_time % 20)==0 AND $updtime!=$elapsed_time) {
                     $updtime=$elapsed_time;
                     $wprocessed=$processed-$wprocessed;
@@ -420,23 +425,6 @@
     }
     @pg_close($db);
 }
-function db_popcon_test() {
-    global $dirs,$dbconn;
-    $db = pg_pconnect($dbconn)  or  die_status(pg_last_error($db));
-    $filename=$dirs[popcon_dir] . "/all-popcon-results.txt.gz";
-    $regexp="/Package:\s(\S+)\s+(\d+)\s+(\d+)/";
-    $zp = gzfile($filename, "r") or die_status("Could not open $filename");
-    if(filesize($filename)>20) {
-        foreach ($zp as $line) {
-            if (preg_match($regexp,$line,$matches)) {
-                # print "Name => $matches[1] \n Install => $matches[2] \n Vote => $matches[3]\n";
-                print "\r" . $i++;
-                #pg_unbuffered_query($db, "UPDATE binpkgs SET pop_inst='$matches[2]',pop_vote='$matches[3]' WHERE bin_name='$matches[1]'");
-            }
-        }
-    }
-    @pg_close($db);
-}
 function dl_popcon() {
     global $dirs,$dbconn;
     $localfile=$dirs[popcon_dir] . "/all-popcon-results.txt.gz";
@@ -482,7 +470,7 @@
         }
         pg_exec($db, "UPDATE pkgs SET up_version='" . pg_escape_string($up_version) . "', dversionmangled='".pg_escape_string($dversionmangled)."',up_url='" . pg_escape_string($up_url) . "', watch_warn='" . $watch_warn . "',keep_changes='$keep_changes', wwiz_version=NULL, wwiz_type=NULL, wwiz=NULL, updated='$updated' WHERE id=$res_array[id]") or die_status("Error in update pkgs upstream");
         #print "\rUpdated " . $res_array['name'] .  " => $updated Up Version => ". $uscan_res[0];
-        print "\tUpstream left => " . $tot --;
+        print "\t Upstream left => " . $tot --;
         #				}
         #							else print "Added ". $res_array['name'] ."\n";
         #	if ($great==0) {
@@ -794,7 +782,7 @@
 
                     $uscan_res=uscan_foo($res_array['name'] ,$res_array['version'],$watch);
 
-                    if ($uscan_res[0]) {
+                    if ($uscan_res[0] && levenshtein($uscan_res[0], $res_array['version']) < strlen($res_array['version'])) {
                         break;
                     }
                 }
@@ -818,9 +806,9 @@
                         $updated=is_updated($uscan_res[0],$dversionmangled);
                     }
 
-                    if (!$updated) {
+                    /*if (!$updated) {
                         events::newVersion($res_array['name'], $res_array['version'], $uscan_res[0], $res_array['dist']);
-                    }
+                    }*/
 
                     pg_exec($db, "UPDATE pkgs SET wwiz='" . pg_escape_string($watch) ."', wwiz_type='watch', wwiz_version='" . pg_escape_string($uscan_res[0]) . "',dversionmangled='".pg_escape_string($dversionmangled)."', up_url='" . pg_escape_string($uscan_res[2]) . "', keep_changes='$keep_changes', updated='$updated' where name='" . pg_escape_string($res_array[name]) . "' AND dist='" . $res_array[dist] ."'");
                 }

Modified: trunk/www/maintainer.php
===================================================================
--- trunk/www/maintainer.php	2007-12-16 01:53:08 UTC (rev 77)
+++ trunk/www/maintainer.php	2007-12-16 23:37:18 UTC (rev 78)
@@ -52,15 +52,15 @@
 $maint = pg_escape_string($maint);
 $name  = pg_escape_string($name);
 
-$sql=ARRAY(no_watch=>"SELECT id,mpop_inst,name,pkgs.version,pkgs.dist,tot_up_error, tot_avg_error_date,wwiz,wwiz_type,wwiz_version,maint,section,up_changes,up_url FROM pkgs INNER JOIN
+$sql=ARRAY(no_watch=>"SELECT id,mpop_inst,name,pkgs.version,pkgs.dist,tot_up_error, tot_avg_error_date,wwiz,wwiz_type,wwiz_version,maint,section,up_changes,up_url,dversionmangled 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 (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name' ORDER BY mpop_inst DESC;",
-no_upstream=>"select id,mpop_inst,name,section,version, tot_up_error, tot_avg_error_date, pkgs.dist,watch_warn,up_changes, up_version,up_url  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)
+no_upstream=>"select id,mpop_inst,name,section,version, tot_up_error, tot_avg_error_date, pkgs.dist,watch_warn,up_changes, up_version,up_url,dversionmangled  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)
 as binpkgs using(name,dist) where up_version='' AND watch!='' AND (maint LIKE '%$maint%' OR uploaders LIKE '$maint') AND name LIKE '$name' order by mpop_inst desc;",
-no_updated=>"Select id,mpop_inst,name,section,version,tot_up_error,tot_avg_error_date,pkgs.dist,up_version,watch_warn, up_changes,up_url from pkgs
+no_updated=>"Select id,mpop_inst,name,section,version,tot_up_error,tot_avg_error_date,pkgs.dist,up_version,watch_warn, up_changes,up_url,dversionmangled 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) as binpkgs using(name,dist)
 where updated='1' AND up_version!='' AND (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name'
-order by mpop_inst desc;",ok=>"Select id,mpop_inst,name,section,version,tot_up_error,tot_avg_error_date,pkgs.dist,up_version,watch_warn, up_changes,up_url from pkgs
+order by mpop_inst desc;",ok=>"Select id,mpop_inst,name,section,version,tot_up_error,tot_avg_error_date,pkgs.dist,up_version,watch_warn, up_changes,up_url,dversionmangled 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) as binpkgs using(name,dist)
 where updated='0' AND (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name'
 order by mpop_inst desc;");
@@ -96,9 +96,9 @@
 ?>
 <hr>
 <ul>
-<li><b>Name:</b> <? print $res_array["name"]; ?></li>
+<li><b>Name:</b> <a href="http://packages.qa.debian.org/<?=$res_array['name']?>"><? print $res_array["name"]; ?></a></li>
 <ul>
-<li><b>Pop Inst:</b> <? print $res_array["mpop_inst"]; ?></li>
+<li><b>Pop Inst:</b> <a href="http://qa.debian.org/popcon.php?package=<?=$res_array['mpop_inst']?>"><? print $res_array["mpop_inst"]; ?></a></li>
 <? if ($key=="no_watch") { ?>
 <li><b>WWiz Upstream Version:</b>
 		    <? if ($res_array["wwiz_version"]) {?>
@@ -127,10 +127,14 @@
     echo '<li><b>Source download: </b> <a href="' . htmlentities($res_array['up_url']) . '">' . htmlentities(basename($res_array['up_url'])) . '</a></li>';
 }
 ?>
-<li><b>Debian Version: </b><? print $res_array["version"]; ?></li>
+<li><b>Debian Version: </b><? print htmlentities($res_array["version"]);
+if ($res_array["dversionmangled"] != $res_array["version"]) {
+    echo '&nbsp;(mangled:&nbsp;<i>' . htmlentities($res_array["dversionmangled"]) . '</i>)';
+}
+?></li>
 <li><b>Tot Upstream Bugs: </b><? if ($res_array["tot_up_error"]) echo "<a href='http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=".urlencode($res_array["name"]).";dist=".urlencode($res_array["dist"]).";tag=upstream'>"; print number_format($res_array["tot_up_error"] ,0); if ($res_array["tot_up_error"]) echo '</a>'; ?></li>
 <li><b>Avg days opened: </b><? print number_format($res_array["tot_avg_error_date"],0); ?></li>
-<li><b>Distrib:</b><? printf('<a href="http://packages.debian.org/%1$s/%2$s">%1$s</a>',$res_array["dist"],$res_array["name"]); ?></li>
+<li><b>Distrib: </b><? printf('<a href="http://packages.debian.org/%1$s/%2$s">%1$s</a>',$res_array["dist"],$res_array["name"]); ?></li>
 <? if ($key=="no_watch") { ?>
 <li><b>Watch Wiz:</b>
 <?




More information about the Dehs-devel mailing list