update Console_Getopt to 1.3.0, don't require php-devel (#657812)

This commit is contained in:
remi 2010-12-12 09:40:58 +01:00
parent bee08edc63
commit e598df7b10
4 changed files with 309 additions and 301 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ XML_Util-1.2.1.tgz
/Structures_Graph-1.0.4.tgz /Structures_Graph-1.0.4.tgz
/XML_RPC-1.5.4.tgz /XML_RPC-1.5.4.tgz
/XML_Util-1.2.1.tgz /XML_Util-1.2.1.tgz
/Console_Getopt-1.3.0.tgz

View File

@ -1,296 +1,296 @@
<?php <?php
/* $Id: install-pear.php,v 1.38 2009/04/20 04:32:22 cellog Exp $ */ /* $Id$ */
error_reporting(1803); error_reporting(1803);
if (ini_get('date.timezone') === '' && function_exists('date_default_timezone_set')) { if (ini_get('date.timezone') === '' && function_exists('date_default_timezone_set')) {
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
} }
$pear_dir = dirname(__FILE__); $pear_dir = dirname(__FILE__);
ini_set('include_path', ''); ini_set('include_path', '');
if (function_exists('mb_internal_encoding')) { if (function_exists('mb_internal_encoding')) {
mb_internal_encoding('ASCII'); mb_internal_encoding('ASCII');
} }
set_time_limit(0); set_time_limit(0);
include_once 'PEAR.php'; include_once 'PEAR.php';
include_once 'PEAR/Installer.php'; include_once 'PEAR/Installer.php';
include_once 'PEAR/Registry.php'; include_once 'PEAR/Registry.php';
include_once 'PEAR/PackageFile.php'; include_once 'PEAR/PackageFile.php';
include_once 'PEAR/Downloader/Package.php'; include_once 'PEAR/Downloader/Package.php';
include_once 'PEAR/Frontend.php'; include_once 'PEAR/Frontend.php';
$a = true; $a = true;
if (!PEAR::loadExtension('xml')) { if (!PEAR::loadExtension('xml')) {
$a = false; $a = false;
echo "[PEAR] xml extension is required\n"; echo "[PEAR] xml extension is required\n";
} }
if (!PEAR::loadExtension('pcre')) { if (!PEAR::loadExtension('pcre')) {
$a = false; $a = false;
echo "[PEAR] pcre extension is required\n"; echo "[PEAR] pcre extension is required\n";
} }
if (!$a) { if (!$a) {
return -1; return -1;
} }
$force = false; $force = false;
$install_files = array(); $install_files = array();
array_shift($argv); array_shift($argv);
$debug = false; $debug = false;
for ($i = 0; $i < sizeof($argv); $i++) { for ($i = 0; $i < sizeof($argv); $i++) {
$arg = $argv[$i]; $arg = $argv[$i];
$bn = basename($arg); $bn = basename($arg);
if (ereg('package-(.*)\.xml$', $bn, $matches) || if (preg_match('/package-(.*)\.xml$/', $bn, $matches) ||
ereg('([A-Za-z0-9_:]+)-.*\.(tar|tgz)$', $bn, $matches)) { preg_match('/([A-Za-z0-9_:]+)-.*\.(tar|tgz)$/', $bn, $matches)) {
$install_files[$matches[1]] = $arg; $install_files[$matches[1]] = $arg;
} elseif ($arg == '-a') { } elseif ($arg == '-a') {
$cache_dir = $argv[$i+1]; $cache_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '--force') { } elseif ($arg == '--force') {
$force = true; $force = true;
} elseif ($arg == '-dp') { } elseif ($arg == '-dp') {
$prefix = $argv[$i+1]; $prefix = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-ds') { } elseif ($arg == '-ds') {
$suffix = $argv[$i+1]; $suffix = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-d') { } elseif ($arg == '-d') {
$with_dir = $argv[$i+1]; $with_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-b') { } elseif ($arg == '-b') {
$bin_dir = $argv[$i+1]; $bin_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-c') { } elseif ($arg == '-c') {
$cfg_dir = $argv[$i+1]; $cfg_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-w') { } elseif ($arg == '-w') {
$www_dir = $argv[$i+1]; $www_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-p') { } elseif ($arg == '-p') {
$php_bin = $argv[$i+1]; $php_bin = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-o') { } elseif ($arg == '-o') {
$download_dir = $argv[$i+1]; $download_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '-t') { } elseif ($arg == '-t') {
$temp_dir = $argv[$i+1]; $temp_dir = $argv[$i+1];
$i++; $i++;
} elseif ($arg == '--debug') { } elseif ($arg == '--debug') {
$debug = 1; $debug = 1;
} elseif ($arg == '--extremedebug') { } elseif ($arg == '--extremedebug') {
$debug = 2; $debug = 2;
} }
} }
$config = PEAR_Config::singleton(); $config = PEAR_Config::singleton();
if (PEAR::isError($config)) { if (PEAR::isError($config)) {
$locs = PEAR_Config::getDefaultConfigFiles(); $locs = PEAR_Config::getDefaultConfigFiles();
die("ERROR: One of $locs[user] or $locs[system] is corrupt, please remove them and try again"); die("ERROR: One of $locs[user] or $locs[system] is corrupt, please remove them and try again");
} }
// make sure we use only default values // make sure we use only default values
$config_layers = $config->getLayers(); $config_layers = $config->getLayers();
foreach ($config_layers as $layer) { foreach ($config_layers as $layer) {
if ($layer == 'default') continue; if ($layer == 'default') continue;
$config->removeLayer($layer); $config->removeLayer($layer);
} }
$keys = $config->getKeys(); $keys = $config->getKeys();
if ($debug) { if ($debug) {
$config->set('verbose', 5, 'default'); $config->set('verbose', 5, 'default');
} else { } else {
$config->set('verbose', 0, 'default'); $config->set('verbose', 0, 'default');
} }
// PEAR executables // PEAR executables
if (!empty($bin_dir)) { if (!empty($bin_dir)) {
$config->set('bin_dir', $bin_dir, 'default'); $config->set('bin_dir', $bin_dir, 'default');
} }
// Cache files // Cache files
if (!empty($cache_dir)) { if (!empty($cache_dir)) {
$config->set('cache_dir', $cache_dir, 'default'); $config->set('cache_dir', $cache_dir, 'default');
} }
// Config files // Config files
if (!empty($cfg_dir)) { if (!empty($cfg_dir)) {
$config->set('cfg_dir', $cfg_dir, 'default'); $config->set('cfg_dir', $cfg_dir, 'default');
} }
// Web files // Web files
if (!empty($www_dir)) { if (!empty($www_dir)) {
$config->set('www_dir', $www_dir, 'default'); $config->set('www_dir', $www_dir, 'default');
} }
// Downloaded files // Downloaded files
if (!empty($download_dir)) { if (!empty($download_dir)) {
$config->set('download_dir', $download_dir, 'default'); $config->set('download_dir', $download_dir, 'default');
} }
// Temporary files // Temporary files
if (!empty($temp_dir)) { if (!empty($temp_dir)) {
$config->set('temp_dir', $temp_dir, 'default'); $config->set('temp_dir', $temp_dir, 'default');
} }
// User supplied a dir prefix // User supplied a dir prefix
if (!empty($with_dir)) { if (!empty($with_dir)) {
$ds = DIRECTORY_SEPARATOR; $ds = DIRECTORY_SEPARATOR;
$config->set('php_dir', $with_dir, 'default'); $config->set('php_dir', $with_dir, 'default');
$config->set('doc_dir', $with_dir . $ds . 'doc', 'default'); $config->set('doc_dir', $with_dir . $ds . 'doc', 'default');
$config->set('data_dir', $with_dir . $ds . 'data', 'default'); $config->set('data_dir', $with_dir . $ds . 'data', 'default');
$config->set('test_dir', $with_dir . $ds . 'test', 'default'); $config->set('test_dir', $with_dir . $ds . 'test', 'default');
if (empty($www_dir)) { if (empty($www_dir)) {
$config->set('www_dir', $with_dir . $ds . 'htdocs', 'default'); $config->set('www_dir', $with_dir . $ds . 'htdocs', 'default');
} }
if (empty($cfg_dir)) { if (empty($cfg_dir)) {
$config->set('cfg_dir', $with_dir . $ds . 'cfg', 'default'); $config->set('cfg_dir', $with_dir . $ds . 'cfg', 'default');
} }
if (!is_writable($config->get('cache_dir'))) { if (!is_writable($config->get('cache_dir'))) {
include_once 'System.php'; include_once 'System.php';
$cdir = System::mktemp(array('-d', 'pear')); $cdir = System::mktemp(array('-d', 'pear'));
if (PEAR::isError($cdir)) { if (PEAR::isError($cdir)) {
$ui->outputData("[PEAR] cannot make new temporary directory: " . $cdir); $ui->outputData("[PEAR] cannot make new temporary directory: " . $cdir);
die(1); die(1);
} }
$oldcachedir = $config->get('cache_dir'); $oldcachedir = $config->get('cache_dir');
$config->set('cache_dir', $cdir); $config->set('cache_dir', $cdir);
} }
} }
// PHP executable // PHP executable
if (!empty($php_bin)) { if (!empty($php_bin)) {
$config->set('php_bin', $php_bin); $config->set('php_bin', $php_bin);
} }
// PHP prefix // PHP prefix
if (isset($prefix)) { if (isset($prefix)) {
if ($prefix != 'a') { if ($prefix != 'a') {
if ($prefix[0] == 'a') { if ($prefix[0] == 'a') {
$prefix = substr($prefix, 1); $prefix = substr($prefix, 1);
} }
$config->set('php_prefix', $prefix, 'system'); $config->set('php_prefix', $prefix, 'system');
} }
} }
// PHP suffix // PHP suffix
if (isset($suffix)) { if (isset($suffix)) {
if ($suffix != 'a') { if ($suffix != 'a') {
if ($suffix[0] == 'a') { if ($suffix[0] == 'a') {
$suffix = substr($suffix, 1); $suffix = substr($suffix, 1);
} }
$config->set('php_suffix', $suffix, 'system'); $config->set('php_suffix', $suffix, 'system');
} }
} }
/* Print PEAR Conf (useful for debuging do NOT REMOVE) */ /* Print PEAR Conf (useful for debuging do NOT REMOVE) */
if ($debug) { if ($debug) {
sort($keys); sort($keys);
foreach ($keys as $key) { foreach ($keys as $key) {
echo $key . ' ' . echo $key . ' ' .
$config->getPrompt($key) . ": " . $config->get($key, null, 'default') . "\n"; $config->getPrompt($key) . ": " . $config->get($key, null, 'default') . "\n";
} }
if ($debug == 2) { // extreme debugging if ($debug == 2) { // extreme debugging
exit; exit;
} }
} }
// end print // end print
$php_dir = $config->get('php_dir'); $php_dir = $config->get('php_dir');
$options = array(); $options = array();
$options['upgrade'] = true; $options['upgrade'] = true;
$install_root = getenv('INSTALL_ROOT'); $install_root = getenv('INSTALL_ROOT');
if (!empty($install_root)) { if (!empty($install_root)) {
$options['packagingroot'] = $install_root; $options['packagingroot'] = $install_root;
$reg = &new PEAR_Registry($options['packagingroot']); $reg = &new PEAR_Registry($options['packagingroot']);
} else { } else {
$reg = $config->getRegistry('default'); $reg = $config->getRegistry('default');
} }
$ui = PEAR_Frontend::singleton('PEAR_Frontend_CLI'); $ui = PEAR_Frontend::singleton('PEAR_Frontend_CLI');
if (PEAR::isError($ui)) { if (PEAR::isError($ui)) {
die($ui->getMessage()); die($ui->getMessage());
} }
$installer = new PEAR_Installer($ui); $installer = new PEAR_Installer($ui);
$pkg = new PEAR_PackageFile($config, $debug); $pkg = new PEAR_PackageFile($config, $debug);
foreach ($install_files as $package => $instfile) { foreach ($install_files as $package => $instfile) {
$info = $pkg->fromAnyFile($instfile, PEAR_VALIDATE_INSTALLING); $info = $pkg->fromAnyFile($instfile, PEAR_VALIDATE_INSTALLING);
if (PEAR::isError($info)) { if (PEAR::isError($info)) {
if (is_array($info->getUserInfo())) { if (is_array($info->getUserInfo())) {
foreach ($info->getUserInfo() as $err) { foreach ($info->getUserInfo() as $err) {
$ui->outputData(sprintf("[PEAR] %s: %s", $package, $err['message'])); $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err['message']));
} }
} }
$ui->outputData(sprintf("[PEAR] %s: %s", $package, $info->getMessage())); $ui->outputData(sprintf("[PEAR] %s: %s", $package, $info->getMessage()));
continue; continue;
} }
$new_ver = $info->getVersion(); $new_ver = $info->getVersion();
$downloaderpackage = new PEAR_Downloader_Package($installer); $downloaderpackage = new PEAR_Downloader_Package($installer);
$err = $downloaderpackage->initialize($instfile); $err = $downloaderpackage->initialize($instfile);
if (PEAR::isError($err)) { if (PEAR::isError($err)) {
$ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
continue; continue;
} }
if ($reg->packageExists($package)) { if ($reg->packageExists($package)) {
$old_ver = $reg->packageInfo($package, 'version'); $old_ver = $reg->packageInfo($package, 'version');
if (version_compare($new_ver, $old_ver, 'gt')) { if (version_compare($new_ver, $old_ver, 'gt')) {
$installer->setOptions($options); $installer->setOptions($options);
$dp = array($downloaderpackage); $dp = array($downloaderpackage);
$installer->setDownloadedPackages($dp); $installer->setDownloadedPackages($dp);
$err = $installer->install($downloaderpackage, $options); $err = $installer->install($downloaderpackage, $options);
if (PEAR::isError($err)) { if (PEAR::isError($err)) {
$ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
continue; continue;
} }
$ui->outputData(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver)); $ui->outputData(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver));
} else { } else {
if ($force) { if ($force) {
$options['force'] = true; $options['force'] = true;
$installer->setOptions($options); $installer->setOptions($options);
$dp = array($downloaderpackage); $dp = array($downloaderpackage);
$installer->setDownloadedPackages($dp); $installer->setDownloadedPackages($dp);
$err = $installer->install($downloaderpackage, $options); $err = $installer->install($downloaderpackage, $options);
if (PEAR::isError($err)) { if (PEAR::isError($err)) {
$ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
continue; continue;
} }
$ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver)); $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
} else { } else {
$ui->outputData(sprintf("[PEAR] %-15s- already installed: %s", $package, $old_ver)); $ui->outputData(sprintf("[PEAR] %-15s- already installed: %s", $package, $old_ver));
} }
} }
} else { } else {
$options['nodeps'] = true; $options['nodeps'] = true;
$installer->setOptions($options); $installer->setOptions($options);
$dp = array($downloaderpackage); $dp = array($downloaderpackage);
$installer->setDownloadedPackages($dp); $installer->setDownloadedPackages($dp);
$err = $installer->install($downloaderpackage, $options); $err = $installer->install($downloaderpackage, $options);
if (PEAR::isError($err)) { if (PEAR::isError($err)) {
$ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage())); $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
continue; continue;
} }
$ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver)); $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
} }
if ($package == 'PEAR') { if ($package == 'PEAR') {
if (is_file($ufile = $config->getConfFile('user'))) { if (is_file($ufile = $config->getConfFile('user'))) {
$ui->outputData('Warning! a PEAR user config file already exists from ' . $ui->outputData('Warning! a PEAR user config file already exists from ' .
'a previous PEAR installation at ' . 'a previous PEAR installation at ' .
"'$ufile'. You may probably want to remove it."); "'$ufile'. You may probably want to remove it.");
} }
$config->set('verbose', 1, 'default'); $config->set('verbose', 1, 'default');
if (isset($oldcachedir)) { if (isset($oldcachedir)) {
$config->set('cache_dir', $oldcachedir); $config->set('cache_dir', $oldcachedir);
} }
$data = array(); $data = array();
foreach ($config->getKeys() as $key) { foreach ($config->getKeys() as $key) {
$data[$key] = $config->get($key); $data[$key] = $config->get($key);
} }
$cnf_file = $config->getConfFile('system'); $cnf_file = $config->getConfFile('system');
if (!empty($install_root)) { if (!empty($install_root)) {
$cnf_file = $install_root . DIRECTORY_SEPARATOR . $cnf_file; $cnf_file = $install_root . DIRECTORY_SEPARATOR . $cnf_file;
} }
$config->writeConfigFile($cnf_file, 'system', $data); $config->writeConfigFile($cnf_file, 'system', $data);
$ui->outputData('Wrote PEAR system config file at: ' . $cnf_file); $ui->outputData('Wrote PEAR system config file at: ' . $cnf_file);
$ui->outputData('You may want to add: ' . $config->get('php_dir') . ' to your php.ini include_path'); $ui->outputData('You may want to add: ' . $config->get('php_dir') . ' to your php.ini include_path');
} }
} }
?> ?>

View File

@ -1,7 +1,7 @@
%global peardir %{_datadir}/pear %global peardir %{_datadir}/pear
%global xmlrpcver 1.5.4 %global xmlrpcver 1.5.4
%global getoptver 1.2.3 %global getoptver 1.3.0
%global arctarver 1.3.7 %global arctarver 1.3.7
%global structver 1.0.4 %global structver 1.0.4
%global xmlutil 1.2.1 %global xmlutil 1.2.1
@ -9,7 +9,7 @@
Summary: PHP Extension and Application Repository framework Summary: PHP Extension and Application Repository framework
Name: php-pear Name: php-pear
Version: 1.9.1 Version: 1.9.1
Release: 5%{?dist} Release: 6%{?dist}
Epoch: 1 Epoch: 1
# PEAR, Archive_Tar, XML_Util are BSD # PEAR, Archive_Tar, XML_Util are BSD
# XML-RPC, Console_Getopt are PHP # XML-RPC, Console_Getopt are PHP
@ -18,7 +18,7 @@ License: BSD and PHP and LGPLv2+
Group: Development/Languages Group: Development/Languages
URL: http://pear.php.net/package/PEAR URL: http://pear.php.net/package/PEAR
Source0: http://download.pear.php.net/package/PEAR-%{version}.tgz Source0: http://download.pear.php.net/package/PEAR-%{version}.tgz
# wget http://cvs.php.net/viewvc.cgi/pear-core/install-pear.php?revision=1.39 -O install-pear.php # wget http://svn.php.net/viewvc/pear/pear-core/trunk/install-pear.php?revision=287906&view=co -O install-pear.php
Source1: install-pear.php Source1: install-pear.php
Source2: relocate.php Source2: relocate.php
Source3: strip.php Source3: strip.php
@ -36,6 +36,7 @@ Source24: http://pear.php.net/get/XML_Util-%{xmlutil}.tgz
BuildArch: noarch BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: php-cli >= 5.1.0-1, php-xml, gnupg BuildRequires: php-cli >= 5.1.0-1, php-xml, gnupg
Provides: php-pear(Console_Getopt) = %{getoptver} Provides: php-pear(Console_Getopt) = %{getoptver}
Provides: php-pear(Archive_Tar) = %{arctarver} Provides: php-pear(Archive_Tar) = %{arctarver}
Provides: php-pear(PEAR) = %{version} Provides: php-pear(PEAR) = %{version}
@ -44,7 +45,8 @@ Provides: php-pear(XML_RPC) = %{xmlrpcver}
Provides: php-pear(XML_Util) = %{xmlutil} Provides: php-pear(XML_Util) = %{xmlutil}
Obsoletes: php-pear-XML-Util <= %{xmlutil} Obsoletes: php-pear-XML-Util <= %{xmlutil}
Provides: php-pear-XML-Util = %{xmlutil}-%{release} Provides: php-pear-XML-Util = %{xmlutil}-%{release}
Requires: php-cli >= 5.1.0-1, php-devel Requires: php-cli >= 5.1.0-1
%description %description
PEAR is a framework and distribution system for reusable PHP PEAR is a framework and distribution system for reusable PHP
@ -164,6 +166,11 @@ rm new-pear.conf
%changelog %changelog
* Sun Dec 12 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-6
- update Console_Getopt to 1.3.0
- don't require php-devel (#657812)
- update install-pear.php
* Tue Oct 26 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-5 * Tue Oct 26 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-5
- update Structures_Graph to 1.0.4 - update Structures_Graph to 1.0.4

View File

@ -1,5 +1,5 @@
a40b15b38ef8a5239309c9faedfa123b Archive_Tar-1.3.7.tgz a40b15b38ef8a5239309c9faedfa123b Archive_Tar-1.3.7.tgz
d7618327f9302a7191893768982de823 Console_Getopt-1.2.3.tgz d8e9e8e5efc5a4afdc7e62b294b2655e Console_Getopt-1.3.0.tgz
e301d2d81371327a96864a307b85509d PEAR-1.9.1.tgz e301d2d81371327a96864a307b85509d PEAR-1.9.1.tgz
b99c5e9ac348a2e81515ba16deb7ded3 Structures_Graph-1.0.4.tgz b99c5e9ac348a2e81515ba16deb7ded3 Structures_Graph-1.0.4.tgz
da0d1c21960a67bc76629db28d2c7755 XML_RPC-1.5.4.tgz da0d1c21960a67bc76629db28d2c7755 XML_RPC-1.5.4.tgz