N°6098 updateLicenses script : check availability of the required JQ command (#458)

This packaging script requires both bash and the JQ command when running on Windows.
If the later isn't available, it will run without throwing an error...

With this change the script will now check directly at launch for the JQ command availability, and exit in error if it isn't.
This commit is contained in:
Pierre Goiffon
2023-06-14 10:17:00 +02:00
committed by GitHub
parent 1ec671ef61
commit 76eed2eba0

View File

@@ -19,17 +19,24 @@
* The target license file path is in `$xmlFilePath` * The target license file path is in `$xmlFilePath`
*/ */
$iTopFolder = __DIR__ . "/../../" ; $iTopFolder = __DIR__."/../../";
$xmlFilePath = $iTopFolder . "setup/licenses/community-licenses.xml"; $xmlFilePath = $iTopFolder."setup/licenses/community-licenses.xml";
function get_scope($product_node) $jqExec = shell_exec("jq -V"); // a param is mandatory otherwise the script will freeze
{ if ((null === $jqExec) || (false === $jqExec)) {
echo "/!\ JQ is required but cannot be launched :( \n";
echo "Check this script PHPDoc block for instructions\n";
die(-1);
}
function get_scope($product_node) {
$scope = $product_node->getAttribute("scope"); $scope = $product_node->getAttribute("scope");
if ($scope === "") if ($scope === "") { //put iTop first
{ //put iTop first
return "aaaaaaaaa"; return "aaaaaaaaa";
} }
return $scope; return $scope;
} }