/** * Return a PEAR package representation for the component. * * @return Horde_Pear_Package_Xml The package representation. */ protected function getPackageXml() { if (!isset($this->_package)) { $this->_package = $this->_remote->getPackageXml($this->getName(), $this->getVersion()); } return $this->_package; }
/** * Validate the preconditions required for this release task. * * @param array $options Additional options. * * @return array An empty array if all preconditions are met and a list of * error messages otherwise. */ public function validate($options) { $errors = array(); $testpkg = Horde_Util::getTempFile(); $archive = new Archive_Tar($testpkg, 'gz'); $archive->addString('a', 'a'); $archive->addString('b', 'b'); $results = exec('tar tzvf ' . $testpkg . ' 2>&1'); // MacOS tar doesn't error out, but only returns the first string (ending in 'a'); if (strpos($results, 'lone zero block') !== false || substr($results, -1, 1) == 'a') { $errors[] = 'Broken Archive_Tar, upgrade first.'; } $remote = new Horde_Pear_Remote(); try { $exists = $remote->releaseExists($this->getComponent()->getName(), $this->getComponent()->getVersion()); if ($exists) { $errors[] = sprintf('The remote server already has version "%s" for component "%s".', $this->getComponent()->getVersion(), $this->getComponent()->getName()); } } catch (Horde_Http_Exception $e) { $errors[] = 'Failed accessing the remote PEAR server.'; } try { Components_Helper_Version::validateReleaseStability($this->getComponent()->getVersion(), $this->getComponent()->getState('release')); } catch (Components_Exception $e) { $errors[] = $e->getMessage(); } try { Components_Helper_Version::validateApiStability($this->getComponent()->getVersion(), $this->getComponent()->getState('api')); } catch (Components_Exception $e) { $errors[] = $e->getMessage(); } if (empty($options['releaseserver'])) { $errors[] = 'The "releaseserver" option has no value. Where should the release be uploaded?'; } if (empty($options['releasedir'])) { $errors[] = 'The "releasedir" option has no value. Where is the remote pirum install located?'; } return $errors; }
/** * Add a channel within the install location. * * @param string $channel The channel name. * @param array $options Install options. * @param string $reason Optional reason for adding the channel. * * @return NULL */ public function addChannel($channel, $options = array(), $reason = '') { $static = $this->_channel_directory . '/' . $channel . '.channel.xml'; if (!file_exists($static)) { if (empty($options['allow_remote'])) { throw new Components_Exception(sprintf('Cannot add channel "%s". Remote access has been disabled (activate with --allow-remote)!', $channel)); } if (!empty($this->_channel_directory)) { $remote = new Horde_Pear_Remote($channel); file_put_contents($static, $remote->getChannel()); $this->_output->warn(sprintf('Downloaded channel %s via network to %s.', $channel, $static)); } } $channel_handler = new PEAR_Command_Channels(new PEAR_Frontend_CLI(), $this->getPearConfig()); $this->_output->ok(sprintf('About to add channel %s%s', $channel, $reason)); if (file_exists($static)) { ob_start(); Components_Exception_Pear::catchError($channel_handler->doAdd('channel-add', array(), array($static))); $this->_output->pear(ob_get_clean()); } else { $this->_output->warn(sprintf('Adding channel %s via network.', $channel)); ob_start(); Components_Exception_Pear::catchError($channel_handler->doDiscover('channel-discover', array(), array($channel))); $this->_output->pear(ob_get_clean()); } $this->_output->ok(sprintf('Successfully added channel %s%s', $channel, $reason)); }
* * @category Horde * @package Horde_Pear * @author Gunnar Wrobel <*****@*****.**> * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @link http://www.horde.org/libraries/Horde_Pear */ /** * The Autoloader allows us to omit "require/include" statements. */ require_once 'Horde/Autoloader/Default.php'; $pear = new Horde_Pear_Remote(); print $pear->getChannel(); print "\n\n"; print join("\n", $pear->listPackages()); print "\n\n"; print $pear->getLatestRelease('Horde_Core'); print "\n\n"; print $pear->getLatestDownloadUri('Horde_Core'); print "\n\n"; print_r($pear->getLatestDetails('Horde_Core')); print "\n\n"; print $pear->releaseExists('Horde_Core', '1.7.0'); print "\n\n"; print count($pear->getDependencies('Horde_Exception', '1.0.0')); print "\n\n"; print $pear->getPackageXml('Horde_Exception', '1.0.0')->getName(); print "\n\n"; $pear = new Horde_Pear_Remote('pear.phpunit.de'); print join("\n", $pear->listPackages()); print "\n\n";