cvs: pear-core /PEAR/Command Install.php /PEAR/PackageFile v1.php v2.php /PEAR/PackageFile/v2 Validator.php

From: Date: Sat, 30 Jul 2005 04:29:03 +0000
Subject: cvs: pear-core /PEAR/Command Install.php /PEAR/PackageFile v1.php v2.php /PEAR/PackageFile/v2 Validator.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-33466@lists.php.net to get a copy of this message
cellog Sat Jul 30 00:29:03 2005 EDT Modified files: /pear-core/PEAR/Command Install.php /pear-core/PEAR/PackageFile v1.php v2.php /pear-core/PEAR/PackageFile/v2 Validator.php Log: make binary package installs even more intelligent. Also, fix a potentially dangerous situation with deps (for instance, if user installs PDO, and PDO_dll is installed instead, deps on PDO will fail because the installed package is not PDO). Now, a shadow install of the PDO package would be made. In addition, on uninstall, PDO_dll is automatically uninstalled along with PDO

http://cvs.php.net/diff.php/pear-core/PEAR/Command/Install.php?r1=1.99&r2=1.100&ty=u Index: pear-core/PEAR/Command/Install.php diff -u pear-core/PEAR/Command/Install.php:1.99 pear-core/PEAR/Command/Install.php:1.100 --- pear-core/PEAR/Command/Install.php:1.99 Sun May 22 23:04:34 2005 +++ pear-core/PEAR/Command/Install.php Sat Jul 30 00:29:01 2005 @@ -16,7 +16,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Install.php,v 1.99 2005/05/23 03:04:34 cellog Exp $ + * @version CVS: $Id: Install.php,v 1.100 2005/07/30 04:29:01 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 0.1 */ @@ -453,13 +453,26 @@ $oldinfo = $info; $pkg = &$param->getPackageFile(); if ($info->getCode() != PEAR_INSTALLER_NOBINARY) { - if (!($info = $pkg->installBinary($this->installer))) { + if (!($info = &$pkg->installBinary($this->installer))) { $this->ui->outputData('ERROR: ' .$oldinfo->getMessage()); continue; } + // we just installed a different package than requested, + // let's change the param and info so that the rest of this works + $param = $info[0]; + $info = $info[1]; } } if (is_array($info)) { + if ($param->getPackageType() == 'extsrc' || $param->getPackageType() == 'extbin') { + $pkg = &$param->getPackageFile(); + foreach ($pkg->getFilelist() as $name => $unused) { + if (strpos($name, 'php_') === 0) { + $extrainfo[] = 'You must add "extension=' . $name . '" to php.ini'; + break; + } + } + } if ($this->config->get('verbose') > 0) { $channel = $param->getChannel(); $label = $reg->parsedPackageNameToString( @@ -571,6 +584,10 @@ $badparams[] = $pkg; } else { $newparams[] = &$info; + // check for binary packages (this is an alias for those packages if so) + if ($installedbinary = $info->getInstalledBinary()) { + $newparams[] = &$reg->getPackage($installedbinary, $channel); + } // add the contents of a dependency group to the list of installed packages if (isset($parsed['group'])) { $group = $info->getDependencyGroup($parsed['group']); @@ -578,7 +595,7 @@ $installed = &$reg->getInstalledGroup($group); if ($installed) { foreach ($installed as $i => $p) { - $newparams[] = & $installed[$i]; + $newparams[] = &$installed[$i]; } } } http://cvs.php.net/diff.php/pear-core/PEAR/PackageFile/v1.php?r1=1.55&r2=1.56&ty=u Index: pear-core/PEAR/PackageFile/v1.php diff -u pear-core/PEAR/PackageFile/v1.php:1.55 pear-core/PEAR/PackageFile/v1.php:1.56 --- pear-core/PEAR/PackageFile/v1.php:1.55 Wed May 4 00:24:24 2005 +++ pear-core/PEAR/PackageFile/v1.php Sat Jul 30 00:29:02 2005 @@ -15,7 +15,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: v1.php,v 1.55 2005/05/04 04:24:24 cellog Exp $ + * @version CVS: $Id: v1.php,v 1.56 2005/07/30 04:29:02 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -387,6 +387,11 @@ return false; } + function getInstalledBinary() + { + return false; + } + function listPostinstallScripts() { return false; http://cvs.php.net/diff.php/pear-core/PEAR/PackageFile/v2.php?r1=1.104&r2=1.105&ty=u Index: pear-core/PEAR/PackageFile/v2.php diff -u pear-core/PEAR/PackageFile/v2.php:1.104 pear-core/PEAR/PackageFile/v2.php:1.105 --- pear-core/PEAR/PackageFile/v2.php:1.104 Wed Jun 8 20:57:14 2005 +++ pear-core/PEAR/PackageFile/v2.php Sat Jul 30 00:29:02 2005 @@ -15,7 +15,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: v2.php,v 1.104 2005/06/09 00:57:14 cellog Exp $ + * @version CVS: $Id: v2.php,v 1.105 2005/07/30 04:29:02 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -168,24 +168,34 @@ return $z; } + function getInstalledBinary() + { + return isset($this->_packageInfo['#binarypackage']) ? $this->_packageInfo['#binarypackage'] : + false; + } + /** * Installation of source package has failed, attempt to download and install the * binary version of this package. * @param PEAR_Installer + * @return array|false */ - function installBinary(&$installer) + function &installBinary(&$installer) { if (!OS_WINDOWS) { - return false; + $a = false; + return $a; } if ($this->getPackageType() == 'extsrc') { if (!is_array($installer->getInstallPackages())) { - return false; + $a = false; + return $a; } foreach ($installer->getInstallPackages() as $p) { if ($p->isExtension($this->_packageInfo['providesextension'])) { if ($p->getPackageType() != 'extsrc') { - return false; // the user probably downloaded it separately + $a = false; + return $a; // the user probably downloaded it separately } } } @@ -219,14 +229,18 @@ if (count($ret) == 1) { $pf = $ret[0]->getPackageFile(); PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - $ret = $installer->install($ret[0]); + $err = $installer->install($ret[0]); PEAR::popErrorHandling(); - if (is_array($ret)) { + if (is_array($err)) { + $this->_packageInfo['#binarypackage'] = $ret[0]->getPackage(); + // "install" self, so all dependencies will work transparently + $this->_registry->addPackage2($this); $installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString( array('channel' => $pf->getChannel(), 'package' => $pf->getPackage()), true) . '" successful'); - return $ret; + $a = array($ret[0], $err); + return $a; } $installer->log(0, 'Download and install of binary extension "' . $this->_registry->parsedPackageNameToString( @@ -236,7 +250,8 @@ } } } - return false; + $a = false; + return $a; } /** @@ -681,6 +696,9 @@ if (isset($info['_lastversion'])) { unset($info['_lastversion']); } + if (isset($info['#binarypackage'])) { + unset($info['#binarypackage']); + } return $info; } } http://cvs.php.net/diff.php/pear-core/PEAR/PackageFile/v2/Validator.php?r1=1.66&r2=1.67&ty=u Index: pear-core/PEAR/PackageFile/v2/Validator.php diff -u pear-core/PEAR/PackageFile/v2/Validator.php:1.66 pear-core/PEAR/PackageFile/v2/Validator.php:1.67 --- pear-core/PEAR/PackageFile/v2/Validator.php:1.66 Wed Jun 1 21:50:30 2005 +++ pear-core/PEAR/PackageFile/v2/Validator.php Sat Jul 30 00:29:02 2005 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Validator.php,v 1.66 2005/06/02 01:50:30 cellog Exp $ +// $Id: Validator.php,v 1.67 2005/07/30 04:29:02 cellog Exp $ /** * Private validation class used by PEAR_PackageFile_v2 - do not use directly, its * sole purpose is to split up the PEAR/PackageFile/v2.php file to make it smaller @@ -106,6 +106,9 @@ if (array_key_exists('_lastmodified', $test)) { unset($test['_lastmodified']); } + if (array_key_exists($test['#binarypackage'])) { + unset($test['#binarypackage']); + } if (array_key_exists('old', $test)) { unset($test['old']); } @@ -1942,4 +1945,6 @@ return $providesret; } } +$a = new PEAR_PackageFile_v2_Validator; +$a->analyzeSourceCode('C:/php4/pear_pkgs/Translation2/Decorator/UTF8.php'); ?> \ No newline at end of file
« previous php.pear.cvs (#33466) next »