[Dehs-devel] r62 - trunk

atomo64-guest at alioth.debian.org atomo64-guest at alioth.debian.org
Tue Dec 4 23:59:29 UTC 2007


Author: atomo64-guest
Date: 2007-12-04 23:59:28 +0000 (Tue, 04 Dec 2007)
New Revision: 62

Modified:
   trunk/dehs.config.inc
   trunk/dehs_pg.php
Log:
The "before normal dehs' run commit":
Reduced the number of attempts to find a working watch file on the watch wizard (uversionmangle fun) caused by using different file extensions
Improved the sf.net packages detection by first using a mix of sf.net/PARTMATCH/PACKAGENAME

Modified: trunk/dehs.config.inc
===================================================================
--- trunk/dehs.config.inc	2007-12-02 04:26:47 UTC (rev 61)
+++ trunk/dehs.config.inc	2007-12-04 23:59:28 UTC (rev 62)
@@ -16,7 +16,7 @@
 $uscan=$base.'/uscan.pl';
 $sfIgnore = array('dl','download','prdownload','downloads','lists','cvs','svn','www');
 $watchFileExts = array('tar.*', 'tgz', 'zip', 'gz');
-/*1: watch url, 2: $space, 3: name, 4: file ext*/
-$watchFormat = 'version=3' . "\n" . '%1$s%2$s%3$s-?_?([\d+\.]+|\d+)\.%4$s debian uupdate';
+/*1: watch url, 2: $space, 3: name, 4: file ext, 5: extra options*/
+$watchFormat = 'version=3' . "\n" . '%5$s' . "\n" . '%1$s%2$s%3$s-?_?([\d+\.]+|\d+)\.%4$s debian uupdate';
 $fetchUpstreamChanges = false;
 ?>
\ No newline at end of file

Modified: trunk/dehs_pg.php
===================================================================
--- trunk/dehs_pg.php	2007-12-02 04:26:47 UTC (rev 61)
+++ trunk/dehs_pg.php	2007-12-04 23:59:28 UTC (rev 62)
@@ -639,6 +639,22 @@
 	WHERE (watch IS NULL OR watch='') AND name LIKE '$src_name%' ORDER BY mpop_inst DESC";
     $rsql=pg_exec($db, $sqlstring);
 
+    // prepare some stuff that needs to be done once per run
+    $opts = '';
+    $exts  = '(';
+
+    foreach ($watchFileExts as $ext) {
+        $exts .= $ext . '|';
+    }
+    unset($ext);
+
+    $exts = substr($exts, 0, -1) . ')';
+    if ($exts == '()') {
+        $exts = '';
+    } else {
+        $opts = 'opts=uversionmangle=s/\.' . $exts . '$// \\';
+    }
+
     while ($res_array=pg_fetch_array($rsql)) {
 
         if (substr($res_array["name"],0,3)=='lib')
@@ -673,6 +689,7 @@
                 preg_match("/([^\d]+)/",$res_array['name'],$dmatches);
                 $depured_debian_name=$dmatches[1];
                 /*$matches[1]="ftp://download.sf.net/pub/sourceforge/" . substr($depured_debian_name,0,1) . "/" . substr($depured_debian_name,0,2) . "/" . $depured_debian_name . "/";*/
+                $generatedWatches[]=array('url'=>"http://sf.net/" . $depured_debian_name . "/");
                 $generatedWatches[]=array('url'=>"http://sf.net/" . $depured_debian_name . "/",'name'=>$depured_debian_name);
 
             }
@@ -723,15 +740,13 @@
 
                     $tWatch = array_merge($defs, $tWatch);
 
-                    foreach ($watchFileExts as $ext) {
 
-                        $watch = sprintf($watchFormat, $tWatch['url'], $tWatch['space'], $tWatch['name'], $ext);
+                    $watch = sprintf($watchFormat, $tWatch['url'], $tWatch['space'], $tWatch['name'], $exts, $opts);
 
-                        $uscan_res=uscan_foo($res_array['name'] ,$res_array['version'],$watch);
+                    $uscan_res=uscan_foo($res_array['name'] ,$res_array['version'],$watch);
 
-                        if ($uscan_res[0]) {
-                            break 2;
-                        }
+                    if ($uscan_res[0]) {
+                        break 2;
                     }
                 }
 




More information about the Dehs-devel mailing list