当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_Downloader_Package类代码示例

本文整理汇总了PHP中PEAR_Downloader_Package的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Downloader_Package类的具体用法?PHP PEAR_Downloader_Package怎么用?PHP PEAR_Downloader_Package使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PEAR_Downloader_Package类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doMakeRPM

 function doMakeRPM($command, $options, $params)
 {
     require_once 'System.php';
     require_once 'Archive/Tar.php';
     if (sizeof($params) != 1) {
         return $this->raiseError("bad parameter(s), try \"help {$command}\"");
     }
     if (!file_exists($params[0])) {
         return $this->raiseError("file does not exist: {$params['0']}");
     }
     $reg =& $this->config->getRegistry();
     $pkg =& $this->getPackageFile($this->config, $this->_debug);
     $pf =& $pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($pf)) {
         $u = $pf->getUserinfo();
         if (is_array($u)) {
             foreach ($u as $err) {
                 if (is_array($err)) {
                     $err = $err['message'];
                 }
                 $this->ui->outputData($err);
             }
         }
         return $this->raiseError("{$params['0']} is not a valid package");
     }
     $tmpdir = System::mktemp(array('-d', 'pear2rpm'));
     $instroot = System::mktemp(array('-d', 'pear2rpm'));
     $tmp = $this->config->get('verbose');
     $this->config->set('verbose', 0);
     $installer = $this->getInstaller($this->ui);
     require_once 'PEAR/Downloader/Package.php';
     $pack = new PEAR_Downloader_Package($installer);
     $pack->setPackageFile($pf);
     $params[0] =& $pack;
     $installer->setOptions(array('installroot' => $instroot, 'nodeps' => true, 'soft' => true));
     $installer->setDownloadedPackages($params);
     $info = $installer->install($params[0], array('installroot' => $instroot, 'nodeps' => true, 'soft' => true));
     $pkgdir = $pf->getPackage() . '-' . $pf->getVersion();
     $info['rpm_xml_dir'] = '/var/lib/pear';
     $this->config->set('verbose', $tmp);
     if (isset($options['spec-template'])) {
         $spec_template = $options['spec-template'];
     } else {
         $spec_template = '@DATA-DIR@/PEAR/template.spec';
     }
     $info['possible_channel'] = '';
     $info['extra_config'] = '';
     if (isset($options['rpm-pkgname'])) {
         $rpm_pkgname_format = $options['rpm-pkgname'];
     } else {
         if ($pf->getChannel() == 'pear.php.net' || $pf->getChannel() == 'pecl.php.net') {
             $alias = 'PEAR';
         } else {
             $chan =& $reg->getChannel($pf->getChannel());
             $alias = $chan->getAlias();
             $alias = strtoupper($alias);
             $info['possible_channel'] = $pf->getChannel() . '/';
         }
         $rpm_pkgname_format = $alias . '::%s';
     }
     $info['extra_headers'] = '';
     $info['doc_files'] = '';
     $info['files'] = '';
     $info['package2xml'] = '';
     $info['rpm_package'] = sprintf($rpm_pkgname_format, $pf->getPackage());
     $srcfiles = 0;
     foreach ($info['filelist'] as $name => $attr) {
         if (!isset($attr['role'])) {
             continue;
         }
         $name = preg_replace('![/:\\\\]!', '/', $name);
         if ($attr['role'] == 'doc') {
             $info['doc_files'] .= " {$name}";
             // Map role to the rpm vars
         } else {
             $c_prefix = '%{_libdir}/php/pear';
             switch ($attr['role']) {
                 case 'php':
                     $prefix = $c_prefix;
                     break;
                 case 'ext':
                     $prefix = '%{_libdir}/php';
                     break;
                     // XXX good place?
                 // XXX good place?
                 case 'src':
                     $srcfiles++;
                     $prefix = '%{_includedir}/php';
                     break;
                     // XXX good place?
                 // XXX good place?
                 case 'test':
                     $prefix = "{$c_prefix}/tests/" . $pf->getPackage();
                     break;
                 case 'data':
                     $prefix = "{$c_prefix}/data/" . $pf->getPackage();
                     break;
                 case 'script':
                     $prefix = '%{_bindir}';
                     break;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:101,代码来源:Package.php

示例2: analyzeDependencies

 /**
  * @param array all packages to be installed
  */
 function analyzeDependencies(&$params, $force = false)
 {
     if (isset($this->_options['downloadonly'])) {
         return;
     }
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $redo = true;
     $reset = $hasfailed = $failed = false;
     while ($redo) {
         $redo = false;
         foreach ($params as $i => $param) {
             $deps = $param->getDeps();
             if (!$deps) {
                 $depchecker =& $this->getDependency2Object($this->config, $this->getOptions(), $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING);
                 $send = $param->getPackageFile();
                 $installcheck = $depchecker->validatePackage($send, $this, $params);
                 if (PEAR::isError($installcheck)) {
                     if (!isset($this->_options['soft'])) {
                         $this->log(0, $installcheck->getMessage());
                     }
                     $hasfailed = true;
                     $params[$i] = false;
                     $reset = true;
                     $redo = true;
                     $failed = false;
                     PEAR_Downloader_Package::removeDuplicates($params);
                     continue 2;
                 }
                 continue;
             }
             if (!$reset && $param->alreadyValidated() && !$force) {
                 continue;
             }
             if (count($deps)) {
                 $depchecker =& $this->getDependency2Object($this->config, $this->getOptions(), $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING);
                 $send = $param->getPackageFile();
                 if ($send === null) {
                     $send = $param->getDownloadURL();
                 }
                 $installcheck = $depchecker->validatePackage($send, $this, $params);
                 if (PEAR::isError($installcheck)) {
                     if (!isset($this->_options['soft'])) {
                         $this->log(0, $installcheck->getMessage());
                     }
                     $hasfailed = true;
                     $params[$i] = false;
                     $reset = true;
                     $redo = true;
                     $failed = false;
                     PEAR_Downloader_Package::removeDuplicates($params);
                     continue 2;
                 }
                 $failed = false;
                 if (isset($deps['required']) && is_array($deps['required'])) {
                     foreach ($deps['required'] as $type => $dep) {
                         // note: Dependency2 will never return a PEAR_Error if ignore-errors
                         // is specified, so soft is needed to turn off logging
                         if (!isset($dep[0])) {
                             if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep, true, $params))) {
                                 $failed = true;
                                 if (!isset($this->_options['soft'])) {
                                     $this->log(0, $e->getMessage());
                                 }
                             } elseif (is_array($e) && !$param->alreadyValidated()) {
                                 if (!isset($this->_options['soft'])) {
                                     $this->log(0, $e[0]);
                                 }
                             }
                         } else {
                             foreach ($dep as $d) {
                                 if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($d, true, $params))) {
                                     $failed = true;
                                     if (!isset($this->_options['soft'])) {
                                         $this->log(0, $e->getMessage());
                                     }
                                 } elseif (is_array($e) && !$param->alreadyValidated()) {
                                     if (!isset($this->_options['soft'])) {
                                         $this->log(0, $e[0]);
                                     }
                                 }
                             }
                         }
                     }
                     if (isset($deps['optional']) && is_array($deps['optional'])) {
                         foreach ($deps['optional'] as $type => $dep) {
                             if (!isset($dep[0])) {
                                 if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep, false, $params))) {
                                     $failed = true;
                                     if (!isset($this->_options['soft'])) {
                                         $this->log(0, $e->getMessage());
                                     }
                                 } elseif (is_array($e) && !$param->alreadyValidated()) {
                                     if (!isset($this->_options['soft'])) {
                                         $this->log(0, $e[0]);
                                     }
                                 }
                             } else {
//.........这里部分代码省略.........
开发者ID:shen0834,项目名称:util,代码行数:101,代码来源:Downloader.php

示例3: _analyzeDownloadURL

 /**
  * @param array output of package.getDownloadURL
  * @param string|array|object information for detecting packages to be downloaded, and
  *                            for errors
  * @param array name information of the package
  * @param array|null packages to be downloaded
  * @param bool is this an optional dependency?
  * @access private
  */
 function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false)
 {
     if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
         return false;
     }
     if (!$info) {
         if (!is_string($param)) {
             $saveparam = ", cannot download \"{$param}\"";
         } else {
             $saveparam = '';
         }
         // no releases exist
         return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
     }
     if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
         $err = false;
         if ($pname['channel'] == 'pecl.php.net') {
             if ($info['info']->getChannel() != 'pear.php.net') {
                 $err = true;
             }
         } elseif ($info['info']->getChannel() == 'pecl.php.net') {
             if ($pname['channel'] != 'pear.php.net') {
                 $err = true;
             }
         } else {
             $err = true;
         }
         if ($err) {
             return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")');
         }
     }
     if (!isset($info['url'])) {
         $instead = ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"';
         // releases exist, but we failed to get any
         if (isset($this->_downloader->_options['force'])) {
             if (isset($pname['version'])) {
                 $vs = ', version "' . $pname['version'] . '"';
             } elseif (isset($pname['state'])) {
                 $vs = ', stability "' . $pname['state'] . '"';
             } elseif ($param == 'dependency') {
                 if (!class_exists('PEAR_Common')) {
                     require_once 'PEAR/Common.php';
                 }
                 if (!in_array($info['info']->getState(), PEAR_Common::betterStates($this->_config->get('preferred_state'), true))) {
                     if ($optional) {
                         // don't spit out confusing error message
                         return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
                     }
                     $vs = ' within preferred state "' . $this->_config->get('preferred_state') . '"';
                 } else {
                     if (!class_exists('PEAR_Dependency2')) {
                         require_once 'PEAR/Dependency2.php';
                     }
                     if ($optional) {
                         // don't spit out confusing error message
                         return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
                     }
                     $vs = PEAR_Dependency2::_getExtraString($pname);
                     $instead = '';
                 }
             } else {
                 $vs = ' within preferred state "' . $this->_config->get('preferred_state') . '"';
             }
             if (!isset($options['soft'])) {
                 $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . $instead);
             }
             // download the latest release
             return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
         } else {
             // construct helpful error message
             if (isset($pname['version'])) {
                 $vs = ', version "' . $pname['version'] . '"';
             } elseif (isset($pname['state'])) {
                 $vs = ', stability "' . $pname['state'] . '"';
             } elseif ($param == 'dependency') {
                 if (!class_exists('PEAR_Common')) {
                     require_once 'PEAR/Common.php';
                 }
                 if (!in_array($info['info']->getState(), PEAR_Common::betterStates($this->_config->get('preferred_state'), true))) {
                     if ($optional) {
                         // don't spit out confusing error message, and don't die on
                         // optional dep failure!
                         return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
                     }
                     $vs = ' within preferred state "' . $this->_config->get('preferred_state') . '"';
                 } else {
                     if (!class_exists('PEAR_Dependency2')) {
                         require_once 'PEAR/Dependency2.php';
                     }
                     if ($optional) {
                         // don't spit out confusing error message, and don't die on
//.........这里部分代码省略.........
开发者ID:hbustun,项目名称:agilebill,代码行数:101,代码来源:Package.php

示例4: _analyzeDownloadURL

 /**
  * @param array output of package.getDownloadURL
  * @param string|array|object information for detecting packages to be downloaded, and
  *                            for errors
  * @param array name information of the package
  * @param array|null packages to be downloaded
  * @param bool is this an optional dependency?
  * @param bool is this any kind of dependency?
  * @access private
  */
 function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false, $isdependency = false)
 {
     if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
         return false;
     }
     if ($info === false) {
         $saveparam = !is_string($param) ? ", cannot download \"{$param}\"" : '';
         // no releases exist
         return PEAR::raiseError('No releases for package "' . $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
     }
     if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
         $err = false;
         if ($pname['channel'] == 'pecl.php.net') {
             if ($info['info']->getChannel() != 'pear.php.net') {
                 $err = true;
             }
         } elseif ($info['info']->getChannel() == 'pecl.php.net') {
             if ($pname['channel'] != 'pear.php.net') {
                 $err = true;
             }
         } else {
             $err = true;
         }
         if ($err) {
             return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] . '" retrieved another channel\'s name for download! ("' . $info['info']->getChannel() . '")');
         }
     }
     $preferred_state = $this->_config->get('preferred_state');
     if (!isset($info['url'])) {
         $package_version = $this->_registry->packageInfo($info['info']->getPackage(), 'version', $info['info']->getChannel());
         if ($this->isInstalled($info)) {
             if ($isdependency && version_compare($info['version'], $package_version, '<=')) {
                 // ignore bogus errors of "failed to download dependency"
                 // if it is already installed and the one that would be
                 // downloaded is older or the same version (Bug #7219)
                 return false;
             }
         }
         if ($info['version'] === $package_version) {
             if (!isset($options['soft'])) {
                 $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' . ' (' . $package_version . ') is the same as the locally installed one.');
             }
             return false;
         }
         if (version_compare($info['version'], $package_version, '<=')) {
             if (!isset($options['soft'])) {
                 $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' . ' (' . $info['version'] . ') is a lower version than the locally installed one (' . $package_version . ').');
             }
             return false;
         }
         $instead = ', will instead download version ' . $info['version'] . ', stability "' . $info['info']->getState() . '"';
         // releases exist, but we failed to get any
         if (isset($this->_downloader->_options['force'])) {
             if (isset($pname['version'])) {
                 $vs = ', version "' . $pname['version'] . '"';
             } elseif (isset($pname['state'])) {
                 $vs = ', stability "' . $pname['state'] . '"';
             } elseif ($param == 'dependency') {
                 if (!class_exists('PEAR_Common')) {
                     require_once 'PEAR/Common.php';
                 }
                 if (!in_array($info['info']->getState(), PEAR_Common::betterStates($preferred_state, true))) {
                     if ($optional) {
                         // don't spit out confusing error message
                         return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
                     }
                     $vs = ' within preferred state "' . $preferred_state . '"';
                 } else {
                     if (!class_exists('PEAR_Dependency2')) {
                         require_once 'PEAR/Dependency2.php';
                     }
                     if ($optional) {
                         // don't spit out confusing error message
                         return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
                     }
                     $vs = PEAR_Dependency2::_getExtraString($pname);
                     $instead = '';
                 }
             } else {
                 $vs = ' within preferred state "' . $preferred_state . '"';
             }
             if (!isset($options['soft'])) {
                 $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] . '/' . $pname['package'] . $vs . $instead);
             }
             // download the latest release
             return $this->_downloader->_getPackageDownloadUrl(array('package' => $pname['package'], 'channel' => $pname['channel'], 'version' => $info['version']));
         } else {
             if (isset($info['php']) && $info['php']) {
                 $err = PEAR::raiseError('Failed to download ' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package']), true) . ', latest release is version ' . $info['php']['v'] . ', but it requires PHP version "' . $info['php']['m'] . '", use "' . $this->_registry->parsedPackageNameToString(array('channel' => $pname['channel'], 'package' => $pname['package'], 'version' => $info['php']['v'])) . '" to install', PEAR_DOWNLOADER_PACKAGE_PHPVERSION);
                 return $err;
//.........这里部分代码省略.........
开发者ID:upmunspel,项目名称:abiturient,代码行数:101,代码来源:Package.php

示例5: PEAR_Installer

}
$installer = new PEAR_Installer($ui);
$pkg = new PEAR_PackageFile($config, $debug);
foreach ($install_files as $package => $instfile) {
    $info = $pkg->fromAnyFile($instfile, PEAR_VALIDATE_INSTALLING);
    if (PEAR::isError($info)) {
        if (is_array($info->getUserInfo())) {
            foreach ($info->getUserInfo() as $err) {
                $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err['message']));
            }
        }
        $ui->outputData(sprintf("[PEAR] %s: %s", $package, $info->getMessage()));
        continue;
    }
    $new_ver = $info->getVersion();
    $downloaderpackage = new PEAR_Downloader_Package($installer);
    $err = $downloaderpackage->initialize($instfile);
    if (PEAR::isError($err)) {
        $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
        continue;
    }
    if ($reg->packageExists($package)) {
        $old_ver = $reg->packageInfo($package, 'version');
        if (version_compare($new_ver, $old_ver, 'gt')) {
            $installer->setOptions($options);
            $dp = array($downloaderpackage);
            $installer->setDownloadedPackages($dp);
            $err = $installer->install($downloaderpackage, $options);
            if (PEAR::isError($err)) {
                $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
                continue;
开发者ID:phpsource,项目名称:pear-core,代码行数:31,代码来源:install-pear.php

示例6: validatePackage

 /**
  * validate a downloaded package against installed packages
  * 
  * As of PEAR 1.4.3, this will only validate
  *
  * @param array|PEAR_Downloader_Package|PEAR_PackageFile_v1|PEAR_PackageFile_v2
  *              $pkg package identifier (either
  *                   array('package' => blah, 'channel' => blah) or an array with
  *                   index 'info' referencing an object)
  * @param PEAR_Downloader $dl
  * @param array $params full list of packages to install
  * @return true|PEAR_Error
  */
 function validatePackage($pkg, &$dl, $params = array())
 {
     if (is_array($pkg) && isset($pkg['info'])) {
         $deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']);
     } else {
         $deps = $this->_dependencydb->getDependentPackageDependencies($pkg);
     }
     $fail = false;
     if ($deps) {
         if (!class_exists('PEAR_Downloader_Package')) {
             require_once 'PEAR/Downloader/Package.php';
         }
         $dp = new PEAR_Downloader_Package($dl);
         if (is_object($pkg)) {
             $dp->setPackageFile($pkg);
         } else {
             $dp->setDownloadURL($pkg);
         }
         PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
         foreach ($deps as $channel => $info) {
             foreach ($info as $package => $ds) {
                 foreach ($params as $packd) {
                     if (strtolower($packd->getPackage()) == strtolower($package) && $packd->getChannel() == $channel) {
                         $dl->log(3, 'skipping installed package check of "' . $this->_registry->parsedPackageNameToString(array('channel' => $channel, 'package' => $package), true) . '", version "' . $packd->getVersion() . '" will be ' . 'downloaded and installed');
                         continue 2;
                         // jump to next package
                     }
                 }
                 foreach ($ds as $d) {
                     $checker = new PEAR_Dependency2($this->_config, $this->_options, array('channel' => $channel, 'package' => $package), $this->_state);
                     $dep = $d['dep'];
                     $required = $d['type'] == 'required';
                     $ret = $checker->_validatePackageDownload($dep, $required, array(&$dp));
                     if (is_array($ret)) {
                         $dl->log(0, $ret[0]);
                     } elseif (PEAR::isError($ret)) {
                         $dl->log(0, $ret->getMessage());
                         $fail = true;
                     }
                 }
             }
         }
         PEAR::popErrorHandling();
     }
     if ($fail) {
         return $this->raiseError('%s cannot be installed, conflicts with installed packages');
     }
     return true;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:62,代码来源:Dependency2.php

示例7: _doMakeRPMFromPackage

 /**
  * Set the output macros based on a package source
  */
 function _doMakeRPMFromPackage($source_file, $command, $options, $params)
 {
     // Merge the "core" output macros with those for packages only
     $this->_output += $this->_output_package;
     // Set the name of the template spec file to use by default
     $this->_template_spec_name = 'template.spec';
     // Create a PEAR_PackageFile object and fill it with info from the
     // source package
     $reg =& $this->config->getRegistry();
     $pkg =& $this->getPackageFile($this->config, $this->_debug);
     $pf =& $pkg->fromAnyFile($source_file, PEAR_VALIDATE_NORMAL);
     if (PEAR::isError($pf)) {
         $u = $pf->getUserinfo();
         if (is_array($u)) {
             foreach ($u as $err) {
                 if (is_array($err)) {
                     $err = $err['message'];
                 }
                 $this->ui->outputData($err);
             }
         }
         return $this->raiseError("{$source_file} is not a valid package");
     }
     // Install the package into a temporary directory
     $tmpdir = $this->makeTempDir();
     $instroot = $this->makeTempDir();
     // Save a channel object for the channel our package is part of
     // We will need this later to stick back into the temporary
     // installation directory
     $chan = $reg->getChannel($pf->getChannel(), true);
     if (PEAR::isError($chan)) {
         $this->ui->outputData($chan->getMessage());
         return $this->raiseError("Could not find channel data for channel '" . $pf->getChannel() . " - you need to channel-discover or channel-add " . "the channel before building packages based on it.");
     }
     // Set the role prefixes - package won't actually be installed here
     // but we can pull the final install paths back out later to put into
     // our spec
     foreach ($this->_file_prefixes as $role => $prefix) {
         // if role is 'script' the corresponding option is bin_dir
         if ($role == 'script') {
             $role = 'bin';
         }
         // save the original config options to restore later
         $orig_config_options["{$role}_dir"] = $this->config->get("{$role}_dir");
         // Substitute the package name into the file prefix
         $prefix = str_replace('%s', $pf->getPackage(), $prefix);
         // Set the temporary role prefix for installation
         $this->config->set("{$role}_dir", $prefix);
     }
     // Construct a fake registry inside the ultimate destination
     // temporary directory, and load the necessary channel into it
     $regdir = $instroot . $this->config->get('php_dir');
     $fakereg = new PEAR_Registry($regdir);
     $fakereg->addChannel($chan);
     $tmp = $this->config->get('verbose');
     $this->config->set('verbose', 0);
     $installer = $this->getInstaller($this->ui);
     $installer->setConfig($this->config);
     require_once 'PEAR/Downloader/Package.php';
     $pack = new PEAR_Downloader_Package($installer);
     $pack->setPackageFile($pf);
     $params[0] =& $pack;
     $installer->setOptions(array('packagingroot' => $instroot, 'nodeps' => true, 'soft' => true));
     $installer->setDownloadedPackages($params);
     // Don't change $params[0] below to $source_file - it's not the same
     // any more (see $params[0] a few lines above here)
     $package_info = $installer->install($params[0], array('packagingroot' => $instroot, 'nodeps' => true, 'soft' => true));
     if (PEAR::isError($package_info)) {
         $this->ui->outputData($package_info->getMessage());
         return $this->raiseError('Failed to do a temporary installation of the package');
     }
     // Restore the original config options
     foreach ($orig_config_options as $key => $val) {
         $this->config->set($key, $val);
     }
     // Restore the original config verbosity
     $this->config->set('verbose', $tmp);
     // Set up some of the basic macros
     $this->_output['rpm_package'] = $this->_getRPMName($pf->getPackage(), $pf->getChannel(), null, 'pkg');
     $this->_output['description'] = wordwrap($package_info['description']);
     $this->_output['summary'] = trim($package_info['summary']);
     $this->_output['possible_channel'] = $pf->getChannel();
     $this->_output['channel_alias'] = $this->_getChannelAlias($pf->getPackage(), $pf->getChannel());
     $this->_output['package'] = $pf->getPackage();
     $this->_output['version'] = $pf->getVersion();
     $this->_output['release_license'] = $pf->getLicense();
     $this->_output['release_state'] = $pf->getState();
     // Remove trailing dots from summaries
     if (substr($this->_output['summary'], -1) == '.') {
         $this->_output['summary'] = substr($this->_output['summary'], 0, -1);
     }
     // Figure out the master server for the package's channel
     $chan = $reg->getChannel($pf->getChannel());
     $this->_output['master_server'] = $chan->getServer();
     // Put some standard PEAR config options into the output macros. These
     // will probably be deprecated in future
     $cfg = array('php_dir', 'ext_dir', 'doc_dir', 'bin_dir', 'data_dir', 'test_dir');
//.........这里部分代码省略.........
开发者ID:cmooony,项目名称:d4d-studio,代码行数:101,代码来源:Packaging.php


注:本文中的PEAR_Downloader_Package类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。