Provisioning: Exit when an emscripten install command fails

If there is an error in emsdk scripts when running ".\emsdk install",
the provisioning would still continue. This change will make the script
exit and stop provisioning when the install command fails.

Also remove the attempt to use Python 2 and make sure the installation
finds Python 3 instead.

Pick-to: 6.8 6.5
Task-number: QTQAINFRA-5453
Change-Id: If052adcd446537b0eeb6261e4a297e9aeb292c6e
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This commit is contained in:
Elias Toivola
2023-07-05 13:25:27 +03:00
parent 154b41a260
commit 879c8b91f3
2 changed files with 21 additions and 10 deletions

View File

@@ -11,7 +11,7 @@ source "${BASH_SOURCE%/*}/DownloadURL.sh"
version="3.1.56"
versionNode="v16.20.0"
tarBallVersion="${version//./_}"
if uname -a |grep -q Darwin; then
if uname -a | grep -q Darwin; then
tarBallPackage="emsdk_macos_${tarBallVersion}.tar.gz"
sha="24c49db971da4fd7c68f6b71984c3d7775fdfb84"
else
@@ -22,7 +22,7 @@ cacheUrl="https://ci-files01-hki.ci.qt.io/input/emsdk/${tarBallPackage}"
target="/tmp/${tarBallPackage}"
mkdir -p /opt
cd /opt
cd /opt || exit
echo "URL: $cacheUrl"
if DownloadURL "$cacheUrl" "" "$sha" "$target"; then
@@ -31,13 +31,16 @@ if DownloadURL "$cacheUrl" "" "$sha" "$target"; then
else
echo "Emsdk isn't cached. Cloning it"
sudo git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
sudo ./emsdk install "$version"
cd emsdk || exit
if ! sudo ./emsdk install "$version"; then
echo "Error: emsdk installation failed"
exit 1
fi
sudo ./emsdk activate "$version"
fi
# platform-specific toolchain and node binaries. urls obtained from "emsdk install"
if uname -a |grep -q Darwin; then
if uname -a | grep -q Darwin; then
pathNodeExecutable="node-$versionNode-darwin-x64/bin/node"
else
pathNodeExecutable="node-$versionNode-linux-x64/bin/node"

View File

@@ -11,8 +11,9 @@ $temp = "$env:tmp"
$cacheUrl = "https://ci-files01-hki.ci.qt.io/input/emsdk/emsdk_windows_${zipVersion}.zip"
$sha = "ab376d218f1a66302c36770977948f74f0576a42"
# Make sure python is in the path
Prepend-Path "C:\Python27"
# Python used for '.\emsdk install'
$pythonPath = [System.Environment]::GetEnvironmentVariable("PYTHON3_PATH", "Machine")
Prepend-Path $pythonPath
cd "C:\\Utils"
$installLocationEmsdk = "C:\\Utils\\emsdk"
@@ -24,11 +25,18 @@ try {
cd $installLocationEmsdk
.\emsdk activate $version
} catch {
Write-Host "Can't find cached emsdk. Cloning it"
Write-Host "Can't find cached emsdk or another error occurred. Cloning it"
Write-Host "Error details: $_"
C:\PROGRA~1\Git\bin\git clone https://github.com/emscripten-core/emsdk.git
cd $installLocationEmsdk
.\emsdk install $version
.\emsdk activate $version
try {
.\emsdk install $version
.\emsdk activate $version
} catch {
throw "emsdk installation failed: $_"
}
}
$versionWinPython = $($Env:EMSDK_PYTHON -split ('python\\') -split ('_64bit'))[1]