From 8cf75f826f25cb19cf34aefca23aafde5c9fe85d Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 1 Jul 2021 15:30:33 +0200 Subject: [PATCH] :hammer: updateLicenses : add logs and replace rm -f by unlink() --- .make/license/updateLicenses.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.make/license/updateLicenses.php b/.make/license/updateLicenses.php index 706378247..7df2fe3cb 100644 --- a/.make/license/updateLicenses.php +++ b/.make/license/updateLicenses.php @@ -73,28 +73,34 @@ function get_license_nodes($file_path) $licenses = iterator_to_array($licenseList); usort($licenses, 'sort_by_product'); + return $licenses; } $old_licenses = get_license_nodes($xmlFilePath); //generate file with updated licenses +echo "- Generating licences..."; $generated_license_file_path = __DIR__."/provfile.xml"; -exec("bash " . __DIR__ . "/gen-community-license.sh $iTopFolder > ". $generated_license_file_path); +exec("bash ".__DIR__."/gen-community-license.sh $iTopFolder > ".$generated_license_file_path); +echo "OK!\n"; + +echo "- Get licenses nodes..."; $new_licenses = get_license_nodes($generated_license_file_path); -exec("rm -f ". $generated_license_file_path); +unlink($generated_license_file_path); foreach ($old_licenses as $b) { $aProductNode = get_product_node($b); - if (get_scope($aProductNode) !== "lib" && get_scope($aProductNode) !== "datamodels" ) - { + if (get_scope($aProductNode) !== "lib" && get_scope($aProductNode) !== "datamodels") { $new_licenses[] = $b; } } usort($new_licenses, 'sort_by_product'); +echo "OK!\n"; +echo "- Overwritting Combodo license file..."; $new_dom = new DOMDocument("1.0"); $new_dom->formatOutput = true; $root = $new_dom->createElement("licenses"); @@ -105,4 +111,5 @@ foreach ($new_licenses as $b) { $root->appendChild($new_dom->importNode($b,true)); } -$new_dom->save($xmlFilePath); \ No newline at end of file +$new_dom->save($xmlFilePath); +echo "OK!\n"; \ No newline at end of file