Commit:    1bab72f88cfae9b16c5199ff69df9f6197d6ef67
Author:    Anatol Belski <[email protected]>         Mon, 9 Sep 2013 16:03:01 +0200
Parents:   dc11dd60386737a00a69bea763ec006077e23a2b
Branches:  master

Link:       
http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=1bab72f88cfae9b16c5199ff69df9f6197d6ef67

Log:
Added a fix for extension name mismatch

Currently it's the case with opcache. As we read the ext name
from the package.xml and it's zendopcache there, however config.w32
declares the --enable-opcache configure option. That mismatch
leads the build to fail.

Changed paths:
  M  client/data/config/pecl/exts.ini
  M  client/include/PeclExt.php


Diff:
diff --git a/client/data/config/pecl/exts.ini b/client/data/config/pecl/exts.ini
index 8484bc1..9083a02 100644
--- a/client/data/config/pecl/exts.ini
+++ b/client/data/config/pecl/exts.ini
@@ -178,3 +178,10 @@ libs[]=
 exts[]=
 opts[]=
 
+[zendopcache]
+real_name=opcache
+type=enable
+libs[]=
+exts[]=
+opts[]=
+
diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php
index e1f9e20..a2fabd0 100644
--- a/client/include/PeclExt.php
+++ b/client/include/PeclExt.php
@@ -43,14 +43,30 @@ class PeclExt
                if (!$this->name || !$this->version) {
                        /* This is the fallback if there's no package.xml  */
                        $tmp = explode('-', basename($tgz_path, '.tgz'));
-                       $this->name = !$this->name ?: $tmp[0];
-                       $this->version = !$this->version ?: $tmp[1];
+                       $this->name = !$this->name ? $tmp[0] : $this->name;
+                       $this->version = !$this->version ? $tmp[1] : 
$this->version;
 
                        if (!$this->name || !$this->version) {
                                throw new \Exception("Couldn't parse extension 
name or version neither from package.xml nor from the filename");
                        }
                }
 
+               $config = $this->getPackageConfig();
+               /* this ext is known*/
+               if (is_array($config)) {
+                       /* Correct the case where the package.xml contains 
different name than the config option.
+                          That's currently the case with zendopcache vs 
opcache. */
+                       if (isset($config['real_name']) && $this->name != 
$config['real_name']) {
+                               $new_path = dirname($this->tmp_extract_path) . 
'/' . $config['real_name'] . '-' . $this->version;
+                               if (!rename($this->tmp_extract_path, 
$new_path)) {
+                                       throw new Exception('Package name 
conflict, different names in package.xml and config.w32. Tried to solve but 
failed.');
+                               }
+
+                               $this->tmp_extract_path = $new_path;
+                               $this->name = $config['real_name'];
+                       }
+               }
+
        }
 
        public function getPackageName()
@@ -198,17 +214,10 @@ class PeclExt
                return $ret;
        }
 
-       public function getConfigureLine()
+       public function getPackageConfig()
        {
-               /* XXX check if it's enable or with,
-                       what deps it has
-                       what additional options it has
-                       what non core exts it deps on 
-               */
-
-               $config = array();
+               $config = NULL;
 
-               /* look if it's on the known ext list */
                $known_path = __DIR__ . '/../data/config/pecl/exts.ini';
                $exts = parse_ini_file($known_path, true, INI_SCANNER_RAW);
 
@@ -218,25 +227,42 @@ class PeclExt
                        }
                }
 
+               return $config;
+       }
+
+       public function getConfigureLine()
+       {
+               /* XXX check if it's enable or with,
+                       what deps it has
+                       what additional options it has
+                       what non core exts it deps on 
+               */
+
+               /* look if it's on the known ext list */
+               $config = $this->getPackageConfig();
+
                /* if it's not known yet, we have to gather the info */
-               $config_w32_path = $this->tmp_extract_path . 
DIRECTORY_SEPARATOR . 'config.w32';
-               foreach (array('enable' => 'ARG_ENABLE', 'with' => 'ARG_WITH') 
as $arg => $str) {
-                       if (preg_match(',' . $str .'.*' . $this->name . ',Sm', 
file_get_contents($config_w32_path))) {
-                               $config['type'] = $arg;
+               if (!$config) {
+                       $config = array();
+
+                       $config_w32_path = $this->tmp_extract_path . 
DIRECTORY_SEPARATOR . 'config.w32';
+                       foreach (array('enable' => 'ARG_ENABLE', 'with' => 
'ARG_WITH') as $arg => $str) {
+                               if (preg_match(',' . $str .'.*' . $this->name . 
',Sm', file_get_contents($config_w32_path))) {
+                                       $config['type'] = $arg;
+                               }
+                       }
+                       if (!isset($config['type'])) {
+                               throw new \Exception("Couldn't determine 
whether 'with' or 'enable' configure option to use");
                        }
-               }
-               if (!isset($config['type'])) {
-                       throw new \Exception("Couldn't determine whether 'with' 
or 'enable' configure option to use");
-               }
 
-               /* XXX Extension deps have to be checked here using
-               $this->package_xml->dependencies; */
+                       /* XXX Extension deps have to be checked here using
+                       $this->package_xml->dependencies; */
 
-               /* XXX Library deps have to be checked using 
-               $this->tmp_extract_path . DIRECTORY_SEPARATOR . 
'lib_versions.txt'; */
+                       /* XXX Library deps have to be checked using 
+                       $this->tmp_extract_path . DIRECTORY_SEPARATOR . 
'lib_versions.txt'; */
+               }
 
                return $this->buildConfigureLine($config);
-
        }
 
        public function preparePackage()


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to