Author: glen                         Date: Wed Oct 22 00:11:51 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- produce old style pear(Foo.php) deps too

---- Files affected:
SOURCES:
   rpm-php-provides.php (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/rpm-php-provides.php
diff -u SOURCES/rpm-php-provides.php:1.1 SOURCES/rpm-php-provides.php:1.2
--- SOURCES/rpm-php-provides.php:1.1    Wed Oct 22 01:47:55 2008
+++ SOURCES/rpm-php-provides.php        Wed Oct 22 02:11:45 2008
@@ -1,45 +1,77 @@
 #!/usr/bin/php
 <?php
+#####################################################################
+#                                                                   #
+# Check system dependences between php-pear modules                 #
+#                                                                   #
+# Paweł Gołaszewski <[EMAIL PROTECTED]>                           #
+# Michał Moskal <[EMAIL PROTECTED]>                            #
+# Elan Ruusamäe <[EMAIL PROTECTED]>                                #
+#####################################################################
+
 /**
- * Get the Compatibility info for an entire folder (recursive)
- *
+ * Produce old style pear(Path/To/File.php) deps
  */
+function peardeps($files) {
+       // all files must begin with $RPM_BUILD_ROOT%{php_pear_dir}
+       $prefix = RPM_BUILD_ROOT. PATH_SEPARATOR . PHP_PEAR_DIR;
+       $length = strlen($prefix);
+       foreach ($files as $f) {
+               if (substr($f, 0, $length) != $prefix) {
+                       continue;
+               }
+               $f = substr($f, $length);
+               echo "pear($f)\n";
+       }
+}
 
-require_once 'PHP/CompatInfo.php';
-
-$info = new PHP_CompatInfo('null');
+/**
+ * Produce dependencies for extensions using PEAR PHP_CompatInfo package.
+ */
+function extdeps($files) {
+       require_once 'PHP/CompatInfo.php';
 
-$folder  = $argv[1];
-$options = array(
-    'file_ext' => array('php'),
-);
-
-$res = $info->parseData($folder);
-if (version_compare($res['version'], '5.0.0', 'ge')) {
-       $epoch = 4;
-       // produce dependencies only for php5
-       $compat = false;
-       // session has always been compiled in
-       // date, spl are internal for php
-       $staticmods = array('session', 'date', 'spl');
-} else {
-       $epoch = 3;
-       // produce dependencies where php4/php5 both are ok
-       $compat = true;
-       // session has always been compiled in
-       $staticmods = array('session');
-}
-echo "Requires:\tphp-common >= ", $epoch, ":", $res['version'], "\n";
+       $info = new PHP_CompatInfo('null');
+       $res = $info->parseData($files);
 
-# process extensions
-foreach ($res['extensions'] as $ext) {
-       if (in_array($ext, $staticmods)) {
-               continue;
+       if (version_compare($res['version'], '5.0.0', 'ge')) {
+               $epoch = 4;
+               // produce dependencies only for php5
+               $compat = false;
+               // session has always been compiled in
+               // date, spl are internal for php
+               $staticmods = array('session', 'date', 'spl');
+       } else {
+               $epoch = 3;
+               // produce dependencies where php4/php5 both are ok
+               $compat = true;
+               // session has always been compiled in
+               $staticmods = array('session');
        }
+       echo "php-common >= ", $epoch, ":", $res['version'], "\n";
 
-       if ($compat) {
-               echo "Requires:\tphp(", $ext, ")\n";
-       } else {
-               echo "Requires:\tphp-", $ext, "\n";
+       // process extensions
+       foreach ($res['extensions'] as $ext) {
+               if (in_array($ext, $staticmods)) {
+                       continue;
+               }
+
+               if ($compat) {
+                       echo "php(", $ext, ")\n";
+               } else {
+                       echo "php-", $ext, "\n";
+               }
        }
 }
+
+define('RPM_BUILD_ROOT', getenv('RPM_BUILD_ROOT'));
+define('PHP_PEAR_DIR', '/usr/share/pear');
+
+if ($argc > 1) {
+       $files = array_splice($argv, 1);
+} else {
+       $files = split(PHP_EOL, trim(file_get_contents('php://stdin')));
+}
+
+peardeps($files);
+extdeps($files);
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/rpm-php-provides.php?r1=1.1&r2=1.2&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to