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)/"
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) {
$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;
continue;
}
$params[] = $package;
- $this->ui->outputData("will upgrade $package", $command);
+ $this->ui->outputData(array('data' => "Will upgrade $package"), $command);
}
}
foreach ($params as $pkg) {
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)) {
$key = ucwords(trim(str_replace('_', ' ', $key)));
$data['data'][] = array($key, $value);
}
+ $data['raw'] = $info;
$this->ui->outputData($data, 'package-info');
}
}
$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];
}
$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);
}
function mkDirHier($dir)
{
$this->log(2, "+ create dir $dir");
- return System::mkDir("-p $dir");
+ return System::mkDir(array('-p', $dir));
}
// }}}
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);
}
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) {
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) {
}
$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");
if (empty($c['prompt'])) {
$errors[] = "configure option $i: missing prompt";
}
+ $i++;
}
}
if (empty($info['filelist'])) {
* 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'),
* ...
* @return void
*
* @access public
- *
+ *
*/
function buildProvidesArray($srcinfo)
{
$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".
}
$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)) {
$errmsg = "requires package `$name' " .
$this->signOperator($relation) . " $req";
$code = $this->codeFromRelation($relation, $version, $req);
+ return PEAR_DEPENDENCY_MISSING;
}
return false;
}
$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();
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");
}
$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);
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}'");
}
}
// {{{ 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));
}
// }}}
-
+
// {{{ saveCache()
function saveCache($args, $data)
$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)) {
$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);
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);
} 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)) {
} elseif ($arg == '-d') {
$with_dir = $argv[$i+1];
$i++;
+ } elseif ($arg == '-b') {
+ $bin_dir = $argv[$i+1];
+ $i++;
}
}
}
$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');
'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');
}
}
?>
</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 <pecl-package>, 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 <pecl-package>.
+* 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>
<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"/>
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 "$@"