[Dehs-devel] r148 - trunk/www

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Thu Jul 10 01:54:52 UTC 2008


Author: atomo64-guest
Date: 2008-07-10 01:54:52 +0000 (Thu, 10 Jul 2008)
New Revision: 148

Modified:
   trunk/www/index.php
   trunk/www/maintainer.php
Log:
www/index.php: point to report.php instead with the new args
www/maintainer.php:
* Extract comments from the watch file and display them
if there is no upstream version and uscan didn't complain.
* Strip milliseconds from the "Last time checked"
* Remove anything following a question mark in the source uri's basename
* Use 'login' and 'package' instead of 'maint' and 'name' by default
  + But still support the old names
  + Also auto append @debian.org if login is made of \w and \d only
* Display the total number of continuous failures, if any


Modified: trunk/www/index.php
===================================================================
--- trunk/www/index.php	2008-07-08 20:41:13 UTC (rev 147)
+++ trunk/www/index.php	2008-07-10 01:54:52 UTC (rev 148)
@@ -10,18 +10,18 @@
 <div style="text-align: center;">
 <h1><img src="http://www.debian.org/logos/openlogo-nd-50.png" style="border:0px;" alt='' height='30.5px' width='25px'>&nbsp;<a href="http://dehs.alioth.debian.org/" style="color:black;font-size:35px">Debian External Health Status</a>&nbsp;<img src="/earth.png" style="border:0px;" alt='' height='30.5px' width='30.5px'></h1>
 <? include("menu.inc"); ?>
-<form action="/maintainer.php" method="get">
-By&nbsp;Maintainer:&nbsp;<input type="text" name="maint" value="foo at bar.com" onclick="this.value=(this.value=='foo at bar.com')?'':this.value;"/>
+<form action="/report.php" method="get">
+By&nbsp;Maintainer:&nbsp;<input type="text" name="login" value="foo at bar.com" onclick="this.value=(this.value=='foo at bar.com')?'':this.value;"/>
 <input type="submit" name="Display">
 </form>
-<form action="/maintainer.php" method="get">
-By&nbsp;package:&nbsp;<input type="text" name="name" value="libfoo" onclick="this.value=(this.value=='libfoo')?'':this.value;"/>
+<form action="/report.php" method="get">
+By&nbsp;package:&nbsp;<input type="text" name="package" value="libfoo" onclick="this.value=(this.value=='libfoo')?'':this.value;"/>
 <input type="submit" name="Display">
 </form>
 </div>
 <small><div style="text-align: center;">All the scripts are copyright 2004 by <a href='mailto:bluefuture at nospam@email.it'>Stefano Fabri</a>, and some Copyright 2007, 2008 by <a href='mailto:atomo64 at gmail@spam.com'>Raphael Geissert</a>
 <br>
 Contact: <a href="http://lists.alioth.debian.org/mailman/listinfo/dehs-devel">dehs-devel at lists.alioth.d.o</a>
-<br>Source code is available under the GPL terms <a href="http://svn.debian.org/">here</a> in the <a href="http://svn.debian.org/wsvn/dehs/">Subversion repository</a></br></div></small>
+<br>Source code is available under the GPL terms in the <a href="http://svn.debian.org/wsvn/dehs/">Subversion repository</a></br></div></small>
 </body>
 </html>

Modified: trunk/www/maintainer.php
===================================================================
--- trunk/www/maintainer.php	2008-07-08 20:41:13 UTC (rev 147)
+++ trunk/www/maintainer.php	2008-07-10 01:54:52 UTC (rev 148)
@@ -22,13 +22,21 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-  <meta content="text/html; charset=ISO-8859-1"
+  <meta content="text/html; charset=UTF-8"
  http-equiv="content-type">
 <?php
-if (isset($_GET['maint']) && !empty($_GET['maint'])) {
-    $title = 'DEHS report for ' . $_GET['maint'];
-} else if (isset($_GET['name']) && !empty($_GET['name'])) {
-    $title = 'DEHS report for package ' . $_GET['name'];
+
+if (isset($_GET['maint']) && !isset($_GET['login'])) $_GET['login'] = $_GET['maint'];
+if (isset($_GET['name']) && !isset($_GET['package'])) $_GET['package'] = $_GET['name'];
+
+if (isset($_GET['login']) && preg_match('/^[\w\d]+$/i', $_GET['login'])) {
+    $_GET['login'] .= '@debian.org';
+}
+
+if (isset($_GET['login']) && !empty($_GET['login'])) {
+    $title = 'DEHS report for ' . $_GET['login'];
+} else if (isset($_GET['package']) && !empty($_GET['package'])) {
+    $title = 'DEHS report for package ' . $_GET['package'];
 } else {
     $title = 'DEHS web query';
 }
@@ -44,17 +52,18 @@
 define('PBAR', true);
 include("menu.inc");
 require("config_www.inc");
-$maint='%';
-$name='%';
-if (!isset($_GET['maint']) AND !isset($_GET['name'])) exit('<span style="color: rgb(255, 0, 0);">No search parameter submitted</span>');
-if (isset($_GET['maint']) AND !$_GET[maint]) exit('<span style="color: rgb(255, 0, 0);">Maintainer email not submitted</span>');
-elseif ($_GET['maint']) $maint=$_GET[maint];
-if (isset($_GET['name']) AND !$_GET[name]) exit('<span style="color: rgb(255, 0, 0);">Package name not submitted</span>');
-elseif ($_GET[name]) $name=$_GET['name'];
+$login='%';
+$package='%';
 
-$maint = pg_escape_string($maint);
-$name  = pg_escape_string($name);
+if (!isset($_GET['login']) && !isset($_GET['package'])) exit('<span style="color: rgb(255, 0, 0);">No search parameter submitted</span>');
+if (isset($_GET['login']) && !$_GET['login']) exit('<span style="color: rgb(255, 0, 0);">Maintainer email not submitted</span>');
+elseif ($_GET['login']) $login=$_GET['login'];
+if (isset($_GET['package']) AND !$_GET['package']) exit('<span style="color: rgb(255, 0, 0);">Package name not submitted</span>');
+elseif ($_GET['package']) $package=$_GET['package'];
 
+$login = pg_escape_string($login);
+$package  = pg_escape_string($package);
+
 ?>
 <center><table bgcolor="#BBDDFF" border="0" cellpadding="0" cellspacing="0" summary="">
   <tr>
@@ -72,7 +81,7 @@
         <a href="#no_updated">Pkgs not in sync with upstream</a>
     </div>
     <div>
-        <a href="#no_upstream">Pkgs with watch file but no upstream version checkable</a> |
+        <a href="#no_upstream">Pkgs with watch file but no checkable upstream</a> |
         <a href="#ok">Pkgs up to date</a>
     </div>
 </div></td>
@@ -89,20 +98,20 @@
 
 $sql=ARRAY(no_updated=>"Select id,pkgs.pop_inst,name,section,version,tot_up_error,tot_avg_error_date,pkgs.dist,up_version,watch_warn, up_changes,up_url,dversionmangled,lastupvsdebsync,lastcheck from pkgs
 INNER join (Select 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 up_version!='' AND (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name'
+where updated='0' AND up_version!='' AND (maint LIKE '$login' OR uploaders LIKE '%$login%') AND name LIKE '$package'
 order by pop_inst desc;",
-no_upstream=>"select id,pkgs.pop_inst,name,section,version, tot_up_error, tot_avg_error_date, pkgs.dist,watch_warn,up_changes, up_version,up_url,dversionmangled,lastupvsdebsync,lastcheck  from pkgs INNER JOIN (Select 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 pop_inst desc;",
+no_upstream=>"select id,pkgs.pop_inst,name,section,version, tot_up_error, tot_avg_error_date, pkgs.dist,watch_warn,up_changes, up_version,up_url,dversionmangled,lastupvsdebsync,lastcheck,failures_count,watch  from pkgs INNER JOIN (Select 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 '$login' OR uploaders LIKE '%$login%') AND name LIKE '$package' order by pop_inst desc;",
 no_watch=>"SELECT id,pkgs.pop_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,lastupvsdebsync,lastcheck FROM pkgs INNER JOIN
 (Select 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 (watch IS NULL OR watch='') AND (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name' ORDER BY pop_inst DESC;",
+WHERE (watch IS NULL OR watch='') AND (maint LIKE '$login' OR uploaders LIKE '%$login%') AND name LIKE '$package' ORDER BY pop_inst DESC;",
 ok=>"Select id,pkgs.pop_inst,name,section,version,tot_up_error,tot_avg_error_date,pkgs.dist,up_version,watch_warn, up_changes,up_url,dversionmangled,lastupvsdebsync,lastcheck from pkgs
 INNER join (Select 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 (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name' AND (up_version != '' AND up_version IS NOT NULL)
+where updated='1' AND (maint LIKE '$login' OR uploaders LIKE '%$login%') AND name LIKE '$package' AND (up_version != '' AND up_version IS NOT NULL)
 order by pop_inst desc;");
 foreach($sql as $key => $value) {
 	$rs=pg_exec($db,$value) OR Die("Error on query");
-	$qta=pg_exec($db, "SELECT count(name) from pkgs WHERE (maint LIKE '$maint' OR uploaders LIKE '%$maint%') AND name LIKE '$name' ") OR Die("Errore on query");
+	$qta=pg_exec($db, "SELECT count(name) from pkgs WHERE (maint LIKE '$login' OR uploaders LIKE '%$login%') AND name LIKE '$package' ") OR Die("Errore on query");
 	$totrs=pg_numrows($rs);
 	$totpkgs=pg_fetch_array($qta,0);
 	if ($totrs>0) {
@@ -164,7 +173,7 @@
 			<?} else print $res_array["wwiz_version"];
 			}
 			else {
-			      print "None";
+			      print "none";
 				  $res_array["wwiz_version"]="N/A";
 				 }
 			?></li>
@@ -177,10 +186,10 @@
 		  		<? print $res_array["up_version"]; ?></a>
 			<?} else print $res_array["up_version"];
 			}
-			else print "None";?></li>
+			else print "none";?></li>
 <? }
 if (!empty($res_array['up_url'])) {
-    echo '<li><b>Source download: </b> <a href="' . htmlentities($res_array['up_url']) . '">' . htmlentities(basename($res_array['up_url'])) . '</a></li>';
+    echo '<li><b>Source download: </b> <a href="' . htmlentities($res_array['up_url']) . '">' . htmlentities(preg_replace('/(.+?)\?.*/','$1',basename($res_array['up_url']))) . '</a></li>';
 }
 ?>
 <li><b>Debian Version: </b><? print htmlentities($res_array["version"]);
@@ -188,8 +197,13 @@
     echo ' <span style="white-space: nowrap;">(mangled:&nbsp;<i>' . htmlentities($res_array["dversionmangled"]) . '</i>)</span>';
 }
 ?></li>
-<li><b>Last time checked: </b><? echo htmlentities($res_array['lastcheck']); ?></li>
-<li><b>Last time found as updated: </b><? echo htmlentities($res_array['lastupvsdebsync']); ?></li>
+<li><b>Last time checked: </b><? echo htmlentities(preg_replace('/\..+/','',$res_array['lastcheck'])); ?></li>
+<li><b>Last time found up to date: </b><? echo htmlentities($res_array['lastupvsdebsync']); ?></li>
+<?php
+if (isset($res_array['failures_count'])) {
+    ?><li><b>Total continuous failures: </b><? echo $res_array['failures_count']; ?></li><?php
+}
+?>
 <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>
@@ -204,11 +218,22 @@
 		else print "N/A";
 	?></li>
 <?}?>
-<? if ($key!="no_watch") { ?>
-<li><b>Watch: </b><a href="<? print "wwiz_detail.php?id=$res_array[id]&amp;type=watch";?>">View</a></li>
-<?}?>
-<li><b>Uscan Errors processing Watch File: </b><? $res_array["watch_warn"] ? print "<br>" . nl2br(htmlentities($res_array["watch_warn"])) : print "No errors"; ?></li>
-<li><b>Copyright: </b><? print "<a href=" . htmlentities(changelog($res_array)) . ">" . "View</a>"; ?></li>
+<? if ($key!="no_watch") { 
+$watch_comments = '';
+if (!$res_array['up_version'] && isset($res_array['watch'])) {
+    $watch_comments = trim(preg_replace('/^(\s*[^#]+.*$|\s*#)/m','',$res_array['watch']),"\n\r\0\x0B");
+}
+?>
+<li><b>Watch: </b><a href="<? print "wwiz_detail.php?id=$res_array[id]&amp;type=watch";?>">view</a><? if($watch_comments) echo "&nbsp;<small>(comments&nbsp;below)</small>"; ?></li>
+<?php
+    if ($watch_comments) {
+        ?><pre>
+<? echo htmlentities($watch_comments); ?>
+</pre><?php
+    }
+}?>
+<li><b>Uscan errors: </b><? $res_array["watch_warn"] ? print "<br>" . nl2br(htmlentities($res_array["watch_warn"])) : print "No errors"; ?></li>
+<li><b>Copyright: </b><? print "<a href='" . htmlentities(changelog($res_array)) . "'>" . "view</a>"; ?></li>
 </ul>
 </ul>
 </td>
@@ -220,12 +245,12 @@
 </table>
 <hr>
 <?php   }
-
+/* Who uses this? I guess nobody
         print "<!-- Machine-readable: " . $res_array['name'] . " " .
         $res_array["version"] . " " .
         $res_array["up_version"]  . " " .
         $res_array["wwiz_version"] . " -->";
-
+*/
 //        $c = (1 == $c)? 2 : 1;
 
         }




More information about the Dehs-devel mailing list