if (substr($long_opt, -2) != '==') {
/* Long option requires an argument.
Take the next argument if one wasn't specified. */;
- if (!$opt_arg && !(list(, $opt_arg) = each($args))) {
+ if (!strlen($opt_arg) && !(list(, $opt_arg) = each($args))) {
return PEAR::raiseError("Console_Getopt: option --$opt requires an argument");
}
}
PEAR_INSTALL_FLAGS = -n -dsafe_mode=0
install-pear-installer: $(top_builddir)/sapi/cli/php
- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php $(srcdir)/package-*.xml
+ @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" $(srcdir)/package-*.xml
install-pear-packages: $(top_builddir)/sapi/cli/php
- @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php $(srcdir)/packages/*.tar
+ @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" $(srcdir)/packages/*.tar
install-pear:
@echo "Installing PEAR environment: $(INSTALL_ROOT)$(peardir)/"
$spec_contents = preg_replace('/@([a-z0-9_-]+)@/e', '$info["\1"]', fread($fp, filesize($spec_template)));
fclose($fp);
$spec_file = "$info[rpm_package]-$info[version].spec";
- $wp = fopen($spec_file, "w");
+ $wp = fopen($spec_file, "wb");
if (!$wp) {
return $this->raiseError("could not write RPM spec file $spec_file: $php_errormsg");
}
$data = array(
'caption' => $caption,
'border' => 1,
- 'headline' => array('Package', 'Version', 'Size'),
+ 'headline' => array('Package', 'Local', 'Remote', 'Size'),
);
foreach ($latest as $pkg => $info) {
$package = strtolower($pkg);
} else {
$fs = " -"; // XXX center instead
}
- $data['data'][] = array($pkg, $version, $fs);
+ $data['data'][] = array($pkg, $inst_version, $version, $fs);
}
if (empty($data['data'])) {
$this->ui->outputData('No upgrades available');
* @var object
*/
$GLOBALS['_PEAR_Config_instance'] = null;
+if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) {
+ $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear';
+} else {
+ $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR;
+}
// Below we define constants with default values for all configuration
// parameters except username/password. All of them can have their
if (getenv('PHP_PEAR_INSTALL_DIR')) {
define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR'));
} else {
- if (@is_dir(PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) {
+ if (@is_dir($PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) {
define('PEAR_CONFIG_DEFAULT_PHP_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib');
+ $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib');
} else {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR', PEAR_INSTALL_DIR);
+ define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR);
}
}
if (getenv('PHP_PEAR_EXTENSION_DIR')) {
define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR'));
} else {
- if (!ini_get('extension_dir')) {
+ if (ini_get('extension_dir')) {
define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir'));
} elseif (defined('PEAR_EXTENSION_DIR') && @is_dir(PEAR_EXTENSION_DIR)) {
define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR);
define('PEAR_CONFIG_DEFAULT_DOC_DIR', getenv('PHP_PEAR_DOC_DIR'));
} else {
define('PEAR_CONFIG_DEFAULT_DOC_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs');
+ $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs');
}
// Default for bin_dir
define('PEAR_CONFIG_DEFAULT_DATA_DIR', getenv('PHP_PEAR_DATA_DIR'));
} else {
define('PEAR_CONFIG_DEFAULT_DATA_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data');
+ $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data');
}
// Default for test_dir
define('PEAR_CONFIG_DEFAULT_TEST_DIR', getenv('PHP_PEAR_TEST_DIR'));
} else {
define('PEAR_CONFIG_DEFAULT_TEST_DIR',
- PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests');
+ $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests');
}
// Default for cache_dir
{
if (isset($this->configuration[$layer])) {
unset($this->configuration[$layer]);
+ $this->layers = array_keys($this->configuration);
return true;
}
return false;
1 => array('wrap' => 20),
2 => array('wrap' => 35)
);
+ } else {
+ $opts = null;
}
if (isset($data['headline']) && is_array($data['headline'])) {
$this->_tableRow($data['headline'],
<?php
+// XXX TODO write the config file at the end as for example
+// in 'system' layer
+
/* $Id$ */
$pear_dir = dirname(__FILE__);
ini_set('include_path', $pear_dir);
-##//include_once 'PEAR/Config.php';
include_once 'PEAR.php';
include_once 'PEAR/Installer.php';
include_once 'PEAR/Registry.php';
include_once 'PEAR/Frontend/CLI.php';
-##//$config = &PEAR_Config::singleton();
-
-array_shift($argv);
-if ($argv[0] == '--force') {
- array_shift($argv);
- $force = true;
-} else {
- $force = false;
-}
-// package => install_file
+$force = false;
$install_files = array();
-
-/*
-$dp = opendir($pear_dir);
-while ($ent = readdir($dp)) {
- if (ereg('^package-(.*)\.xml$', $ent, $matches)) {
- $install_files[$matches[1]] = $ent;
- }
-}
-closedir($dp);
-*/
-foreach ($argv as $arg) {
+array_shift($argv);
+for ($i = 0; $i < sizeof($argv); $i++) {
+ $arg = $argv[$i];
$bn = basename($arg);
- if (ereg('^package-(.*)\.xml$', $bn, $matches) ||
- ereg('^([A-Za-z0-9_:]+)-.*\.(tar|tgz)$', $bn, $matches)) {
- $install_files[$matches[1]] = $arg;
+ if (ereg('package-(.*)\.xml$', $bn, $matches) ||
+ ereg('([A-Za-z0-9_:]+)-.*\.(tar|tgz)$', $bn, $matches)) {
+ $install_files[$matches[1]] = $bn;
+ } elseif ($arg == '--force') {
+ $force = true;
+ } elseif ($arg == '-d') {
+ $with_dir = $argv[$i+1];
+ $i++;
}
}
if ($layer == 'default') continue;
$config->removeLayer($layer);
}
+$keys = $config->getKeys();
$config->set('verbose', 0, 'default');
+// User supplied a dir prefix
+if (!empty($with_dir)) {
+ $ds = DIRECTORY_SEPARATOR;
+ $config->set('php_dir', $with_dir . $ds . 'lib', 'default');
+ $config->set('bin_dir', $with_dir . $ds . 'bin', 'default');
+ $config->set('doc_dir', $with_dir . $ds . 'doc', 'default');
+ $config->set('data_dir', $with_dir . $ds . 'data', 'default');
+ $config->set('test_dir', $with_dir . $ds . 'test', 'default');
+}
+/* Print PEAR Conf (useful for debuging do NOT REMOVE)
+sort($keys);
+foreach ($keys as $key) {
+ echo $config->getPrompt($key) . ": " . $config->get($key) . "\n";
+}
+exit;
+// end print
+//*/
-$options = array();
-$install_root = getenv("INSTALL_ROOT");
$php_dir = $config->get('php_dir');
+$options = array();
+$install_root = getenv('INSTALL_ROOT');
if (!empty($install_root)) {
$options['installroot'] = $install_root;
$reg_dir = $install_root . $php_dir;
$reg = &new PEAR_Registry($reg_dir);
$ui = &new PEAR_Frontend_CLI();
$installer = &new PEAR_Installer($ui);
-$installer->registry = &$reg;
+//$installer->registry = &$reg; // This should be changed in Installer/Registry
foreach ($install_files as $package => $instfile) {
if ($reg->packageExists($package)) {
}
$ui->outputData(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver));
} else {
- if (@$argv[1] == '--force') {
+ if ($force) {
$options['force'] = true;
$err = $installer->install($instfile, $options);
if (PEAR::isError($err)) {
}
}
-?>
\ No newline at end of file
+?>
<description>This class provides handling of tar files in PHP.
It supports creating, listing, extracting and adding to tar files.
Gzip support is available if PHP has the zlib extension built-in or
-loaded.
+loaded. Bz2 compression is also supported with the bz2 extension loaded.
</description>
<license>PHP License</license>
<maintainers>
</maintainer>
</maintainers>
<release>
- <version>0.9</version>
- <date>2002-05-27</date>
- <notes>
- * Auto-detect gzip'ed files
- </notes>
+ <version>1.1</version>
+ <date>2003-05-28</date>
+ <notes>* Add support for BZ2 compression
+* Add support for add and extract without using temporary files : methods addString() and extractInString()
+
+</notes>
<state>stable</state>
<filelist>
<dir name="Archive">
</filelist>
</release>
<changelog>
+ <release>
+ <version>1.0</version>
+ <date>2003-01-24</date>
+ <notes>Change status to stable</notes>
+ <state>stable</state>
+ <filelist>
+ <dir name="Archive">
+ <file role="php" name="Tar.php"/>
+ </dir>
+ <file role="doc" name="docs/Archive_Tar.txt" baseinstalldir="/"/>
+ </filelist>
+ </release>
+ <release>
+ <version>0.10-b1</version>
+ <date>2003-01-08</date>
+ <notes>Add support for long filenames (greater than 99 characters)</notes>
+ <state>beta</state>
+ </release>
+ <release>
+ <version>0.9</version>
+ <date>2002-05-27</date>
+ <notes>Auto-detect gzip'ed files</notes>
+ <state>stable</state>
+ </release>
<release>
<version>0.4</version>
<date>2002-05-20</date>
<!--
- $Id: package.dtd,v 1.27.4.5 2003-06-17 17:13:17 pajoye Exp $
+ $Id: package.dtd,v 1.27.4.6 2003-07-02 10:38:07 pajoye Exp $
This is the PEAR package description, version 1.0.
It should be used with the informal public identifier:
REM ----------------------------------------------------------------------\r
REM Copyright (c) 1997-2002 The PHP Group\r
REM ----------------------------------------------------------------------\r
-REM This source file is subject to version 2.02 of the PHP license,\r
+REM This source file is subject to version 3.0 of the PHP license, \r
REM that is bundled with this package in the file LICENSE, and is\r
REM available at through the world-wide-web at\r
-REM http://www.php.net/license/2_02.txt.\r
+REM http://www.php.net/license/3_0.txt. \r
REM If you did not receive a copy of the PHP license and are unable to\r
REM obtain it through the world-wide-web, please send a note to\r
REM license@php.net so we can mail you a copy immediately.\r
REM Authors: Alexander Merz (alexmerz@php.net)\r
REM ----------------------------------------------------------------------\r
REM\r
-REM $Id: pear.bat,v 1.14 2003/04/03 23:21:30 ssb Exp $\r
+REM $Id: pear.bat,v 1.15 2003/06/10 20:03:44 imajes Exp $\r
\r
REM change this lines to match the paths of your system\r
REM -------------------\r
return $ret;
} elseif ($command == "version") {
- return "PEAR Version: ".$GLOBALS['pear_package_version']."\nPHP Version: ".phpversion()."\nZend Engine Version: ".zend_version();
+ return "PEAR Version: ".$GLOBALS['pear_package_version'].
+ "\nPHP Version: ".phpversion().
+ "\nZend Engine Version: ".zend_version().
+ "\nRunning on: ".php_uname();
} elseif ($help = PEAR_Command::getHelp($command)) {
if (is_string($help)) {