packages: rpm/rpm-php-requires.php - remove double slashes, simplify, todos

glen glen at pld-linux.org
Thu Mar 11 00:03:46 CET 2010


Author: glen                         Date: Wed Mar 10 23:03:46 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- remove double slashes, simplify, todos

---- Files affected:
packages/rpm:
   rpm-php-requires.php (1.16 -> 1.17) 

---- Diffs:

================================================================
Index: packages/rpm/rpm-php-requires.php
diff -u packages/rpm/rpm-php-requires.php:1.16 packages/rpm/rpm-php-requires.php:1.17
--- packages/rpm/rpm-php-requires.php:1.16	Wed Mar 10 22:47:17 2010
+++ packages/rpm/rpm-php-requires.php	Thu Mar 11 00:03:38 2010
@@ -38,7 +38,7 @@
 		}
 
 		foreach (file($f) as $line) {
-			// skip comments
+			// skip comments -- not perfect, matches "*" at start of line (very rare altho)
 			if (preg_match('/^\s*(#|\/\/|\*|\/\*)/', $line)) {
 				continue;
 			}
@@ -48,15 +48,15 @@
 					(\"([^\"]*)\"|'([^']*)')
 					\s* \)? \s* ;/x", $line, $m)) {
 
-				if ($m[5] != "") {
+				if ($m[5]) {
 					$x = $m[5];
-				} else if ($m[6] != "") {
+				} else if ($m[6]) {
 					$x = $m[6];
 				} else {
 					continue 2;
 				}
 
-				if (substr($x, 0, 2) == './' || substr($x, -1) == '$') {
+				if (substr($x, 0, 2) == './' || substr($x, -1) == '$') {  # XXX must be: CONTAINS DOLLAR
 					continue 2;
 				}
 
@@ -76,15 +76,15 @@
 					(\"([^\"]*)\"|'([^']*)')
 					\s* \)? \s* ;/x", $line, $m)) {
 
-				if ($m[5] != "") {
+				if ($m[5]) {
 					$x = $m[5];
-				} else if ($m[6] != "") {
+				} else if ($m[6]) {
 					$x = $m[6];
 				} else {
 					continue 2;
 				}
 
-				if (substr($x, -1) == '$') {
+				if (substr($x, -1) == '$') { # XXX must be: CONTAINS DOLLAR
 					continue 2;
 				}
 				if (substr($x, -4) != '.php') {
@@ -92,6 +92,9 @@
 				}
 
 				$x = "$file_dir/$x";
+				// remove double slashes
+				// TODO: resolve simpletest/test/../socket.php -> simpletest/socket.php
+				$x = str_replace("//", "/", $x);
 				$req[$x] = 1;
 				continue;
 			}
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm/rpm-php-requires.php?r1=1.16&r2=1.17&f=u



More information about the pld-cvs-commit mailing list