]> granicus.if.org Git - php/commitdiff
MFH for RC3
authorTomas V.V.Cox <cox@php.net>
Wed, 6 Aug 2003 01:58:30 +0000 (01:58 +0000)
committerTomas V.V.Cox <cox@php.net>
Wed, 6 Aug 2003 01:58:30 +0000 (01:58 +0000)
15 files changed:
pear/Makefile.frag
pear/PEAR.php
pear/PEAR/Command/Install.php
pear/PEAR/Command/Registry.php
pear/PEAR/Command/Remote.php
pear/PEAR/Common.php
pear/PEAR/Config.php
pear/PEAR/Dependency.php
pear/PEAR/Installer.php
pear/PEAR/Packager.php
pear/PEAR/Registry.php
pear/PEAR/Remote.php
pear/install-pear.php
pear/package-PEAR.xml
pear/scripts/pear.sh

index 6fbba54dfbc90fb48d5c0be4165cd9954121cd18..a74392b2d3719e4ea84976013a57b7ad7cff5356 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 -d "$(peardir)" $(srcdir)/package-*.xml
+       @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" -b "$(bindir)" $(srcdir)/package-*.xml
 
 install-pear-packages: $(top_builddir)/sapi/cli/php
-       @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" $(srcdir)/packages/*.tar
+       @$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) $(srcdir)/install-pear.php -d "$(peardir)" -b "$(bindir)" $(srcdir)/packages/*.tar
 
 install-pear:
        @echo "Installing PEAR environment:      $(INSTALL_ROOT)$(peardir)/"
index 5305537fb17c956b37d06ba036aac67e19b87b6d..ec98d5576f64fd1722829a497bc97a559ff9aff7 100644 (file)
@@ -769,7 +769,7 @@ class PEAR_Error
                       is_object($this->callback[0]) &&
                       is_string($this->callback[1]) &&
                       strlen($this->callback[1])) {
-                      @call_user_func($this->callback, $this);
+                      call_user_func($this->callback, $this);
             }
         }
         if (PEAR_ZE2 && $this->mode & PEAR_ERROR_EXCEPTION) {
index 8a3d48e8847186959c30b0e640ef58071d2ed9f3..8026a7bfb19151ee3b3456b269be5a990deedd56 100644 (file)
@@ -259,6 +259,7 @@ package if needed.
             $installed = array_flip($reg->listPackages());
             $params = array();
             foreach ($latest as $package => $info) {
+                $package = strtolower($package);
                 if (!isset($installed[$package])) {
                     // skip packages we don't have installed
                     continue;
@@ -269,7 +270,7 @@ package if needed.
                     continue;
                 }
                 $params[] = $package;
-                $this->ui->outputData("will upgrade $package", $command);
+                $this->ui->outputData(array('data' => "Will upgrade $package"), $command);
             }
         }
         foreach ($params as $pkg) {
@@ -334,7 +335,7 @@ package if needed.
             return $this->raiseError("Please supply the package you want to bundle");
         }
         $pkgfile = $params[0];
-
+        $need_download = false;
         if (preg_match('#^(http|ftp)://#', $pkgfile)) {
             $need_download = true;
         } elseif (!@is_file($pkgfile)) {
index 31ebd8b65353061020b1df1ebd34e96560cc3999..e07526a5a63f5b4bc0df0f7e299b8f5a0fd02956 100644 (file)
@@ -340,6 +340,7 @@ installed package.'
             $key = ucwords(trim(str_replace('_', ' ', $key)));
             $data['data'][] = array($key, $value);
         }
+        $data['raw'] = $info;
 
         $this->ui->outputData($data, 'package-info');
     }
index 45494874dbe5e08b8f4efe0224040a8a7a5aa9b5..205b3dd8b68d2d1a79eed474777049e2632f8b3f 100644 (file)
@@ -282,7 +282,8 @@ parameter.
         }
         $server = $this->config->get('master_server');
         if (!ereg('^http://', $params[0])) {
-            $pkgfile = "http://$server/get/$params[0]";
+            $getoption = isset($options['nocompress'])&&$options['nocompress']==1?'?uncompress=on':'';
+            $pkgfile = "http://$server/get/$params[0]".$getoption;
         } else {
             $pkgfile = $params[0];
         }
index 99db180d24c114d6359bb2a5970e79c608ebc4c1..81f88b66431bf16fe4215611f269dc540174800e 100644 (file)
@@ -156,7 +156,7 @@ class PEAR_Common extends PEAR
         $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
         while ($file = array_shift($tempfiles)) {
             if (@is_dir($file)) {
-                System::rm("-rf $file");
+                System::rm(array('-rf', $file));
             } elseif (file_exists($file)) {
                 unlink($file);
             }
@@ -198,7 +198,7 @@ class PEAR_Common extends PEAR
     function mkDirHier($dir)
     {
         $this->log(2, "+ create dir $dir");
-        return System::mkDir("-p $dir");
+        return System::mkDir(array('-p', $dir));
     }
 
     // }}}
@@ -242,11 +242,12 @@ class PEAR_Common extends PEAR
     function mkTempDir($tmpdir = '')
     {
         if ($tmpdir) {
-            $topt = "-t $tmpdir ";
+            $topt = array('-t', $tmpdir);
         } else {
-            $topt = '';
+            $topt = array();
         }
-        if (!$tmpdir = System::mktemp($topt . '-d pear')) {
+        $topt = array_merge($topt, array('-d', 'pear'));
+        if (!$tmpdir = System::mktemp($topt)) {
             return false;
         }
         $this->addTempFile($tmpdir);
@@ -567,7 +568,11 @@ class PEAR_Common extends PEAR
                 }
                 break;
             case 'license':
-                $this->pkginfo['release_license'] = $data;
+                if ($this->in_changelog) {
+                    $this->current_release['release_license'] = $data;
+                } else {
+                    $this->pkginfo['release_license'] = $data;
+                }
                 break;
             case 'dep':
                 if ($data && !$this->in_changelog) {
@@ -671,9 +676,17 @@ class PEAR_Common extends PEAR
             return $this->raiseError("could not open file \"$file\"");
         }
         $tar = new Archive_Tar($file);
+        if ($this->debug <= 1) {
+            $tar->pushErrorHandling(PEAR_ERROR_RETURN);
+        }
         $content = $tar->listContent();
+        if ($this->debug <= 1) {
+            $tar->popErrorHandling();
+        }
         if (!is_array($content)) {
-            return $this->raiseError("could not get contents of package \"$file\"");
+            $file = realpath($file);
+            return $this->raiseError("Could not get contents of package \"$file\"".
+                                     '. Invalid tgz file.');
         }
         $xml = null;
         foreach ($content as $file) {
@@ -688,7 +701,7 @@ class PEAR_Common extends PEAR
         }
         $tmpdir = System::mkTemp('-d pear');
         $this->addTempFile($tmpdir);
-        if (!$xml || !$tar->extractList($xml, $tmpdir)) {
+        if (!$xml || !$tar->extractList(array($xml), $tmpdir)) {
             return $this->raiseError('could not extract the package.xml file');
         }
         return $this->infoFromDescriptionFile("$tmpdir/$xml");
@@ -1099,6 +1112,7 @@ class PEAR_Common extends PEAR
                 if (empty($c['prompt'])) {
                     $errors[] = "configure option $i: missing prompt";
                 }
+                $i++;
             }
         }
         if (empty($info['filelist'])) {
@@ -1155,7 +1169,7 @@ class PEAR_Common extends PEAR
      * Build a "provides" array from data returned by
      * analyzeSourceCode().  The format of the built array is like
      * this:
-     * 
+     *
      *  array(
      *    'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
      *    ...
@@ -1168,7 +1182,7 @@ class PEAR_Common extends PEAR
      * @return void
      *
      * @access public
-     * 
+     *
      */
     function buildProvidesArray($srcinfo)
     {
@@ -1597,7 +1611,7 @@ class PEAR_Common extends PEAR
                                                                   $errno, $errstr));
                 }
                 return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
-            }            
+            }
             $request = "GET $path HTTP/1.0\r\n";
         }
         $request .= "Host: $host:$port\r\n".
index fb12ded5f61191f6a20a12c5631e9abae9e28bf2..a4f51400fdc04c1302b4312614377a7f0fd55b05 100644 (file)
@@ -577,7 +577,8 @@ class PEAR_Config extends PEAR
         }
         $data = ($data === null) ? $this->configuration[$layer] : $data;
         $this->_encodeOutput($data);
-        if (!@System::mkDir("-p " . dirname($file))) {
+        $opt = array('-p', dirname($file));
+        if (!@System::mkDir($opt)) {
             return $this->raiseError("could not create directory: " . dirname($file));
         }
         if (@is_file($file) && !@is_writeable($file)) {
index c4c27605043107e984f58dd3cdb8b782ebdde7f5..37afd71a368c88db3a2b4580aa9af30e4ba3add3 100644 (file)
@@ -139,6 +139,7 @@ class PEAR_Dependency
                     $errmsg = "requires package `$name' " .
                         $this->signOperator($relation) . " $req";
                     $code = $this->codeFromRelation($relation, $version, $req);
+                    return PEAR_DEPENDENCY_MISSING;
                 }
                 return false;
         }
index 9f95e25aa6794d05c034707c0ec370cc4d0618bd..416fab9991b2cef3ae14c86fa34345ef0c0c7f6d 100644 (file)
@@ -715,11 +715,12 @@ class PEAR_Installer extends PEAR_Common
                     $this->rollbackFileTransaction();
                     return $built;
                 }
+                $this->log(1, "\nBuild process completed successfully");
                 foreach ($built as $ext) {
                     $bn = basename($ext['file']);
-                    $this->log(2, "installing $bn");
                     $dest = $this->config->get('ext_dir') . DIRECTORY_SEPARATOR . $bn;
-                    $this->log(3, "+ cp $ext[file] ext_dir");
+                    $this->log(1, "Installing '$bn' at ext_dir ($dest)");
+                    $this->log(3, "+ cp $ext[file] ext_dir ($dest)");
                     $copyto = $this->_prependPath($dest, $this->installroot);
                     if (!@copy($ext['file'], $copyto)) {
                         $this->rollbackFileTransaction();
index 58e550992c3c11889457b1621175abb7f85d6a72..1bf1b76436dc1990a6faa91b76b760063f9e457f 100644 (file)
@@ -116,7 +116,7 @@ class PEAR_Packager extends PEAR_Common
             chdir($oldcwd);
             return $this->raiseError($new_xml);
         }
-        if (!($tmpdir = System::mktemp('-t '.getcwd().' -d'))) {
+        if (!($tmpdir = System::mktemp(array('-t', getcwd(), '-d')))) {
             chdir($oldcwd);
             return $this->raiseError("PEAR_Packager: mktemp failed");
         }
@@ -135,7 +135,7 @@ class PEAR_Packager extends PEAR_Common
         $tar =& new Archive_Tar($dest_package, $compress);
         $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
         // ----- Creates with the package.xml file
-        $ok = $tar->createModify($newpkgfile, '', $tmpdir);
+        $ok = $tar->createModify(array($newpkgfile), '', $tmpdir);
         if (PEAR::isError($ok)) {
             chdir($oldcwd);
             return $this->raiseError($ok);
index a93713f1846ebac25c5d5f8cf5acc0c3daaa8ac5..96ac23087f6dfe52a815b03b1d3bbd92440f85e9 100644 (file)
@@ -146,7 +146,7 @@ class PEAR_Registry extends PEAR
     function _assertStateDir()
     {
         if (!@is_dir($this->statedir)) {
-            if (!System::mkdir("-p {$this->statedir}")) {
+            if (!System::mkdir(array('-p', $this->statedir))) {
                 return $this->raiseError("could not create directory '{$this->statedir}'");
             }
         }
index b7e34911e3b9f055f54c96aa87ddb3165ddbbaac..eca2c384098db6eeae778952f36483c94606be70 100644 (file)
@@ -50,21 +50,18 @@ class PEAR_Remote extends PEAR
 
     // {{{ getCache()
 
-    
+
     function getCache($args)
     {
         $id       = md5(serialize($args));
         $cachedir = $this->config->get('cache_dir');
-        if (!file_exists($cachedir)) {
-            System::mkdir('-p '.$cachedir);
-        }
         $filename = $cachedir . DIRECTORY_SEPARATOR . 'xmlrpc_cache_' . $id;
         if (!file_exists($filename)) {
             return null;
         };
-               
-        $fp = fopen($filename, "rb");
-        if ($fp === null) {
+
+        $fp = fopen($filename, 'rb');
+        if (!$fp) {
             return null;
         }
         $content  = fread($fp, filesize($filename));
@@ -78,7 +75,7 @@ class PEAR_Remote extends PEAR
     }
 
     // }}}
-    
+
     // {{{ saveCache()
 
     function saveCache($args, $data)
@@ -86,32 +83,32 @@ class PEAR_Remote extends PEAR
         $id       = md5(serialize($args));
         $cachedir = $this->config->get('cache_dir');
         if (!file_exists($cachedir)) {
-            System::mkdir('-p '.$cachedir);
+            System::mkdir(array('-p', $cachedir));
         }
         $filename = $cachedir.'/xmlrpc_cache_'.$id;
-        
+
         $fp = @fopen($filename, "wb");
-        if ($fp !== null) {
+        if ($fp) {
             fwrite($fp, serialize($data));
             fclose($fp);
         };
     }
 
     // }}}
-    
+
     // {{{ call(method, [args...])
 
     function call($method)
     {
         $_args = $args = func_get_args();
-        
+
         $this->cache = $this->getCache($args);
         $cachettl = $this->config->get('cache_ttl');
         // If cache is newer than $cachettl seconds, we use the cache!
         if ($this->cache !== null && $this->cache['age'] < $cachettl) {
             return $this->cache['content'];
         };
-        
+
         if (extension_loaded("xmlrpc")) {
             $result = call_user_func_array(array(&$this, 'call_epi'), $args);
             if (!PEAR::isError($result)) {
@@ -140,7 +137,7 @@ class PEAR_Remote extends PEAR
             $proxy_port = @$proxy['port'];
             $proxy_user = @$proxy['user'];
             $proxy_pass = @$proxy['pass'];
-        }        
+        }
         $c = new XML_RPC_Client('/xmlrpc.php'.$maxAge, $server_host, 80, $proxy_host, $proxy_port, $proxy_user, $proxy_pass);
         if ($username && $password) {
             $c->setCredentials($username, $password);
@@ -204,8 +201,20 @@ class PEAR_Remote extends PEAR
             return $this->raiseError("PEAR_Remote::call: no master_server configured");
         }
         $server_port = 80;
-        $fp = @fsockopen($server_host, $server_port);
-        if (!$fp) {
+        if ($http_proxy = $this->config->get('http_proxy')) {
+            $proxy = parse_url($http_proxy);
+            $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
+            $proxy_host = @$proxy['host'];
+            $proxy_port = @$proxy['port'];
+            $proxy_user = @$proxy['user'];
+            $proxy_pass = @$proxy['pass'];
+            $fp = @fsockopen($proxy_host, $proxy_port);
+        } else {
+            $fp = @fsockopen($server_host, $server_port);
+        }
+        if (!$fp && $http_proxy) {
+            return $this->raiseError("PEAR_Remote::call: fsockopen(`$proxy_host', $proxy_port) failed");
+        } elseif (!$fp) {
             return $this->raiseError("PEAR_Remote::call: fsockopen(`$server_host', $server_port) failed");
         }
         $len = strlen($request);
@@ -224,15 +233,30 @@ class PEAR_Remote extends PEAR
         } else {
             $maxAge = '';
         };
-        
+
+        if ($proxy_host != '' && $proxy_user != '') {
+            $req_headers .= 'Proxy-Authorization: Basic '
+                .base64_encode($proxy_user.':'.$proxy_pass)
+                ."\r\n";
+        }
+
         if ($this->config->get('verbose') > 3) {
             print "XMLRPC REQUEST HEADERS:\n";
             var_dump($req_headers);
             print "XMLRPC REQUEST BODY:\n";
             var_dump($request);
         }
-        
-        fwrite($fp, ("POST /xmlrpc.php$maxAge HTTP/1.0\r\n$req_headers\r\n$request"));
+
+        if ($proxy_host != '') {
+            $post_string = "POST http://".$server_host;
+            if ($proxy_port > '') {
+                $post_string .= ':'.$server_port;
+            }
+        } else {
+            $post_string = "POST ";
+        }
+
+        fwrite($fp, ($post_string."/xmlrpc.php$maxAge HTTP/1.0\r\n$req_headers\r\n$request"));
         $response = '';
         $line1 = fgets($fp, 2048);
         if (!preg_match('!^HTTP/[0-9\.]+ (\d+) (.*)!', $line1, $matches)) {
index 1dd72d3a26447d86877c74e74d3639670503c7b8..24b3d9a51bf671a4e44761e5cda98c7390a4e9cc 100644 (file)
@@ -23,6 +23,9 @@ for ($i = 0; $i < sizeof($argv); $i++) {
     } elseif ($arg == '-d') {
         $with_dir = $argv[$i+1];
         $i++;
+    } elseif ($arg == '-b') {
+        $bin_dir = $argv[$i+1];
+        $i++;
     }
 }
 
@@ -36,11 +39,14 @@ foreach ($config_layers as $layer) {
 }
 $keys = $config->getKeys();
 $config->set('verbose', 0, 'default');
+// PEAR executables
+if (!empty($bin_dir)) {
+    $config->set('bin_dir', $bin_dir, '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');
@@ -115,13 +121,17 @@ foreach ($install_files as $package => $instfile) {
                             'a previous PEAR installation at ' .
                             "'$ufile'. You may probably want to remove it.");
         }
-        $ui->outputData('Writing PEAR system config file at: ' . $config->files['system']);
-        $ui->outputData('You may want to add: ' . $config->get('php_dir') . ' to your php.ini include_path');
         $config->set('verbose', 1, 'default');
         foreach ($config->getKeys() as $key) {
             $data[$key] = $config->get($key);
         }
-        $config->store('system', $data);
+        $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');
     }
 }
 ?>
index f88fc848eb845b20901cd71efab46fe992efbe18..debdd6c9ba56b47ab4980b83532b146bcd836cdf 100644 (file)
     </maintainer>
   </maintainers>
   <release>
-    <version>1.2b3</version>
+    <version>1.2b5</version>
     <state>beta</state>
-    <date>2003-07-08</date>
+    <date>2003-08-05</date>
     <notes>
 * Changed license from PHP 2.02 to 3.0
 * Added support for optional dependencies
 * Made upgrade and uninstall package case insensitive
 * pear makerpm, now works and generates a better system independant spec file
-* pear install|build &lt;pecl-package&gt;, now exposes the compilation progress
+* pear install|build pecl-package, now exposes the compilation progress
 * Installer now checks dependencies on package uninstall
-* Added new pear bundle command, which downloads and uncompress a &lt;pecl-package&gt;.
+* Added proxy support for remote commands using the xmlrcp C ext (Adam Ashley)
+* Added the command "download-all" (Alex Merz)
+* Made package dependency checking back to work
+* Added support for spaces in path names (Greg)
+* Various bugfixes
+* Added new pear "bundle" command, which downloads and uncompress a PECL package.
 The main purpouse of this command is for easily adding extensions to the PHP sources
 before compiling it.
     </notes>
@@ -71,6 +76,7 @@ before compiling it.
           <file role="php" name="Package.php"/>
           <file role="php" name="Registry.php"/>
           <file role="php" name="Remote.php"/>
+          <file role="php" name="Mirror.php"/>
         </dir>
         <file role="php" name="Common.php"/>
         <file role="php" name="Config.php"/>
index dad083833894fc7c82793373303783a1cc209bba..6253b9014c589372b411fc769c379cfb573ff684 100644 (file)
@@ -25,4 +25,4 @@ else
   fi
 fi
 
-exec $PHP -C -q $INCARG -d output_buffering=1 $INCDIR/pearcmd.php $@
+exec $PHP -C -q $INCARG -d output_buffering=1 $INCDIR/pearcmd.php "$@"