com web/rmtools: fixed cleanup when the source was in the archive root: client/include/PeclExt.php client/script/pecl.php
| From: | Stephen A. Zarkos | Date: | Fri, 13 Sep 2013 12:19:24 +0000 |
| Subject: | com web/rmtools: fixed cleanup when the source was in the archive root: client/include/PeclExt.php client/script/pecl.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-16691@lists.php.net to get a copy of this message | ||
Commit: 635de6cbd5a5f21f5f446371ce567338c9dbb11c
Author: Anatol Belski <ab@php.net> Fri, 13 Sep 2013 14:19:24 +0200
Parents: 633b87d69ea1d3c48503f50ac4d0b7577b84ed15
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=635de6cbd5a5f21f5f446371ce567338c9dbb11c
Log:
fixed cleanup when the source was in the archive root
and some other minor things
Changed paths:
M client/include/PeclExt.php
M client/script/pecl.php
Diff:
diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php
index ce4d412..b369c14 100644
--- a/client/include/PeclExt.php
+++ b/client/include/PeclExt.php
@@ -110,7 +110,7 @@ class PeclExt
public function uncompressTgz()
{
- $tmp_path = tempnam(TMP_DIR, 'unpack');
+ $tmp_path = tempnam(TMP_DIR, 'pecl');
unlink($tmp_path);
if (!file_exists($tmp_path) && !mkdir($tmp_path)) {
throw new \Exception("Couldn't create temporary dir");
@@ -149,7 +149,7 @@ class PeclExt
public function uncompressZip()
{
- $tmp_path = tempnam(TMP_DIR, 'unpack');
+ $tmp_path = tempnam(TMP_DIR, 'pecl');
unlink($tmp_path);
if (!file_exists($tmp_path) && !mkdir($tmp_path)) {
throw new \Exception("Couldn't create temporary dir");
@@ -454,7 +454,11 @@ class PeclExt
public function cleanup($flag0 = false)
{
if ($this->tmp_extract_path) {
- rmdir_rf(dirname($this->tmp_extract_path));
+ $path = dirname($this->tmp_extract_path);
+ if (strtolower(realpath(TMP_DIR)) == strtolower(realpath($path))) {
+ $path = $this->tmp_extract_path;
+ }
+ rmdir_rf($path);
}
if ($this->ext_dir_in_src_path) {
@@ -538,7 +542,6 @@ class PeclExt
$msg .= "The package was uploaded to $url/" . $this->getPackageName() .
".zip\n";
} else {
$msg = "PECL Windows build failed\n\n";
-
}
$msg .= "For logs see $url/logs/" . $this->getPackageName() .
"-logs.zip\n";
@@ -612,7 +615,7 @@ class PeclExt
$ext = new PeclExt($pkg, $this->build);
if (strtolower($ext->getName()) == strtolower($name)
- && !isset($this->non_core_ext_deps[$ext->getName])
+ && !isset($this->non_core_ext_deps[$ext->getName()])
/* Avoid an ext having itself as dep */
&& strtolower($ext->getName()) != strtolower($this->name)) {
@@ -627,6 +630,7 @@ class PeclExt
}
}
+
return $this->non_core_ext_deps;
}
@@ -665,8 +669,9 @@ class PeclExt
protected function cleanupNonCoreExtDeps()
{
- foreach ($this->non_core_ext_deps as $ext) {
+ foreach ($this->non_core_ext_deps as $name => &$ext) {
$ext->cleanup();
+ unset($ext);
}
}
}
diff --git a/client/script/pecl.php b/client/script/pecl.php
index d565b5a..b871875 100644
--- a/client/script/pecl.php
+++ b/client/script/pecl.php
@@ -213,6 +213,9 @@ foreach ($builds as $build_name) {
$ext->cleanup($upload_success);
rm\rmdir_rf($toupload_dir);
+ unset($ext);
+ unset($build);
+
echo PHP_EOL;
$was_errors = $was_errors || $build_error > 0;