Commit: e145c2b76cf4e57283e4b5b966f071d35c6abbdd Author: Anatol Belski <[email protected]> Thu, 16 Apr 2015 14:02:55 +0200 Parents: 8324f35f79b4f5132d5c430ac63f2a9e3b581466 Branches: master pecl_legacy
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=e145c2b76cf4e57283e4b5b966f071d35c6abbdd Log: basic implementation for adding composer.json to the bins Changed paths: M client/include/PeclExt.php Diff: diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php index 9d19140..f213bb8 100644 --- a/client/include/PeclExt.php +++ b/client/include/PeclExt.php @@ -24,10 +24,14 @@ class PeclExt protected $tmp_extract_path = NULL; protected $ext_dir_in_src_path = NULL; protected $package_xml = NULL; + protected $package_xml_path = NULL; protected $configure_data = NULL; protected $non_core_ext_deps = array(); protected $pkg_config = NULL; protected $lic_fnames = array(); + protected $pickle_phar = 'c:\apps\bin\pickle.phar'; + protected $composer_json = NULL; + protected $composer_json_path = NULL; public function __construct($pkg_path, $build) { @@ -297,19 +301,42 @@ class PeclExt $this->tmp_extract_path = realpath($tmp_path); } - $package_xml_path = NULL; if (file_exists($tmp_path . DIRECTORY_SEPARATOR . 'package2.xml')) { - $package_xml_path = $tmp_path . DIRECTORY_SEPARATOR . 'package2.xml'; + $this->package_xml_path = $tmp_path . DIRECTORY_SEPARATOR . 'package2.xml'; } else if (file_exists($tmp_path . DIRECTORY_SEPARATOR . 'package.xml')) { - $package_xml_path = $tmp_path . DIRECTORY_SEPARATOR . 'package.xml'; + $this->package_xml_path = $tmp_path . DIRECTORY_SEPARATOR . 'package.xml'; } else if (file_exists($this->tmp_extract_path . DIRECTORY_SEPARATOR . 'package2.xml')) { - $package_xml_path = $this->tmp_extract_path . DIRECTORY_SEPARATOR . 'package2.xml'; + $this->package_xml_path = $this->tmp_extract_path . DIRECTORY_SEPARATOR . 'package2.xml'; } else if (file_exists($this->tmp_extract_path . DIRECTORY_SEPARATOR . 'package.xml')) { - $package_xml_path = $this->tmp_extract_path . DIRECTORY_SEPARATOR . 'package.xml'; + $this->package_xml_path = $this->tmp_extract_path . DIRECTORY_SEPARATOR . 'package.xml'; } - if ($package_xml_path) { - $this->package_xml = new \SimpleXMLElement($package_xml_path, 0, true); + if ($this->package_xml_path) { + $this->package_xml = new \SimpleXMLElement($this->package_xml_path, 0, true); + } + + $pickle_convert_out = NULL; + /* XXX might be extended later to use glob() for searching the composer.json + If not found, it's anyway converted from the package.xml to inject + into the build package later. */ + if (file_exists($tmp_path . DIRECTORY_SEPARATOR . 'composer.json')) { + $this->composer_json_path = $tmp_path . DIRECTORY_SEPARATOR . 'composer.json'; + } else if ($this->package_xml_path) { + $package_xml_dir = dirname($this->package_xml_path); + $cmd = PHP_BINARY . " $this->pickle_phar convert " . $package_xml_dir; + $pickle_convert_out = shell_exec($cmd); + + if (file_exists($package_xml_dir . DIRECTORY_SEPARATOR . "composer.json")) { + $this->composer_json_path = $package_xml_dir . DIRECTORY_SEPARATOR . "composer.json"; + } else { + /* XXX mail these errors to the package maintainers later in the main script pecl.php */ + xmail( + NULL, + '[email protected]', + "pickle convert fail for " . $this->pkg_basename, + $pickle_convert_out + ); + } } $this->pkg_path = NULL; @@ -771,6 +798,10 @@ if (!function_exists('rmtools\combinations')) { $this->prepareExtLicense($this->tmp_extract_path, $target) ); + if ($this->composer_json_path) { + $files_to_zip[] = $this->composer_json_path; + } + /* care about the files marked as "doc" in the package.xml */ $dirs = $this->getPackageXmlProperty("contents", "dir"); if ($dirs) { -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
