X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm-php-requires.php;h=85686bfcabb430664d1a3c7a9090c9aa03a76823;hb=53a7793d5201707129b2e21accd096a55c1fbeb4;hp=0e21d6763aa91e8a3ae4ef5be4be0f8affb4a202;hpb=11435866dfb6b27a70d150e0cd602f9169c74aa1;p=packages%2Frpm.git diff --git a/rpm-php-requires.php b/rpm-php-requires.php index 0e21d67..85686bf 100644 --- a/rpm-php-requires.php +++ b/rpm-php-requires.php @@ -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; } @@ -137,15 +140,12 @@ function extdeps($files) { if ($ext == 'bz2') { $ext = 'bzip2'; } - // SPL ext is in php-spl package - if ($ext == 'SPL') { - $ext = 'spl'; - } - // ereg - if ($ext == 'ereg') { - // not yet - continue; + + // these need to be lowercased + if (in_array($ext, array('SPL', 'PDO', 'SQLite', 'Reflection', 'SimpleXML'))) { + $ext = strtolower($ext); } + printf("$fmt\n", $ext); } }