svn: /pear/pear-core/trunk/ PEAR/Builder.php PEAR/Command/Package.php PEAR/Downloader.php PEAR/Installer.php PEAR/PackageFile.php System.php
| From: | Helgi Þormar Þorbjörnsson | Date: | Mon, 04 Jul 2011 19:49:14 +0000 |
| Subject: | svn: /pear/pear-core/trunk/ PEAR/Builder.php PEAR/Command/Package.php PEAR/Downloader.php PEAR/Installer.php PEAR/PackageFile.php System.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9931@lists.php.net to get a copy of this message | ||
dufuz Mon, 04 Jul 2011 19:49:14 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=312909
Log:
All System (the class) functions can now take in spaced paths as long as they are surrounded in
quotes. Prior to this it was possible to do that by passing all values in as an array (related to
#18362, #18440)
Fixed Bug #18362: A whitespace TEMP_DIR path breaks install/upgrade functionality [dufuz]
Fixed Bug #18440: bad tmp folder path on install : Unable to create path for C:/Program/tmp [dufuz]
Bugs: http://pear.php.net/bugs/18362 (unknown)
http://pear.php.net/bugs/18440 (unknown)
Changed paths:
U pear/pear-core/trunk/PEAR/Builder.php
U pear/pear-core/trunk/PEAR/Command/Package.php
U pear/pear-core/trunk/PEAR/Downloader.php
U pear/pear-core/trunk/PEAR/Installer.php
U pear/pear-core/trunk/PEAR/PackageFile.php
U pear/pear-core/trunk/System.php
Modified: pear/pear-core/trunk/PEAR/Builder.php
===================================================================
--- pear/pear-core/trunk/PEAR/Builder.php 2011-07-04 19:43:30 UTC (rev 312908)
+++ pear/pear-core/trunk/PEAR/Builder.php 2011-07-04 19:49:14 UTC (rev 312909)
@@ -85,6 +85,7 @@
return $pkg;
}
}
+
$dir = dirname($descfile);
$old_cwd = getcwd();
@@ -108,6 +109,7 @@
if (!file_exists("$dir/$dsp")) {
return $this->raiseError("The DSP $dsp does not exist.");
}
+
// XXX TODO: make release build type configurable
$command = 'msdev '.$dsp.' /MAKE "'.$pkg->getPackage(). '
- Release"';
@@ -152,6 +154,7 @@
} else {
return $this->raiseError("Could not retrieve output information from
$dsp.");
}
+
// realpath returns false if the file doesn't exist
if ($outfile && copy($outfile, "$dir/$out")) {
$outfile = "$dir/$out";
@@ -289,7 +292,7 @@
// Find config. outside of normal path - e.g. config.m4
foreach (array_keys($pkg->getInstallationFileList()) as $item) {
- if (stristr(basename($item), 'config.m4')) {
+ if (stristr(basename($item), 'config.m4') && dirname($item) !=
'.') {
$dir .= DIRECTORY_SEPARATOR . dirname($item);
break;
}
@@ -368,7 +371,7 @@
}
$tmpdir = $this->config->get('temp_dir');
- $build_basedir = System::mktemp(" -t $tmpdir -d pear-build-$user");
+ $build_basedir = System::mktemp(' -t "' . $tmpdir . '" -d
"pear-build-' . $user . '"');
$build_dir = "$build_basedir/$vdir";
$inst_dir = "$build_basedir/install-$vdir";
$this->log(1, "building in $build_dir");
@@ -397,6 +400,7 @@
if (!file_exists($build_dir) || !is_dir($build_dir) || !chdir($build_dir)) {
return $this->raiseError("could not chdir to $build_dir");
}
+
putenv('PHP_PEAR_VERSION=@PEAR-VER@');
foreach ($to_run as $cmd) {
$err = $this->_runCommand($cmd, $callback);
@@ -404,6 +408,7 @@
chdir($old_cwd);
return $err;
}
+
if (!$err) {
chdir($old_cwd);
return $this->raiseError("`$cmd' failed");
@@ -483,6 +488,7 @@
if (!$pp) {
return $this->raiseError("failed to run `$command'");
}
+
if ($callback && $callback[0]->debug == 1) {
$olddbg = $callback[0]->debug;
$callback[0]->debug = 2;
@@ -495,6 +501,7 @@
$this->log(2, rtrim($line));
}
}
+
if ($callback && isset($olddbg)) {
$callback[0]->debug = $olddbg;
}
@@ -509,8 +516,10 @@
if ($this->debug >= $level) {
call_user_func($this->current_callback, 'output', $msg);
}
+
return;
}
+
return PEAR_Common::log($level, $msg);
}
}
\ No newline at end of file
Modified: pear/pear-core/trunk/PEAR/Command/Package.php
===================================================================
--- pear/pear-core/trunk/PEAR/Command/Package.php 2011-07-04 19:43:30 UTC (rev 312908)
+++ pear/pear-core/trunk/PEAR/Command/Package.php 2011-07-04 19:49:14 UTC (rev 312909)
@@ -974,7 +974,7 @@
$tar = new Archive_Tar($params[0]);
$tmpdir = $this->config->get('temp_dir');
- $tmpdir = System::mktemp(" -t $tmpdir -d pearsign");
+ $tmpdir = System::mktemp(' -t "' . $tmpdir . '" -d
pearsign');
if (!$tar->extractList('package2.xml package.xml package.sig', $tmpdir)) {
return $this->raiseError("failed to extract tar file");
}
Modified: pear/pear-core/trunk/PEAR/Downloader.php
===================================================================
--- pear/pear-core/trunk/PEAR/Downloader.php 2011-07-04 19:43:30 UTC (rev 312908)
+++ pear/pear-core/trunk/PEAR/Downloader.php 2011-07-04 19:49:14 UTC (rev 312909)
@@ -190,7 +190,7 @@
}
$tmpdir = $this->config->get('temp_dir');
- $tmp = System::mktemp("-d -t $tmpdir");
+ $tmp = System::mktemp('-d -t "' . $tmpdir . '"');
$a = $this->downloadHttp('http://' . $channel .
'/channel.xml', $this->ui, $tmp, $callback, false);
PEAR::popErrorHandling();
if (PEAR::isError($a)) {
Modified: pear/pear-core/trunk/PEAR/Installer.php
===================================================================
--- pear/pear-core/trunk/PEAR/Installer.php 2011-07-04 19:43:30 UTC (rev 312908)
+++ pear/pear-core/trunk/PEAR/Installer.php 2011-07-04 19:49:14 UTC (rev 312909)
@@ -1104,7 +1104,7 @@
if (realpath($descfile) != realpath($pkgfile)) {
// Use the temp_dir since $descfile can contain the download dir path
$tmpdir = $this->config->get('temp_dir', null,
'pear.php.net');
- $tmpdir = System::mktemp("-d -t $tmpdir");
+ $tmpdir = System::mktemp('-d -t "' . $tmpdir . '"');
$tar = new Archive_Tar($pkgfile);
if (!$tar->extract($tmpdir)) {
Modified: pear/pear-core/trunk/PEAR/PackageFile.php
===================================================================
--- pear/pear-core/trunk/PEAR/PackageFile.php 2011-07-04 19:43:30 UTC (rev 312908)
+++ pear/pear-core/trunk/PEAR/PackageFile.php 2011-07-04 19:49:14 UTC (rev 312909)
@@ -351,7 +351,7 @@
}
}
- $tmpdir = System::mktemp('-t ' . $this->_config->get('temp_dir')
. ' -d pear');
+ $tmpdir = System::mktemp('-t "' .
$this->_config->get('temp_dir') . '" -d pear');
if ($tmpdir === false) {
$ret = PEAR::raiseError("there was a problem with getting the configured temp
directory");
return $ret;
Modified: pear/pear-core/trunk/System.php
===================================================================
--- pear/pear-core/trunk/System.php 2011-07-04 19:43:30 UTC (rev 312908)
+++ pear/pear-core/trunk/System.php 2011-07-04 19:49:14 UTC (rev 312909)
@@ -71,9 +71,18 @@
function _parseArgs($argv, $short_options, $long_options = null)
{
if (!is_array($argv) && $argv !== null) {
- $argv = preg_split('/\s+/', $argv, -1, PREG_SPLIT_NO_EMPTY);
+ // Find all items, quoted or otherwise
+ preg_match_all("/(?:[\"'])(.*?)(?:['\"])|([^\s]+)/",
$argv, $av);
+ $argv = $av[1];
+ foreach ($av[2] as $k => $a) {
+ if (empty($a)) {
+ continue;
+ }
+ $argv[$k] = trim($a) ;
+ }
}
- return Console_Getopt::getopt2($argv, $short_options);
+
+ return Console_Getopt::getopt2($argv, $short_options, $long_options);
}
/**