diff options
| -rw-r--r-- | install-pear.php | 2 | ||||
| -rw-r--r-- | php-pear-1.10-metadata.patch | 228 | ||||
| -rw-r--r-- | php-pear-1.10-restcache.patch | 21 | ||||
| -rw-r--r-- | php-pear-dev.spec | 19 | 
4 files changed, 261 insertions, 9 deletions
| diff --git a/install-pear.php b/install-pear.php index facb6ee..4ed36d6 100644 --- a/install-pear.php +++ b/install-pear.php @@ -237,7 +237,7 @@ $options['upgrade'] = true;  $install_root = getenv('INSTALL_ROOT');  if (!empty($install_root)) {      $options['packagingroot'] = $install_root; -    $reg = &new PEAR_Registry($options['packagingroot'], false, false, $metadata_dir); +    $reg = new PEAR_Registry($options['packagingroot'], false, false, $metadata_dir);  } else {      $reg = $config->getRegistry('default');  } diff --git a/php-pear-1.10-metadata.patch b/php-pear-1.10-metadata.patch new file mode 100644 index 0000000..bc92d0d --- /dev/null +++ b/php-pear-1.10-metadata.patch @@ -0,0 +1,228 @@ +diff -up PEAR/Command/Install.php.metadata PEAR/Command/Install.php +--- PEAR/Command/Install.php.metadata	2015-07-25 13:41:42.000000000 +0200 ++++ PEAR/Command/Install.php	2015-07-25 17:07:55.601684682 +0200 +@@ -555,7 +555,13 @@ Run post-installation scripts in package +             $packrootphp_dir = $this->installer->_prependPath( +                 $this->config->get('php_dir', null, 'pear.php.net'), +                 $options['packagingroot']); +-            $instreg = new PEAR_Registry($packrootphp_dir); // other instreg! ++            $metadata_dir = $this->config->get('metadata_dir', null, 'pear.php.net'); ++            if ($metadata_dir) { ++                $metadata_dir = $this->installer->_prependPath( ++                    $metadata_dir, ++                    $options['packagingroot']); ++            } ++            $instreg = new PEAR_Registry($packrootphp_dir, false, false, $metadata_dir); // other instreg! +  +             if ($this->config->get('verbose') > 2) { +                 $this->ui->outputData('using package root: ' . $options['packagingroot']); +diff -up PEAR/Config.php.metadata PEAR/Config.php +--- PEAR/Config.php.metadata	2015-07-25 13:41:42.000000000 +0200 ++++ PEAR/Config.php	2015-07-25 17:14:09.956196305 +0200 +@@ -86,6 +86,13 @@ if (getenv('PHP_PEAR_INSTALL_DIR')) { +     } + } +  ++// Default for metadata_dir ++if (getenv('PHP_PEAR_METADATA_DIR')) { ++    define('PEAR_CONFIG_DEFAULT_METADATA_DIR', getenv('PHP_PEAR_METADATA_DIR')); ++} else { ++    define('PEAR_CONFIG_DEFAULT_METADATA_DIR', ''); ++} ++ + // Default for ext_dir + if (getenv('PHP_PEAR_EXTENSION_DIR')) { +     define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR')); +@@ -397,6 +404,13 @@ class PEAR_Config extends PEAR +             'prompt' => 'PEAR directory', +             'group' => 'File Locations', +             ), ++        'metadata_dir' => array( ++            'type' => 'directory', ++            'default' => PEAR_CONFIG_DEFAULT_METADATA_DIR, ++            'doc' => 'directory where metadata files are installed (registry, filemap, channels, ...)', ++            'prompt' => 'PEAR metadata directory', ++            'group' => 'File Locations', ++            ), +         'ext_dir' => array( +             'type' => 'directory', +             'default' => PEAR_CONFIG_DEFAULT_EXT_DIR, +@@ -646,7 +660,9 @@ class PEAR_Config extends PEAR +             $this->configuration['default'][$key] = $info['default']; +         } +  +-        $this->_registry['default'] = new PEAR_Registry($this->configuration['default']['php_dir']); ++        $this->_registry['default'] = new PEAR_Registry( ++            $this->configuration['default']['php_dir'], false, false, ++            $this->configuration['default']['metadata_dir']); +         $this->_registry['default']->setConfig($this, false); +         $this->_regInitialized['default'] = false; +         //$GLOBALS['_PEAR_Config_instance'] = &$this; +@@ -750,7 +766,9 @@ class PEAR_Config extends PEAR +         $this->configuration[$layer] = $data; +         $this->_setupChannels(); +         if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) { +-            $this->_registry[$layer] = new PEAR_Registry($phpdir); ++            $this->_registry[$layer] = new PEAR_Registry( ++                $phpdir, false, false, ++                $this->get('metadata_dir', $layer, 'pear.php.net')); +             $this->_registry[$layer]->setConfig($this, false); +             $this->_regInitialized[$layer] = false; +         } else { +@@ -907,7 +925,9 @@ class PEAR_Config extends PEAR +  +         $this->_setupChannels(); +         if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) { +-            $this->_registry[$layer] = new PEAR_Registry($phpdir); ++            $this->_registry[$layer] = new PEAR_Registry( ++                $phpdir, false, false, ++                $this->get('metadata_dir', $layer, 'pear.php.net')); +             $this->_registry[$layer]->setConfig($this, false); +             $this->_regInitialized[$layer] = false; +         } else { +@@ -1595,7 +1615,9 @@ class PEAR_Config extends PEAR +  +                 if (!is_object($this->_registry[$layer])) { +                     if ($phpdir = $this->get('php_dir', $layer, 'pear.php.net')) { +-                        $this->_registry[$layer] = new PEAR_Registry($phpdir); ++                        $this->_registry[$layer] = new PEAR_Registry( ++                            $phpdir, false, false, ++                            $this->get('metadata_dir', $layer, 'pear.php.net')); +                         $this->_registry[$layer]->setConfig($this, false); +                         $this->_regInitialized[$layer] = false; +                     } else { +@@ -2079,7 +2101,9 @@ class PEAR_Config extends PEAR +                     continue; +                 } +                 $this->_registry[$layer] = +-                    new PEAR_Registry($this->get('php_dir', $layer, 'pear.php.net')); ++                    new PEAR_Registry( ++                        $this->get('php_dir', $layer, 'pear.php.net'), false, false, ++                        $this->get('metadata_dir', $layer, 'pear.php.net')); +                 $this->_registry[$layer]->setConfig($this, false); +                 $this->_regInitialized[$layer] = false; +             } +diff -up PEAR/DependencyDB.php.metadata PEAR/DependencyDB.php +--- PEAR/DependencyDB.php.metadata	2015-07-25 13:41:42.000000000 +0200 ++++ PEAR/DependencyDB.php	2015-07-25 17:07:55.602684685 +0200 +@@ -120,8 +120,11 @@ class PEAR_DependencyDB +  +         $this->_registry = &$this->_config->getRegistry(); +         if (!$depdb) { +-            $this->_depdb = $this->_config->get('php_dir', null, 'pear.php.net') . +-                DIRECTORY_SEPARATOR . '.depdb'; ++            $dir = $this->_config->get('metadata_dir', null, 'pear.php.net'); ++            if (!$dir) { ++                $dir = $this->_config->get('php_dir', null, 'pear.php.net'); ++            } ++            $this->_depdb =  $dir . DIRECTORY_SEPARATOR . '.depdb'; +         } else { +             $this->_depdb = $depdb; +         } +@@ -758,4 +761,4 @@ class PEAR_DependencyDB +             ); +         } +     } +-} +\ Pas de fin de ligne à la fin du fichier ++} +diff -up PEAR/Installer.php.metadata PEAR/Installer.php +--- PEAR/Installer.php.metadata	2015-07-25 17:16:56.954883069 +0200 ++++ PEAR/Installer.php	2015-07-25 17:17:16.672964162 +0200 +@@ -1128,15 +1128,6 @@ class PEAR_Installer extends PEAR_Downlo +  +         $pkgname = $pkg->getName(); +         $channel = $pkg->getChannel(); +-        if (isset($this->_options['packagingroot'])) { +-            $regdir = $this->_prependPath( +-                $this->config->get('php_dir', null, 'pear.php.net'), +-                $this->_options['packagingroot']); +- +-            $packrootphp_dir = $this->_prependPath( +-                $this->config->get('php_dir', null, $channel), +-                $this->_options['packagingroot']); +-        } +  +         if (isset($options['installroot'])) { +             $this->config->setInstallRoot($options['installroot']); +@@ -1148,7 +1139,21 @@ class PEAR_Installer extends PEAR_Downlo +             $this->config->setInstallRoot(false); +             $this->_registry = &$this->config->getRegistry(); +             if (isset($this->_options['packagingroot'])) { +-                $installregistry = new PEAR_Registry($regdir); ++                $regdir = $this->_prependPath( ++                    $this->config->get('php_dir', null, 'pear.php.net'), ++                    $this->_options['packagingroot']); ++ ++                $metadata_dir = $this->config->get('metadata_dir', null, 'pear.php.net'); ++                if ($metadata_dir) { ++                    $metadata_dir = $this->_prependPath( ++                        $metadata_dir, ++                        $this->_options['packagingroot']); ++                } ++                $packrootphp_dir = $this->_prependPath( ++                    $this->config->get('php_dir', null, $channel), ++                    $this->_options['packagingroot']); ++ ++                $installregistry = new PEAR_Registry($regdir, false, false, $metadata_dir); +                 if (!$installregistry->channelExists($channel, true)) { +                     // we need to fake a channel-discover of this channel +                     $chanobj = $this->_registry->getChannel($channel, true); +diff -up PEAR/Registry.php.metadata PEAR/Registry.php +--- PEAR/Registry.php.metadata	2015-07-25 13:41:42.000000000 +0200 ++++ PEAR/Registry.php	2015-07-25 17:21:10.112933225 +0200 +@@ -131,23 +131,26 @@ class PEAR_Registry extends PEAR +      * @access public +      */ +     function __construct($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, +-                           $pecl_channel = false) ++                           $pecl_channel = false, $pear_metadata_dir = '') +     { +         parent::__construct(); +-        $this->setInstallDir($pear_install_dir); ++        $this->setInstallDir($pear_install_dir, $pear_metadata_dir); +         $this->_pearChannel = $pear_channel; +         $this->_peclChannel = $pecl_channel; +         $this->_config      = false; +     } +  +-    function setInstallDir($pear_install_dir = PEAR_INSTALL_DIR) ++    function setInstallDir($pear_install_dir = PEAR_INSTALL_DIR, $pear_metadata_dir = '') +     { +         $ds = DIRECTORY_SEPARATOR; +         $this->install_dir = $pear_install_dir; +-        $this->channelsdir = $pear_install_dir.$ds.'.channels'; +-        $this->statedir    = $pear_install_dir.$ds.'.registry'; +-        $this->filemap     = $pear_install_dir.$ds.'.filemap'; +-        $this->lockfile    = $pear_install_dir.$ds.'.lock'; ++        if (!$pear_metadata_dir) { ++            $pear_metadata_dir = $pear_install_dir; ++        } ++        $this->channelsdir = $pear_metadata_dir.$ds.'.channels'; ++        $this->statedir    = $pear_metadata_dir.$ds.'.registry'; ++        $this->filemap     = $pear_metadata_dir.$ds.'.filemap'; ++        $this->lockfile    = $pear_metadata_dir.$ds.'.lock'; +     } +  +     function hasWriteAccess() +@@ -180,7 +183,7 @@ class PEAR_Registry extends PEAR +     { +         $this->_config = &$config; +         if ($resetInstallDir) { +-            $this->setInstallDir($config->get('php_dir')); ++            $this->setInstallDir($config->get('php_dir'), $config->get('metadata_dir')); +         } +     } +  +@@ -327,9 +330,9 @@ class PEAR_Registry extends PEAR +                 $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config); +                 if (PEAR::isError($this->_dependencyDB)) { +                     // attempt to recover by removing the dep db +-                    if (file_exists($this->_config->get('php_dir', null, 'pear.php.net') . ++                    if (file_exists($this->_config->get('metadata_dir', null, 'pear.php.net') . +                         DIRECTORY_SEPARATOR . '.depdb')) { +-                        @unlink($this->_config->get('php_dir', null, 'pear.php.net') . ++                        @unlink($this->_config->get('metadata_dir', null, 'pear.php.net') . +                             DIRECTORY_SEPARATOR . '.depdb'); +                     } +  diff --git a/php-pear-1.10-restcache.patch b/php-pear-1.10-restcache.patch new file mode 100644 index 0000000..5979bca --- /dev/null +++ b/php-pear-1.10-restcache.patch @@ -0,0 +1,21 @@ + +Workaround for: + + https://bugzilla.redhat.com/show_bug.cgi?id=747361 + +--- REST.php.restcache ++++ REST.php +@@ -235,6 +235,13 @@ +             } +         } +  ++        if (!is_writeable($cache_dir)) { ++            // If writing to the cache dir is not going to work, silently do nothing. ++            // An ugly hack, but retains compat with PEAR 1.9.1 where many commands ++            // work fine as non-root user (w/out write access to default cache dir). ++            return true; ++        } ++ +         if ($cacheid === null && $nochange) { +             $cacheid = unserialize(implode('', file($cacheidfile))); +         } diff --git a/php-pear-dev.spec b/php-pear-dev.spec index b509f0f..fc5a651 100644 --- a/php-pear-dev.spec +++ b/php-pear-dev.spec @@ -28,12 +28,12 @@  %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_root_sysconfdir}/rpm; echo $d) -#global pearprever dev1 +%global pearprever dev1  Summary: PHP Extension and Application Repository framework  Name: %{?scl_prefix}php-pear -Version: 1.9.5 -Release: 13%{?dist} +Version: 1.10.0 +Release: 0.1.%{pearprever}%{?dist}  Epoch: 1  # PEAR, Archive_Tar, XML_Util, Console_Getopt are BSD  # Structures_Graph is LGPLv3+ @@ -62,9 +62,9 @@ Source33: pear.conf.5  # From RHEL: ignore REST cache creation failures as non-root user (#747361)  # TODO See https://github.com/pear/pear-core/commit/dfef86e05211d2abc7870209d69064d448ef53b3#PEAR/REST.php -Patch0: php-pear-1.9.4-restcache.patch +Patch0: php-pear-1.10-restcache.patch  # Relocate Metadata -Patch1: php-pear-metadata.patch +Patch1: php-pear-1.10-metadata.patch  BuildArch: noarch  BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -112,7 +112,7 @@ Obsoletes: php70w-pear <= %{version}  # Archive_Tar requires 5.2  # XML_Util, Structures_Graph require 5.3  # Console_Getopt requires 5.4 -# PEAR requires 4.4 +# PEAR requires 5.4  Requires:  %{?scl_prefix}php(language) > 5.4  Requires:  %{?scl_prefix}php-cli  # phpci detected extension @@ -237,9 +237,9 @@ install -m 644 -D macros.pear \  # apply patches on installed PEAR tree  pushd $RPM_BUILD_ROOT%{peardir}    pushd PEAR -  %__patch -s --no-backup --fuzz 0 -p0 < %{PATCH0} +  %__patch --no-backup --fuzz 0 -p0 < %{PATCH0}   popd -  %__patch -s --no-backup --fuzz 0 -p0 < %{PATCH1} +  %__patch --no-backup --fuzz 0 -p0 < %{PATCH1}  popd  # Why this file here ? @@ -400,6 +400,9 @@ fi  %changelog +* Sat Jul 25 2015 Remi Collet <remi@fedoraproject.org> 1:1.10.0-0.1.dev1 +- update PEAR 1.10.0dev1 (for PHP7) +  * Thu Jul 23 2015 Remi Collet <remi@fedoraproject.org> 1:1.9.5-13  - fix default values in rpm macro file (instead of undefined) | 
