Copyright 2010-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Gunnar Wrobel (wrobel@pardus.de)
示例#1
0
文件: Base.php 项目: jubinpatel/horde
 /**
  * Install the channel of this component in the environment.
  *
  * @param Components_Pear_Environment $env     The environment to install
  *                                             into.
  * @param array                       $options Install options.
  *
  * @return NULL
  */
 public function installChannel(Components_Pear_Environment $env, $options = array())
 {
     $channel = $this->getChannel();
     if (!empty($channel)) {
         $env->provideChannel($channel, $options, sprintf(' [required by %s]', $this->getName()));
     }
 }
示例#2
0
文件: Factory.php 项目: horde/horde
 /**
  * Return the PEAR Package representation based on a local *.tgz archive.
  *
  * @param string                          $package_tgz_path Path to the *.tgz file.
  * @param Components_Pear_Environment $environment      The PEAR environment.
  *
  * @return PEAR_PackageFile
  */
 public function getPackageFileFromTgz($package_tgz_path, Components_Pear_Environment $environment)
 {
     $pkg = new PEAR_PackageFile($environment->getPearConfig());
     return Components_Exception_Pear::catchError($pkg->fromTgzFile($package_tgz_path, PEAR_VALIDATE_NORMAL));
 }
示例#3
0
 /**
  * Install the dependencies of a component.
  *
  * @param Components_Pear_Environment     $environment The environment we
  *                                                     install into.
  * @param Components_Component            $component   The component that
  *                                                     should be installed.
  * @param array                           $options     Install options.
  * @param string                          $reason      Optional reason for
  *                                                     adding the package.
  *
  * @return NULL
  */
 private function _installDependencies(Components_Pear_Environment $environment, Components_Component $component, $options = array(), $reason = '')
 {
     foreach ($component->getDependencyList() as $dependency) {
         if (!$dependency->isPhp() && $dependency->isPackage()) {
             $c_options = $this->_getPerComponentOptions($dependency, $options);
             if ($dependency->isRequired() || !empty($c_options['include'])) {
                 $dep = $dependency->getComponent($c_options);
                 if (!$dep instanceof Components_Component_Archive && !empty($options['build_distribution'])) {
                     if (empty($options['allow_remote']) && !$component instanceof Components_Component_Source) {
                         throw new Components_Exception(sprintf('Cannot add component "%s". Remote access has been disabled (activate with --allow-remote)!', $channel));
                     }
                     if (!empty($options['sourcepath'])) {
                         $source = $options['sourcepath'] . '/' . $component->getChannel();
                         if (!file_exists($source)) {
                             @mkdir(dirname($source), 0777, true);
                         }
                         if ($dep instanceof Components_Component_Source) {
                             $environment->provideChannel($dep->getChannel(), $options, sprintf(' [required by %s]', $dep->getName()));
                         }
                         $dep->placeArchive($source);
                         if ($dep instanceof Components_Component_Remote) {
                             $this->_output->warn(sprintf('Downloaded component %s via network to %s.', $dep->getName(), $source));
                         } else {
                             $this->_output->ok(sprintf('Generated archive for component %s in %s.', $dep->getName(), $source));
                         }
                         $dep = $dependency->getComponent($c_options);
                     }
                 }
                 if ($dep === false) {
                     throw new Components_Exception(sprintf('Failed resolving component %s/%s!', $dependency->getChannel(), $dependency->getName()));
                 } else {
                     $this->installTree($environment, $dep, $options, sprintf(' [required by %s]', $component->getName()));
                 }
             }
         }
     }
 }