update to 1.9.4 [release 1.9.4-1mamba;Mon Mar 18 2013]

This commit is contained in:
Silvan Calarco 2024-01-06 09:59:39 +01:00
parent b738165c31
commit 54c685a4a5
9 changed files with 655 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# php-pear
PEAR is a framework and distribution system for reusable PHP components. This package contains the basic PEAR components.

333
install-pear.php Normal file
View File

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

35
macros.pear Normal file
View File

@ -0,0 +1,35 @@
#
# Define full path to pear/pecl commands to be used in scriptlets:
#
%__pear %{_bindir}/pear
%__pecl %{_bindir}/pecl
#
# Define PEAR directories used in php-pear-* spec files
#
%pear_phpdir %(%{__pear} config-get php_dir 2> /dev/null || echo undefined)
%pear_docdir %(%{__pear} config-get doc_dir 2> /dev/null || echo undefined)
%pear_testdir %(%{__pear} config-get test_dir 2> /dev/null || echo undefined)
%pear_datadir %(%{__pear} config-get data_dir 2> /dev/null || echo undefined)
%pear_cfgdir %(%{__pear} config-get cfg_dir 2> /dev/null || echo undefined)
%pear_wwwdir %(%{__pear} config-get www_dir 2> /dev/null || echo undefined)
#
# Define PECL directories used in php-pecl-* spec files:
#
%pecl_phpdir %(%{__pecl} config-get php_dir 2> /dev/null || echo undefined)
%pecl_docdir %(%{__pecl} config-get doc_dir 2> /dev/null || echo undefined)
%pecl_testdir %(%{__pecl} config-get test_dir 2> /dev/null || echo undefined)
%pecl_datadir %(%{__pecl} config-get data_dir 2> /dev/null || echo undefined)
#
# Define XML directories to store package registration information:
#
%pear_xmldir %{pear_phpdir}/.pkgxml
%pecl_xmldir %{pecl_phpdir}/.pkgxml
#
# Define macros to be used in scriplets for php-pecl-* spec files:
#
%pecl_install %{__pecl} install --nodeps --soft --force --register-only --nobuild
%pecl_uninstall %{__pecl} uninstall --nodeps --ignore-errors --register-only

3
pear.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/bin/php -C -d include_path=/usr/lib/php \
-d output_buffering=1 /usr/lib/php/pearcmd.php "$@"

3
peardev.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/bin/php -d memory_limit="-1" -C -q -d include_path=/usr/lib/php \
-d output_buffering=1 /usr/lib/php/pearcmd.php "$@"

3
pecl.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/bin/php -C -n -q -d include_path=/usr/lib/php \
-d output_buffering=1 /usr/lib/php/peclcmd.php "$@"

180
php-pear.spec Normal file
View File

@ -0,0 +1,180 @@
#%define _peardir %{_datadir}/pear
%define peardir %{_libdir}/php
%global metadir %{_localstatedir}/lib/pear
%define xml_rpc_version 1.5.5
%define archive_tar_version 1.3.11
%define console_getopt_version 1.3.1
%define structures_graph_version 1.0.4
%define xml_util_version 1.2.1
Name: php-pear
Version: 1.9.4
Release: 1mamba
Summary: PHP Extension and Application Repository framework
Group: Development/Languages
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://pear.php.net/package/PEAR
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
Source1: install-pear.php
Source2: relocate.php
Source3: strip.php
Source10: pear.sh
Source11: pecl.sh
Source12: peardev.sh
Source13: macros.pear
Source20: http://pear.php.net/get/XML_RPC-%{xml_rpc_version}.tgz
Source21: http://pear.php.net/get/Archive_Tar-%{archive_tar_version}.tgz
Source22: http://pear.php.net/get/Console_Getopt-%{console_getopt_version}.tgz
Source23: http://pear.php.net/get/Structures_Graph-%{structures_graph_version}.tgz
Source24: http://pear.php.net/get/XML_Util-%{xml_util_version}.tgz
License: BSD, LGPL, PHP
## AUTOBUILDREQ-BEGIN
## AUTOBUILDREQ-END
BuildRequires: gnupg
BuildRequires: php
Provides: php-pear(PEAR) = %{version}
Provides: php-pear(XML_RPC) = %{xml_rpc_version}
Provides: php-pear(Archive_Tar) = %{archive_tar_version}
Provides: php-pear(Console_Getopt) = %{console_getopt_version}
Provides: php-pear(Structures_Graph) = %{structures_graph_version}
Provides: php-pear(XML_Util) = %{xml_util_version}
Requires: php
Provides: php-PEAR
Obsoletes: php-PEAR
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
PEAR is a framework and distribution system for reusable PHP components. This package contains the basic PEAR components.
%prep
%setup -q -c -n PEAR-%{version} -T
for p in %{SOURCE0} %{SOURCE21} %{SOURCE22} %{SOURCE23} %{SOURCE24} ; do
tar xzf $p --strip-components 1 || tar xzf $p --strip-path 1
fp=${p##*/}
[ -f LICENSE ] && mv LICENSE LICENSE-${fp%%-*}
[ -f README ] && mv README README-${fp%%-*}
done
tar xzf %{SOURCE24} package.xml
mv package.xml XML_Util.xml
%build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
export PHP_PEAR_SYSCONF_DIR=%{_sysconfdir}/php
export PHP_PEAR_SIG_KEYDIR=%{_sysconfdir}/php/pearkeys
export PHP_PEAR_SIG_BIN=%{_bindir}/gpg
export PHP_PEAR_INSTALL_DIR=%{peardir}
export PHP_PEAR_CACHE_DIR=${PWD}%{_localstatedir}/cache/php-pear
export PHP_PEAR_TEMP_DIR=/var/tmp
install -d %{buildroot}%{peardir} \
%{buildroot}%{_localstatedir}/cache/php-pear \
%{buildroot}%{_localstatedir}/www/html \
%{buildroot}%{peardir}/.pkgxml \
%{buildroot}%{_sysconfdir}/rpm \
%{buildroot}%{_sysconfdir}/php
export INSTALL_ROOT=%{buildroot}
%{_bindir}/php -n -dmemory_limit=64M -dshort_open_tag=0 -dsafe_mode=0 \
-derror_reporting="E_ALL&\~E_DEPRECATED" -ddetect_unicode=0 \
%{SOURCE1} --force \
--dir %{peardir} \
--cache %{_localstatedir}/cache/php-pear \
--config %{_sysconfdir}/php \
--bin %{_bindir} \
--www %{_localstatedir}/www/html \
--doc %{_docdir}/pear \
--test %{_datadir}/tests/pear \
--data %{_datadir}/pear-data \
--metadata %{metadir} \
%{SOURCE0} %{SOURCE21} %{SOURCE22} %{SOURCE23} %{SOURCE24} %{SOURCE20}
install -D -m 755 %{SOURCE10} %{buildroot}%{_bindir}/pear
install -m 755 %{SOURCE11} %{buildroot}%{_bindir}/pecl
install -m 755 %{SOURCE12} %{buildroot}%{_bindir}/peardev
# Sanitize the pear.conf
%{_bindir}/php %{SOURCE3} %{buildroot}%{_sysconfdir}/php/pear.conf ext_dir >new-pear.conf
%{_bindir}/php %{SOURCE3} new-pear.conf http_proxy > %{buildroot}%{_sysconfdir}/php/pear.conf
%{_bindir}/php -r "print_r(unserialize(substr(file_get_contents('%{buildroot}%{_sysconfdir}/php/pear.conf'),17)));"
#%{_bindir}/php -n %{SOURCE2} %{buildroot}%{_sysconfdir}/php/pear.conf %{buildroot} |
#%{_bindir}/php -n %{SOURCE2} php://stdin $PWD > new-pear.conf
#%{_bindir}/php -n %{SOURCE3} new-pear.conf ext_dir |
#%{_bindir}/php -n %{SOURCE3} php://stdin http_proxy > %{buildroot}%{_sysconfdir}/php/pear.conf
#
#%{_bindir}/php -r "print_r(unserialize(substr(file_get_contents('%{buildroot}%{_sysconfdir}/php/pear.conf'),17)));"
install -m 644 -c %{SOURCE13} %{buildroot}%{_sysconfdir}/rpm/macros.pear
pushd %{buildroot}%{peardir}
# -- no patch
popd
rm -rf %{buildroot}/.depdb* %{buildroot}/.lock %{buildroot}/.channels %{buildroot}/.filemap
install -m 644 XML_Util.xml %{buildroot}%{peardir}/.pkgxml/
%check
grep %{buildroot} %{buildroot}%{_sysconfdir}/php/pear.conf && exit 1
#grep %{_libdir} %{buildroot}%{_sysconfdir}/php/pear.conf && exit 1
grep '"/tmp"' %{buildroot}%{_sysconfdir}/php/pear.conf && exit 1
grep /usr/local %{buildroot}%{_sysconfdir}/php/pear.conf && exit 1
grep -rl %{buildroot} %{buildroot} && exit 1
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
rm new-pear.conf
%triggerpostun -- php-pear-XML-Util
%{_bindir}/pear install --nodeps --soft --force --register-only %{pear_xmldir}/XML_Util.xml >/dev/null || :
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/php/pear.conf
%config %{_sysconfdir}/rpm/macros.pear
%dir %{_localstatedir}/cache/php-pear
%dir %{_localstatedir}/www/html
%{_bindir}/pear
%{_bindir}/peardev
%{_bindir}/pecl
%dir %{peardir}
%{peardir}/*
%dir %{peardir}/.channels
%{peardir}/.channels/*
%dir %{peardir}/.channels/.alias
%{peardir}/.channels/.alias/*
%dir %{peardir}/.pkgxml
%{peardir}/.pkgxml/*
%dir %{peardir}/.registry
%{peardir}/.registry/*
%{peardir}/.depdb
%{peardir}/.depdblock
%{peardir}/.filemap
%{peardir}/.lock
%dir %{_datadir}/pear-data
%dir %{_datadir}/pear-data/PEAR
%{_datadir}/pear-data/PEAR/package.dtd
%{_datadir}/pear-data/PEAR/template.spec
%dir %{_datadir}/pear-data/Structures_Graph
%{_datadir}/pear-data/Structures_Graph/LICENSE
%dir %{_datadir}/tests/pear
%{_datadir}/tests/pear/*
%dir %{_datadir}/doc/pear
%{_datadir}/doc/pear/*
%doc LICENSE*
#README*
%changelog
* Mon Mar 18 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 1.9.4-1mamba
- update to 1.9.4
* Sat Jul 24 2010 gil <puntogil@libero.it> 1.9.0-1mamba
- package created by autospec

61
relocate.php Normal file
View File

@ -0,0 +1,61 @@
<?php
#
# relocate.php /path/to/file prefix
#
# Takes a file as input and a string prefix; reads
# the file as a serialized data blob and strips PREFIX
# from the beginning of each string value within the blob.
# Serializes again and writes output to stdout.
#
$file = $_SERVER['argv'][1];
$destdir = $_SERVER['argv'][2];
$destdir_len = strlen($destdir);
function relocate_string($value) {
global $destdir, $destdir_len;
if (strncmp($value, $destdir, $destdir_len) == 0) {
$value = substr($value, $destdir_len);
}
return $value;
}
function relocate_value($value) {
if (is_string($value)) {
$value = relocate_string($value);
} else if (is_array($value)) {
$value = relocate_array($value);
}
return $value;
}
function relocate_array($array) {
$result = array();
foreach ($array as $key => $value) {
if (is_string($key)) {
$key = relocate_string($key);
}
$result[$key] = relocate_value($value);
}
return $result;
}
$input = file_get_contents($file);
# Special case for /etc/pear.conf.
if (strncmp($input, "#PEAR_Config 0.9\n", 17) == 0) {
echo substr($input, 0, 17);
$s = substr($input, 17);
} else {
$s = $input;
}
echo serialize(relocate_value(unserialize($s)));
?>

35
strip.php Normal file
View File

@ -0,0 +1,35 @@
<?php
#
# strip.php /path/to/file key_name
#
# Takes a file as input and a string prefix; reads
# the file as a serialized data blob and removes a
# key with name key_name from the hash.
# Serializes again and writes output to stdout.
#
$file = $_SERVER['argv'][1];
$key = $_SERVER['argv'][2];
function remove_key($array, $name) {
if (array_key_exists($name, $array)) {
unset($array[$name]);
}
return $array;
}
$input = file_get_contents($file);
# Special case for /etc/pear.conf.
if (strncmp($input, "#PEAR_Config 0.9\n", 17) == 0) {
echo substr($input, 0, 17);
$s = substr($input, 17);
} else {
$s = $input;
}
echo serialize(remove_key(unserialize($s), $key));
?>