Commit: 8b44fe891b507c6e8d480c033b45f7289aa08d89 Author: Anatol Belski <[email protected]> Mon, 7 Oct 2013 20:18:55 +0200 Parents: b85c4446de839b1e4773192c312d19f7f3fb0bca Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=8b44fe891b507c6e8d480c033b45f7289aa08d89 Log: first shot for license packaging Changed paths: M client/include/PeclExt.php Diff: diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php index 11becfb..44a8d98 100644 --- a/client/include/PeclExt.php +++ b/client/include/PeclExt.php @@ -530,6 +530,57 @@ if (!function_exists('rmtools\combinations')) { return $this->buildConfigureLine($config); } + public function prepareLicenseSimple($source, $target, $suffix = NULL) + { + $ret = array(); + $base = array( + "COPYING", + "COPYRIGHT", + "LICENSE", + "README", + ); + + $names = $base; + foreach ($base as $nm) { + $names[] = "$nm*"; + $names[] = strtolower($nm) . "*"; + $names[] = ucfirst(strtolower($nm)) . "*"; + } + + foreach ($names as $name) { + $pat = $source . DIRECTORY_SEPARATOR . $name; + + $glob = glob($pat); + + if (is_array($glob)) { + foreach ($glob as $fl) { + $tgt_fl = $target . DIRECTORY_SEPARATOR + . basename($fl) . "." . strtoupper($suffix); + if (!copy($fl, $tgt_fl)) { + throw new \Exception("The license file '$fl' " + . "was found but couldn't be copied into '$tgt_fl'"); + } + + $ret[] = $tgt_fl; + } + } + } + + return $ret; + } + + public function prepareExtLicense($source, $target, $suffix = NULL) + { + $ret = $this->prepareLicenseSimple($source, $target, $suffix); + + if (!$ret) { + /* XXX check package.xml here*/ + } + + + return $ret; + } + public function prepareAllDepDlls($dll_file, $target) { $ret = array(); @@ -560,6 +611,14 @@ if (!function_exists('rmtools\combinations')) { $ret[] = $dll_file; /* some dep dll might have another dep :) */ $ret = array_merge($this->prepareAllDepDlls($look_for, $target), $ret); + $ret = array_merge( + $this->prepareLicenseSimple( + $deps_path . DIRECTORY_SEPARATOR . $lib, + $target, + $lib + ), + $ret + ); } $look_for = $deps_path @@ -635,6 +694,12 @@ if (!function_exists('rmtools\combinations')) { throw new \Exception($msg); } + /* care about extension license */ + $files_to_zip = array_merge( + $files_to_zip, + $this->prepareExtLicense($this->tmp_extract_path, $target, "php." . $this->name) + ); + /* pack */ $zip_file = TMP_DIR . DIRECTORY_SEPARATOR . $this->getPackageName() . '.zip'; $zip_cmd = $this->zip_cmd . ' -9 -D -j ' . $zip_file . ' ' . implode(' ', $files_to_zip); -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
