com web/rmtools: prepared to copy the ext binaries built: client/bin/pecl.bat client/include/PeclBuildVC.php client/include/PeclExt.php
client/script/pecl.php
| From: | Stephen A. Zarkos | Date: | Fri, 30 Aug 2013 15:12:51 +0000 |
| Subject: | com web/rmtools: prepared to copy the ext binaries built: client/bin/pecl.bat client/include/PeclBuildVC.php client/include/PeclExt.php client/script/pecl.php |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-16728@lists.php.net to get a copy of this message | ||
Commit: 789ed34cbef5e3a9e0952f829ed17c2c33d0488e
Author: Anatol Belski <ab@php.net> Fri, 30 Aug 2013 17:12:51 +0200
Parents: ce71cbbb22052269a88205f74dba709aad30e24d
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=789ed34cbef5e3a9e0952f829ed17c2c33d0488e
Log:
prepared to copy the ext binaries built
Changed paths:
M client/bin/pecl.bat
M client/include/PeclBuildVC.php
M client/include/PeclExt.php
M client/script/pecl.php
Diff:
diff --git a/client/bin/pecl.bat b/client/bin/pecl.bat
index bd6865b..12bb6e6 100644
--- a/client/bin/pecl.bat
+++ b/client/bin/pecl.bat
@@ -86,3 +86,4 @@ del c:\php-sdk\locks\pecl.lock >> %LOG_FILE% 2<&1
:EXIT_LOCKED
echo .
+
diff --git a/client/include/PeclBuildVC.php b/client/include/PeclBuildVC.php
index 78cc337..e4e670b 100644
--- a/client/include/PeclBuildVC.php
+++ b/client/include/PeclBuildVC.php
@@ -216,4 +216,9 @@ class PeclBuildVC {
{
}
+
+ function getObjDir()
+ {
+ return $this->obj_dir;
+ }
}
diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php
index e9ed08a..3a52520 100644
--- a/client/include/PeclExt.php
+++ b/client/include/PeclExt.php
@@ -13,6 +13,10 @@ class PeclExt
protected $build;
protected $tar_cmd = 'c:\apps\git\bin\tar.exe';
protected $gzip_cmd = 'c:\apps\git\bin\gzip.exe';
+ protected $zip_cmd = 'c:\php-sdk\bin\zip.exe';
+ protected $tmp_extract = NULL;
+ protected $tmp_package_xml = NULL;
+ protected $ext_dir_in_src_path = NULL;
public function __construct($tgz_path, $build)
{
@@ -48,14 +52,13 @@ class PeclExt
public function unpack()
{
- $tmp_path = TMP_DIR . '/' . $this->getPackageName();
+ $tmp_path = TMP_DIR . '/' . $this->getPackageName() . '-unpack';
if (!file_exists($tmp_path) && !mkdir($tmp_path)) {
throw new \Exception("Couldn't create temporary dir");
}
-
$tmp_name = $tmp_path . '/' . basename($this->tgz_path);
- if (!rename($this->tgz_path, $tmp_name)) {
+ if (!copy($this->tgz_path, $tmp_name)) {
throw new \Exception("Couldn't move the tarball to '$tmp_name'");
}
@@ -82,26 +85,65 @@ class PeclExt
chdir($old_cwd);
- $ret = realpath($tmp_path . '/' . basename($this->tgz_path, '.tgz'));
+ $this->tmp_extract = realpath($tmp_path . '/' . basename($this->tgz_path,
'.tgz'));
+
+ if (file_exists($tmp_path . DIRECTORY_SEPARATOR . 'package.xml')) {
+ $this->tmp_package_xml = $tmp_path . DIRECTORY_SEPARATOR . 'package.xml';
+ }
$this->tgz_path = NULL;
- return $ret;
+ return $this->tmp_extract;
}
public function putSourcesIntoBranch()
{
- $tmp_path = $this->unpack();
+ if (!$this->tmp_extract) {
+ $this->tmp_extract = $this->unpack();
+ }
$ext_dir = $this->build->getSourceDir() . DIRECTORY_SEPARATOR . 'ext';
- $this_ext_dir_path = $ext_dir . DIRECTORY_SEPARATOR . $this->name;
- $res = copy_r($tmp_path, $this_ext_dir_path);
+ $this->ext_dir_in_src_path = $ext_dir . DIRECTORY_SEPARATOR . $this->name;
+ $res = copy_r($this->tmp_extract, $this->ext_dir_in_src_path);
if (!$res) {
- throw new \Exception("Failed to copy to '$this_ext_dir_path'");
+ throw new \Exception("Failed to copy to '{$this->ext_dir_in_src_path}'");
}
- rmdir_rf($tmp_path);
- return $this_ext_dir_path;
+ return $this->ext_dir_in_src_path;
+ }
+
+ public function getConfigureLine()
+ {
+ /* XXX check if it's enable or with,
+ what deps it has
+ what additional options it has
+ what non core exts it deps on
+ */
+
+ $ret = '';
+
+ $ret = ' "--enable-' . $this->name . '=shared" ';
+
+
+ return $ret;
+ }
+
+ public function preparePackage()
+ {
+ /* XXX check if there are any dep dll/pdb to put together */
+ $sub = $this->build->thread_safe ? 'Release_TS' : 'Release';
+ $base = $this->build->getObjDir() . DIRECTORY_SEPARATOR . $sub;
+ $target = TMP_DIR . DIRECTORY_SEPARATOR . $this->getPackageName();
+
+ $dll_name = 'php_' . $this->name . '.dll';
+ if (!copy($base . DIRECTORY_SEPARATOR . $dll_name, $target . DIRECTORY_SEPARATOR . $dll_name)) {
+ throw new \Exception("Couldn't copy '$dll_name' into
'$target'");
+ }
+
+ $pdb_name = 'php_' . $this->name . '.pdb';
+ if (!copy($base . DIRECTORY_SEPARATOR . $pdb_name, $target . DIRECTORY_SEPARATOR . $pdb_name)) {
+ throw new \Exception("Couldn't copy '$pdb_name' into
'$target'");
+ }
}
public function __call($name, $args)
@@ -117,4 +159,29 @@ class PeclExt
throw new \Exception("Unknown dynamic method called");
}
+
+ public function cleanup()
+ {
+ if ($this->tmp_extract) {
+ rmdir_rf(dirname($this->tmp_extract));
+ }
+ /*if ($this->tmp_package_xml) {
+ unlink($this->tmp_package_xml);
+ }*/
+ if ($this->ext_dir_in_src_path) {
+ rmdir_rf($this->ext_dir_in_src_path);
+ }
+ }
+
+ public function check()
+ {
+ if (!$this->tmp_extract) {
+ throw new \Exception("Tarball isn't yet extracted");
+ }
+
+ if (!file_exists($this->tmp_extract . DIRECTORY_SEPARATOR . 'config.w32')) {
+ throw new \Exception("config.w32 not found");
+ }
+ }
}
+
diff --git a/client/script/pecl.php b/client/script/pecl.php
index 98e775e..4124b9c 100644
--- a/client/script/pecl.php
+++ b/client/script/pecl.php
@@ -32,7 +32,6 @@ if (!is_dir($build_dir_parent)) {
$builds = $branch->getBuildList('windows');
-$has_build_errors = false;
$build_errors = array();
/* Each windows configuration from the ini for the given PHP version will be built */
@@ -67,37 +66,59 @@ foreach ($builds as $build_name) {
try {
$build->setSourceDir($build_src_path);
- $ext->putSourcesIntoBranch();exit();
+
+ $ext->unpack();
+ $ext->check();
+ $ext->putSourcesIntoBranch();
+
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ $ext->cleanup();
+ exit(3);
+ }
+
+ try {
$build->buildconf();
if ($branch->config->getPGO() == 1) {
echo "Creating PGI build\n";
- $build->configure(' "--enable-pgi" ');
+ $build->configure(' "--enable-pgi" ' . $ext->getConfigureLine());
}
else {
- $build->configure();
+ $build->configure($ext->getConfigureLine());
}
$build->make();
$html_make_log = $build->getMakeLogParsed();
- //$build->makeArchive();
} catch (Exception $e) {
echo $e->getMessage() . "\n";
echo $build->log_buildconf;
}
- continue;
/* PGO stuff would come here */
- /*$stats = $build->getStats();
+ $log_base = $toupload_dir . '/logs';
+ file_put_contents($log_base . '/buildconf-' . $ext->getPackageName() .
'.txt', $build->log_buildconf);
+ file_put_contents($log_base . '/configure-' . $ext->getPackageName() .
'.txt', $build->log_configure);
+ file_put_contents($log_base . '/make-' . $ext->getPackageName() . '.txt',
$build->log_make);
+
+ $stats = $build->getStats();
if ($stats['error'] > 0) {
- $has_build_errors = true;
+ file_put_contents($log_base . '/error-' . $ext->getPackageName() . '.txt',
$build->compiler_log_parser->getErrors());
+ }
+
+ try {
+ $ext->preparePackage();
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
}
- rm\upload_build_result_ftp_curl($toupload_dir, $branch_name . '/r' . $last_rev);*/
+ /*rm\upload_build_result_ftp_curl($toupload_dir, $branch_name . '/r' . $last_rev);*/
+
$build->clean();
- //rmdir($build_src_path);
+ $ext->cleanup();
}
+
/*Upload the branch DB */
/*$try = 0;
do {