com web/rmtools: implemented fallback to package.xml when there's no license file: client/include/PeclExt.php
| From: | Anatol Belski | Date: | Mon, 07 Oct 2013 19:22:25 +0000 |
| Subject: | com web/rmtools: implemented fallback to package.xml when there's no license file: client/include/PeclExt.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-19126@lists.php.net to get a copy of this message | ||
Commit: 2d683ba9f623ac9ee8dad5b5ff4fd54b10caec0a
Author: Anatol Belski <ab@php.net> Mon, 7 Oct 2013 21:22:25 +0200
Parents: 8b44fe891b507c6e8d480c033b45f7289aa08d89
Branches: master
Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=2d683ba9f623ac9ee8dad5b5ff4fd54b10caec0a
Log:
implemented fallback to package.xml when there's no license file
Changed paths:
M client/include/PeclExt.php
Diff:
diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php
index 44a8d98..c6fc127 100644
--- a/client/include/PeclExt..php
+++ b/client/include/PeclExt.php
@@ -555,7 +555,7 @@ if (!function_exists('rmtools\combinations')) {
if (is_array($glob)) {
foreach ($glob as $fl) {
$tgt_fl = $target .. DIRECTORY_SEPARATOR
- . basename($fl) . "." . strtoupper($suffix);
+ . strtoupper(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'");
@@ -574,9 +574,21 @@ if (!function_exists('rmtools\combinations')) {
$ret = $this->prepareLicenseSimple($source, $target, $suffix);
if (!$ret) {
- /* XXX check package.xml here*/
- }
+ /* No license file, check package.xml*/
+ if ($this->package_xml && isset($this->package_xml->license)) {
+ if (isset($this->package_xml->license[0]["uri"])) {
+ $txt = (string)$this->package_xml->license[0]["uri"];
+ } else {
+ $txt = (string)$this->package_xml->license[0];
+ }
+ if (isset($txt)) {
+ $fl = $target . DIRECTORY_SEPARATOR . "LICENSE." . strtoupper($suffix);
+ file_put_contents($fl, $txt);
+ $ret[] = $fl;
+ }
+ }
+ }
return $ret;
}
@@ -611,6 +623,7 @@ if (!function_exists('rmtools\combinations')) {
$ret[] = $dll_file;
/* some dep dll might have another dep :) */
$ret = array_merge($this->prepareAllDepDlls($look_for, $target), $ret);
+ /* care about the dep libs licenses */
$ret = array_merge(
$this->prepareLicenseSimple(
$deps_path . DIRECTORY_SEPARATOR . $lib,