com web/rmtools: implemented lookup for known exts.ini: client/bin/pecl.bat client/include/PeclExt.php client/script/pecl.php

From: Date: Sat, 31 Aug 2013 10:24:28 +0000
Subject: com web/rmtools: implemented lookup for known exts.ini: client/bin/pecl.bat client/include/PeclExt.php client/script/pecl.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-16722@lists.php.net to get a copy of this message
Commit: 4003ad8613696dbe5ff073ee0ae603d7b0099277 Author: Anatol Belski <ab@php.net> Sat, 31 Aug 2013 12:24:28 +0200 Parents: 90d42806557bd13b25801608f7198c02e98c40d9 Branches: master Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=4003ad8613696dbe5ff073ee0ae603d7b0099277 Log: implemented lookup for known exts.ini Changed paths: M client/bin/pecl.bat M client/include/PeclExt.php M client/script/pecl.php Diff: diff --git a/client/bin/pecl.bat b/client/bin/pecl.bat index 12bb6e6..0a26f0c 100644 --- a/client/bin/pecl.bat +++ b/client/bin/pecl.bat @@ -74,7 +74,7 @@ SET VC11_X64_SHELL=%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio REM Run pecl.php SET BISON_SIMPLE=c:\php-sdk\bin\bison.simple rem XXX iterate the c:\pecl_in_pkg here and delete the packages after successful build -c:\php-sdk\php\php.exe %BAT_DIR%\..\script\pecl.php pecl55_x64 C:\pecl_in_pkg\dio-0.0.7.tgz +c:\php-sdk\php\php.exe %BAT_DIR%\..\script\pecl.php pecl55_x64 C:\pecl_in_pkg\amqp-1.2.0.tgz rem c:\php-sdk\php\php.exe %BAT_DIR%\..\script\pecl.php pecl55_x86 C:\pecl_in_pkg\dio-0.0.7.tgz rem c:\php-sdk\php\php.exe %BAT_DIR%\..\script\pecl.php pecl54 C:\pecl_in_pkg\dio-0.0.7.tgz rem c:\php-sdk\php\php.exe %BAT_DIR%\..\script\pecl.php pecl53 C:\pecl_in_pkg\dio-0.0.7.tgz diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php index e44b044..cd86ba0 100644 --- a/client/include/PeclExt.php +++ b/client/include/PeclExt.php @@ -118,6 +118,70 @@ class PeclExt return $this->ext_dir_in_src_path; } + protected function buildConfigureLine(array $data) + { + $ret = ''; + + if (!isset($data['type']) + || !in_array($data['type'], array('with', 'enable'))) { + throw new \Exception("Unknown extention configure type, expected enable/with"); + } + + $ret = ' "--' . $data['type'] . '-' . $this->name . '=shared" '; + + if (isset($data['libs']) && $data['libs']) { + $data['libs'] = !is_array($data['libs']) ? array($data['libs']) : $data['libs']; + $deps_path = $this->build->branch->config->getPeclDepsBase(); + $extra_lib = $extra_inc = array(); + + foreach($data['libs'] as $lib) { + if (!$lib) { + continue; + } + + $lib_path = $deps_path . DIRECTORY_SEPARATOR . $lib; + + $some_lib_path = $lib_path . DIRECTORY_SEPARATOR . 'lib'; + if (!file_exists($some_lib_path)) { + throw new \Exception("Path '$some_lib_path' doesn't exist"); + } + $extra_lib[] = $some_lib_path; + + /* Many libs put headers into include and include/somelib, so lets cover both */ + $some_lib_inc_path = $lib_path . DIRECTORY_SEPARATOR . 'include'; + if (!file_exists($some_lib_inc_path)) { + throw new \Exception("Path '$some_lib_inc_path' doesn't exist"); + } + + $extra_inc[] = $some_lib_inc_path; + if (file_exists($some_lib_inc_path . DIRECTORY_SEPARATOR . $lib)) { + $extra_inc[] = $some_lib_inc_path . DIRECTORY_SEPARATOR . $lib; + } + } + + if (!empty($extra_lib)) { + $ret .= ' "--with-extra-libs=' . implode(';', $extra_lib) . '" ' + . ' "--with-extra-includes=' . implode(';', $extra_inc) . '" '; + } + } + + if (isset($data['opts']) && $data['opts']) { + $data['opts'] = !is_array($data['opts']) ? array($data['opts']) : $data['opts']; + foreach($data['opts'] as $opt) { + if ($opt) { + /* XXX simple check for opt syntax */ + $ret .= ' "' . $opt . '" '; + } + } + } + + if (isset($data['exts']) && $data['exts']) { + /* TODO */ + } + + return $ret; + } + public function getConfigureLine() { /* XXX check if it's enable or with, @@ -126,12 +190,21 @@ class PeclExt what non core exts it deps on */ - $ret = ''; + $config = NULL; - $ret = ' "--enable-' . $this->name . '=shared" '; + /* First look if it's on the known ext list */ + $known_path = __DIR__ . '/../data/config/pecl/exts.ini'; + $exts = parse_ini_file($known_path, true, INI_SCANNER_RAW); + foreach ($exts as $name => $conf) { + if ($name === $this->name) { + $config = $conf; + } + } + + + return $this->buildConfigureLine($config); - return $ret; } public function preparePackage() diff --git a/client/script/pecl.php b/client/script/pecl.php index f865620..9b8cfb2 100644 --- a/client/script/pecl.php +++ b/client/script/pecl.php @@ -32,8 +32,6 @@ if (!is_dir($build_dir_parent)) { $builds = $branch->getBuildList('windows'); -$build_errors = array(); - /* Each windows configuration from the ini for the given PHP version will be built */ foreach ($builds as $build_name) { @@ -46,14 +44,12 @@ foreach ($builds as $build_name) { $ext = new rm\PeclExt($ext_tgz, $build); } catch (Exception $e) { echo $e->getMessage() . "\n"; - exit(3); + continue; } // looks like php_http-2.0.0beta4-5.3-nts-vc9-x86 $ext_build_name = $ext->getPackageName(); - echo "Starting build for $ext_build_name\n"; - echo "running build in <$build_src_path>\n"; $toupload_dir = TMP_DIR . '/' . $ext_build_name; if (!is_dir($toupload_dir)) { @@ -64,6 +60,8 @@ foreach ($builds as $build_name) { mkdir($toupload_dir . '/logs', 0655, true); } + echo "Preparing to build '$ext_build_name'\n"; + try { $build->setSourceDir($build_src_path); @@ -73,27 +71,38 @@ foreach ($builds as $build_name) { } catch (Exception $e) { echo $e->getMessage() . "\n"; + $build->clean(); $ext->cleanup(); - exit(3); + /*rm\rmdir_rf($toupload_dir);*/ + + /* XXX mail the ext dev what the error was, if it's something in the check + phase like missing config.w32, it's interesting for sure. + and no sense to continue as something in ext setup went wrong */ + continue; } + echo "Running build in <$build_src_path>\n"; try { + $build->buildconf(); + + $ext_conf_line = $ext->getConfigureLine(); + echo "Extension specific config: $ext_conf_line\n"; if ($branch->config->getPGO() == 1) { echo "Creating PGI build\n"; - $build->configure(' "--enable-pgi" ' . $ext->getConfigureLine()); + $build->configure(' "--enable-pgi" ' . $ext_conf_line); } else { - $build->configure($ext->getConfigureLine()); + $build->configure($ext_conf_line); } $build->make(); - $html_make_log = $build->getMakeLogParsed(); + //$html_make_log = $build->getMakeLogParsed(); } catch (Exception $e) { echo $e->getMessage() . "\n"; echo $build->log_buildconf; } - /* PGO stuff would come here */ + /* XXX PGO stuff would come here */ $log_base = $toupload_dir . '/logs'; file_put_contents($log_base . '/buildconf-' . $ext->getPackageName() . '..txt', $build->log_buildconf); @@ -113,20 +122,12 @@ foreach ($builds as $build_name) { } /*rm\upload_build_result_ftp_curl($toupload_dir, $branch_name . '/r' . $last_rev);*/ - /* XXX mail the logs */ + /* XXX mail the logs from above */ - /* XXX remove $toupload_dir */ $build->clean(); $ext->cleanup(); + /*rm\rmdir_rf($toupload_dir);*/ } - -/*Upload the branch DB */ -/*$try = 0; -do { - $status = rm\upload_file_curl($branch->db_path, $branch_name .. '/' . basename($branch->db_path)); - $try++; -} while ( $status === false && $try < 10 );*/ - echo "Done.\n";

« previous php.webmaster (#16722) next »