com web/rmtools: check for build dir existance: include/Branch.php
| From: | Anatol Belski | Date: | Thu, 17 Nov 2016 00:17:28 +0000 |
| Subject: | com web/rmtools: check for build dir existance: include/Branch.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-25907@lists.php.net to get a copy of this message | ||
Commit: 1f1a880827faf1eb3fd7f173d4a827f19a919f5c
Author: Anatol Belski <ab@php.net> Thu, 17 Nov 2016 01:17:28 +0100
Parents: 2258819ac5ba6d4e25506db1d74a9a769a47146b
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=1f1a880827faf1eb3fd7f173d4a827f19a919f5c
Log:
check for build dir existance
Changed paths:
M include/Branch.php
Diff:
diff --git a/include/Branch.php b/include/Branch.php
index 61d4064..307d55c 100644
--- a/include/Branch.php
+++ b/include/Branch.php
@@ -75,7 +75,11 @@ class Branch {
$rev_name = substr($this->data->revision_last, 0, 7);
}
$dir_name = $this->config->getName() . '-src-' . ($build_type ?
$build_type.'-' : $build_type) . 'r' . $rev_name;
- $target = $this->config->getBuildDir() . '/' . $dir_name;
+ $build_dir = $this->config->getBuildDir();
+ if (!file_exists($build_dir)) {
+ throw new \Exception("Directory '$build_dir' doesn't exist");
+ }
+ $target = $build_dir . '/' . $dir_name;
$exportfile = $this->repo->export($target);
if (preg_match('/\.zip$/', $exportfile) > 0) { // export function returned a .zip
file.
@@ -84,18 +88,18 @@ class Branch {
if ($zip && !$is_zip) {
$zip_path = $dir_name . '.zip';
$cmd = "zip -q -r $zip_path $dir_name";
- $res = exec_single_log($cmd, $this->config->getBuildDir());
+ $res = exec_single_log($cmd, $build_dir);
if (!$res) {
throw new \Exception("Export failed, svn exec failed to be ran");
}
}
elseif ($is_zip === true) {
- $cmd = 'unzip -q -o ' . $exportfile . ' -d ' ..
$this->config->getBuildDir();
+ $cmd = 'unzip -q -o ' . $exportfile . ' -d ' . $build_dir;
$res = exec_single_log($cmd);
if (!$res) {
throw new \Exception("Unzipping $exportfile failed.");
}
- $gitname = $this->config->getBuildDir() . '/php-src-' .
strtoupper($this->config->getName()) . '-' . $rev_name;
+ $gitname = $build_dir . '/php-src-' . strtoupper($this->config->getName()) .
'-' . $rev_name;
rename($gitname, $target);
}