]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- remove double slashes, simplify, todos
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 10 Mar 2010 23:03:38 +0000 (23:03 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm-php-requires.php -> 1.17

rpm-php-requires.php

index 0e21d6763aa91e8a3ae4ef5be4be0f8affb4a202..cad6c674dd7058e5538ea46782e1a8fbee5894bc 100644 (file)
@@ -38,7 +38,7 @@ function peardeps($files) {
                }
 
                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 @@ function peardeps($files) {
                                        (\"([^\"]*)\"|'([^']*)')
                                        \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 @@ function peardeps($files) {
                                        (\"([^\"]*)\"|'([^']*)')
                                        \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 @@ function peardeps($files) {
                                }
 
                                $x = "$file_dir/$x";
+                               // remove double slashes
+                               // TODO: resolve simpletest/test/../socket.php -> simpletest/socket.php
+                               $x = str_replace("//", "/", $x);
                                $req[$x] = 1;
                                continue;
                        }
This page took 0.101182 seconds and 4 git commands to generate.