cvs: pear-core /PEAR/Downloader Package.php
| From: | Greg Beaver | Date: | Mon, 23 May 2005 02:11:17 +0000 |
| Subject: | cvs: pear-core /PEAR/Downloader Package.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-32020@lists.php.net to get a copy of this message | ||
cellog Sun May 22 22:11:17 2005 EDT
Modified files:
/pear-core/PEAR/Downloader Package.php
Log:
abstract package name into getShortName()
fix pecl dependencies in package.xml 1.0
http://cvs.php.net/diff.php/pear-core/PEAR/Downloader/Package.php?r1=1.75&r2=1.76&ty=u Index: pear-core/PEAR/Downloader/Package.php diff -u pear-core/PEAR/Downloader/Package.php:1.75 pear-core/PEAR/Downloader/Package.php:1.76 --- pear-core/PEAR/Downloader/Package.php:1.75 Sat May 21 00:35:18 2005 +++ pear-core/PEAR/Downloader/Package.php Sun May 22 22:11:17 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: Package.php,v 1.75 2005/05/21 04:35:18 cellog Exp $ + * @version CVS: $Id: Package.php,v 1.76 2005/05/23 02:11:17 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -330,6 +330,11 @@ return $this->_validated; } + /** + * Remove packages to be downloaded that are already installed + * @param array of PEAR_Downloader_Package objects + * @static + */ function removeInstalled(&$params) { if (!isset($params[0])) { @@ -349,7 +354,7 @@ unset($info['state']); if (!isset($options['soft'])) { $param->_downloader->log(1, 'Skipping package "' . - $param->_registry->parsedPackageNameToString($info, true) . + $param->getShortName() . '", already installed as version ' . $param->getVersion()); } $params[$i] = false; @@ -358,7 +363,7 @@ !isset($options['soft'])) { $info = $param->getParsedPackage(); $param->_downloader->log(1, 'Skipping package "' . - $param->_registry->parsedPackageNameToString($info, true) . + $param->getShortName() . '", already installed as version ' . $param->getVersion()); $params[$i] = false; } @@ -516,7 +521,8 @@ if (PEAR_Downloader_Package::willDownload($testdep, $params)) { $dep['package'] = $dep['name']; if (!isset($options['soft'])) { - $this->_downloader->log(2, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . + ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed'); } @@ -557,7 +563,8 @@ $dep['channel']); $dep['package'] = $dep['name']; if (!isset($options['soft'])) { - $this->_downloader->log(3, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . + ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '" version ' . $url['version'] . ', already installed as version ' . $version); @@ -591,27 +598,51 @@ $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ? 'required' : 'optional'; - $this->_downloader->log(2, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group + . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed'); continue 2; } } + PEAR::pushErrorHandling(PEAR_ERROR_RETURN); + if ($this->_explicitState) { + $pname['state'] = $this->_explicitState; + } + $url = + $this->_downloader->_getDepPackageDownloadUrl($dep, $pname); + $chan = 'pear.php.net'; + if (PEAR::isError($url)) { + // check to see if this is a pecl package that has jumped + // from pear.php.net to pecl.php.net channel + if (!class_exists('PEAR_Dependency2')) { + require_once 'PEAR/Dependency2.php'; + } + $newdep = PEAR_Dependency2::normalizeDep($dep); + $newdep = $newdep[0]; + $newdep['channel'] = 'pecl.php.net'; + $chan = 'pecl.php.net'; + $url = + $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname); + if (PEAR::isError($url)) { + PEAR::popErrorHandling(); + return $url; + } + } + PEAR::popErrorHandling(); if (!isset($options['alldeps'])) { if (isset($dep['optional']) && $dep['optional'] == 'yes') { if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . - $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => - $this->getPackage()), true) . + $this->getShortName() . '" optional dependency "' . $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true); $nodownload = true; } @@ -620,44 +651,19 @@ if (!isset($dep['optional']) || $dep['optional'] == 'no') { if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . - $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => - $this->getPackage()), true) . + $this->getShortName() . '" required dependency "' . $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true); $nodownload = true; } } - PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - if ($this->_explicitState) { - $pname['state'] = $this->_explicitState; - } - $url = - $this->_downloader->_getDepPackageDownloadUrl($dep, $pname); - if (PEAR::isError($url)) { - // check to see if this is a pecl package that has jumped - // from pear.php.net to pecl.php.net channel - if (!class_exists('PEAR_Dependency2')) { - require_once 'PEAR/Dependency2.php'; - } - $newdep = PEAR_Dependency2::normalizeDep($dep); - $newdep = $newdep[0]; - $newdep['channel'] = 'pecl.php.net'; - $url = - $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname); - if (PEAR::isError($url)) { - PEAR::popErrorHandling(); - return $url; - } - } - PEAR::popErrorHandling(); // check to see if a dep is already installed // do not try to move this before getDepPackageDownloadURL // we can't determine whether upgrade is necessary until we know what @@ -676,7 +682,8 @@ } $dep['version'] = $url['version']; if (!isset($options['soft'])) { - $this->_downloader->log(3, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . + ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $version); } @@ -731,6 +738,12 @@ $this->_packagefile = &$pkg; } + function getShortName() + { + return $this->_registry->parsedPackageNameToString(array('channel' => $this->getChannel(), + 'package' => $this->getPackage()), true); + } + function getParsedPackage() { if (isset($this->_packagefile) || isset($this->_parsedname)) {
http://cvs.php.net/diff.php/pear-core/PEAR/Downloader/Package.php?r1=1.75&r2=1.76&ty=u Index: pear-core/PEAR/Downloader/Package.php diff -u pear-core/PEAR/Downloader/Package.php:1.75 pear-core/PEAR/Downloader/Package.php:1.76 --- pear-core/PEAR/Downloader/Package.php:1.75 Sat May 21 00:35:18 2005 +++ pear-core/PEAR/Downloader/Package.php Sun May 22 22:11:17 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: Package.php,v 1.75 2005/05/21 04:35:18 cellog Exp $ + * @version CVS: $Id: Package.php,v 1.76 2005/05/23 02:11:17 cellog Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -330,6 +330,11 @@ return $this->_validated; } + /** + * Remove packages to be downloaded that are already installed + * @param array of PEAR_Downloader_Package objects + * @static + */ function removeInstalled(&$params) { if (!isset($params[0])) { @@ -349,7 +354,7 @@ unset($info['state']); if (!isset($options['soft'])) { $param->_downloader->log(1, 'Skipping package "' . - $param->_registry->parsedPackageNameToString($info, true) . + $param->getShortName() . '", already installed as version ' . $param->getVersion()); } $params[$i] = false; @@ -358,7 +363,7 @@ !isset($options['soft'])) { $info = $param->getParsedPackage(); $param->_downloader->log(1, 'Skipping package "' . - $param->_registry->parsedPackageNameToString($info, true) . + $param->getShortName() . '", already installed as version ' . $param->getVersion()); $params[$i] = false; } @@ -516,7 +521,8 @@ if (PEAR_Downloader_Package::willDownload($testdep, $params)) { $dep['package'] = $dep['name']; if (!isset($options['soft'])) { - $this->_downloader->log(2, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group . + ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed'); } @@ -557,7 +563,8 @@ $dep['channel']); $dep['package'] = $dep['name']; if (!isset($options['soft'])) { - $this->_downloader->log(3, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . + ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '" version ' . $url['version'] . ', already installed as version ' . $version); @@ -591,27 +598,51 @@ $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ? 'required' : 'optional'; - $this->_downloader->log(2, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group + . ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", will be installed'); continue 2; } } + PEAR::pushErrorHandling(PEAR_ERROR_RETURN); + if ($this->_explicitState) { + $pname['state'] = $this->_explicitState; + } + $url = + $this->_downloader->_getDepPackageDownloadUrl($dep, $pname); + $chan = 'pear.php.net'; + if (PEAR::isError($url)) { + // check to see if this is a pecl package that has jumped + // from pear.php.net to pecl.php.net channel + if (!class_exists('PEAR_Dependency2')) { + require_once 'PEAR/Dependency2.php'; + } + $newdep = PEAR_Dependency2::normalizeDep($dep); + $newdep = $newdep[0]; + $newdep['channel'] = 'pecl.php.net'; + $chan = 'pecl.php.net'; + $url = + $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname); + if (PEAR::isError($url)) { + PEAR::popErrorHandling(); + return $url; + } + } + PEAR::popErrorHandling(); if (!isset($options['alldeps'])) { if (isset($dep['optional']) && $dep['optional'] == 'yes') { if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . - $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => - $this->getPackage()), true) . + $this->getShortName() . '" optional dependency "' . $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true); $nodownload = true; } @@ -620,44 +651,19 @@ if (!isset($dep['optional']) || $dep['optional'] == 'no') { if (!isset($options['soft'])) { $this->_downloader->log(3, 'Notice: package "' . - $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => - $this->getPackage()), true) . + $this->getShortName() . '" required dependency "' . $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true) . '" will not be automatically downloaded'); } $skipnames[] = $this->_registry->parsedPackageNameToString( - array('channel' => 'pear.php.net', 'package' => + array('channel' => $chan, 'package' => $dep['name']), true); $nodownload = true; } } - PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - if ($this->_explicitState) { - $pname['state'] = $this->_explicitState; - } - $url = - $this->_downloader->_getDepPackageDownloadUrl($dep, $pname); - if (PEAR::isError($url)) { - // check to see if this is a pecl package that has jumped - // from pear.php.net to pecl.php.net channel - if (!class_exists('PEAR_Dependency2')) { - require_once 'PEAR/Dependency2.php'; - } - $newdep = PEAR_Dependency2::normalizeDep($dep); - $newdep = $newdep[0]; - $newdep['channel'] = 'pecl.php.net'; - $url = - $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname); - if (PEAR::isError($url)) { - PEAR::popErrorHandling(); - return $url; - } - } - PEAR::popErrorHandling(); // check to see if a dep is already installed // do not try to move this before getDepPackageDownloadURL // we can't determine whether upgrade is necessary until we know what @@ -676,7 +682,8 @@ } $dep['version'] = $url['version']; if (!isset($options['soft'])) { - $this->_downloader->log(3, 'Skipping ' . $group . ' dependency "' . + $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group . + ' dependency "' . $this->_registry->parsedPackageNameToString($dep, true) . '", already installed as version ' . $version); } @@ -731,6 +738,12 @@ $this->_packagefile = &$pkg; } + function getShortName() + { + return $this->_registry->parsedPackageNameToString(array('channel' => $this->getChannel(), + 'package' => $this->getPackage()), true); + } + function getParsedPackage() { if (isset($this->_packagefile) || isset($this->_parsedname)) {