]> granicus.if.org Git - php/commitdiff
- MFH
authorPierre Joye <pajoye@php.net>
Wed, 2 Jul 2003 10:38:09 +0000 (10:38 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 2 Jul 2003 10:38:09 +0000 (10:38 +0000)
pear/Console/Getopt.php
pear/Makefile.frag
pear/PEAR/Command/Package.php
pear/PEAR/Command/Remote.php
pear/PEAR/Config.php
pear/PEAR/Frontend/CLI.php
pear/install-pear.php
pear/package-Archive_Tar.xml
pear/package.dtd
pear/scripts/pear.bat
pear/scripts/pearcmd.php

index 1f98a1c08382c6b4c3828ed49facbfb210c046b9..9bc48c14801d5c27209cc4115fb394f5f259543b 100644 (file)
@@ -183,7 +183,7 @@ class Console_Getopt {
                 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");
                     }
                 }
index 022e80d747ff3708ac3cc0273c661b8917cbbd57..6fbba54dfbc90fb48d5c0be4165cd9954121cd18 100644 (file)
@@ -6,10 +6,10 @@ peardir=$(PEAR_INSTALLDIR)
 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)/"
index 986c6c7dab0854a0f2ecb163b893fa706d75ce26..54a44d6fc06f11e10533e6617c6ea58afe1f8572 100644 (file)
@@ -662,7 +662,7 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
         $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");
         }
index 9d23dc73910147fba09f5ae8dc7433a378073b45..45494874dbe5e08b8f4efe0224040a8a7a5aa9b5 100644 (file)
@@ -332,7 +332,7 @@ parameter.
         $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);
@@ -355,7 +355,7 @@ parameter.
             } 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');
index 82c36fad4a1d26217ff1217727a88d008909cb22..44d23e21177beb512c45f618041805714cd5bbc0 100644 (file)
@@ -26,6 +26,11 @@ require_once 'System.php';
  * @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
@@ -61,11 +66,11 @@ if (getenv('PHP_PEAR_HTTP_PROXY')) {
 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);
     }
 }
 
@@ -73,7 +78,7 @@ if (getenv('PHP_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);
@@ -89,7 +94,7 @@ if (getenv('PHP_PEAR_DOC_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
@@ -104,7 +109,7 @@ if (getenv('PHP_PEAR_DATA_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
@@ -112,7 +117,7 @@ if (getenv('PHP_PEAR_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
@@ -1004,6 +1009,7 @@ class PEAR_Config extends PEAR
     {
         if (isset($this->configuration[$layer])) {
             unset($this->configuration[$layer]);
+            $this->layers = array_keys($this->configuration);
             return true;
         }
         return false;
index 5213ea9c91e747afca2114f1bb54cef39a95316c..81326d27b42651286c7952c74dcc75e84dbd20ac 100644 (file)
@@ -449,6 +449,8 @@ class PEAR_Frontend_CLI extends PEAR
                                       1 => array('wrap' => 20),
                                       2 => array('wrap' => 35)
                         );
+                    } else {
+                        $opts = null;
                     }
                     if (isset($data['headline']) && is_array($data['headline'])) {
                         $this->_tableRow($data['headline'],
index c1a2d1341de511ef27a5ccbad2e31201f99d7fbb..c6d08703a06b7b659f97ecf87f961f91f9301e84 100644 (file)
@@ -1,41 +1,31 @@
 <?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++;
     }
 }
 
@@ -47,11 +37,29 @@ foreach ($config_layers as $layer) {
     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;
@@ -62,7 +70,7 @@ if (!empty($install_root)) {
 $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)) {
@@ -82,7 +90,7 @@ foreach ($install_files as $package => $instfile) {
             }
             $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)) {
@@ -106,4 +114,4 @@ foreach ($install_files as $package => $instfile) {
     }
 }
 
-?>
\ No newline at end of file
+?>
index 64ee07b5c8acfce82ce105ae1ae65cebdb7fa8cb..7d54a01739feee619c398463a565f4badda4a730 100644 (file)
@@ -6,7 +6,7 @@
   <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>
@@ -24,11 +24,12 @@ loaded.
     </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">
@@ -38,6 +39,30 @@ loaded.
     </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>
index 2515b738c2824628872bf41b28063d59dac1fef0..a570325899e0c51ff8be7f7dcbeac5ffe21edcd6 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-     $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:
index e749fd5514e52dd88dcc3f52211be7f78fda9f0b..0085b5338460d5810be416c578d49e6305020b93 100755 (executable)
@@ -5,10 +5,10 @@ REM PHP version 4.0
 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
@@ -16,7 +16,7 @@ REM ----------------------------------------------------------------------
 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
index 2cc2fbd8ae5ced5e9951428e18d9626825d6f014..678e77d61757bf2e167ef798d1bb5f6b5137abaa 100644 (file)
@@ -242,7 +242,10 @@ function cmdHelp($command)
         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)) {