]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- use pear PHP_Compatinfo to find extension deps
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 21 Oct 2008 23:47:55 +0000 (23:47 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm-php-requires.php -> 1.1

rpm-php-requires.php [new file with mode: 0644]

diff --git a/rpm-php-requires.php b/rpm-php-requires.php
new file mode 100644 (file)
index 0000000..9ab527c
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/php
+<?php
+/**
+ * Get the Compatibility info for an entire folder (recursive)
+ *
+ */
+
+require_once 'PHP/CompatInfo.php';
+
+$info = new PHP_CompatInfo('null');
+
+$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";
+
+# process extensions
+foreach ($res['extensions'] as $ext) {
+       if (in_array($ext, $staticmods)) {
+               continue;
+       }
+
+       if ($compat) {
+               echo "Requires:\tphp(", $ext, ")\n";
+       } else {
+               echo "Requires:\tphp-", $ext, "\n";
+       }
+}
This page took 0.044543 seconds and 4 git commands to generate.