]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm-php-requires.php
- cleanup java deps generator
[packages/rpm.git] / rpm-php-requires.php
index 002c083139322bbf775bc4da4443012c56cf4cdf..b39802993bc09d5d25656eb32939a69a054b101e 100644 (file)
@@ -1,5 +1,9 @@
 #!/usr/bin/php
 <?php
+/*
+ * minify.spec does not see these: pear(HTTP/ConditionalGet.php) pear(HTTP/Encoder.php)
+ * perl version does
+ */
 /**
  *
  * Check system dependences between php-pear modules.
@@ -8,6 +12,8 @@
  * Michał Moskal <malekith@pld-linux.org> (Perl version)
  * Elan Ruusamäe <glen@pld-linux.org>
  *
+ * URL: <http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm/rpm-php-requires.php>
+ *
  * Requires: php-pear-PHP_CompatInfo
  * Requires: php-pcre
  */
@@ -38,25 +44,25 @@ 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;
                        }
 
-                       while (preg_match("/(\W|^)(require|include)(_once)?
+                       if (preg_match("/(\W|^)(require|include)(_once)?
                                        \s* \(? \s*
                                        (\"([^\"]*)\"|'([^']*)')
                                        \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;
                                }
 
@@ -71,20 +77,20 @@ function peardeps($files) {
                                continue;
                        }
 
-                       while (preg_match("/(\W|^)(require|include)(_once)?
+                       if (preg_match("/(\W|^)(require|include)(_once)?
                                        \s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s*
                                        (\"([^\"]*)\"|'([^']*)')
                                        \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 +98,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;
                        }
@@ -137,11 +146,16 @@ function extdeps($files) {
                if ($ext == 'bz2') {
                        $ext = 'bzip2';
                }
-               // ereg
-               if ($ext == 'ereg') {
-                       // not yet
-                       continue;
+               // libxml ext is in php-xml package
+               if ($ext == 'libxml') {
+                       $ext = 'xml';
                }
+
+               // these need to be lowercased
+               if (in_array($ext, array('SPL', 'PDO', 'SQLite', 'Reflection', 'SimpleXML'))) {
+                       $ext = strtolower($ext);
+               }
+
                printf("$fmt\n", $ext);
        }
 }
This page took 0.043121 seconds and 4 git commands to generate.