diff options
Diffstat (limited to 'coin/provisioning/common')
-rw-r--r-- | coin/provisioning/common/03-conan.ps1 | 58 | ||||
-rw-r--r-- | coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh | 127 | ||||
-rw-r--r-- | coin/provisioning/common/InstallPKGFromURL.sh | 103 | ||||
-rw-r--r-- | coin/provisioning/common/helpers.ps1 | 23 | ||||
-rw-r--r-- | coin/provisioning/common/libusb.ps1 | 47 | ||||
-rw-r--r-- | coin/provisioning/common/patch_qnx.ps1 | 51 | ||||
-rw-r--r-- | coin/provisioning/common/ruby.ps1 | 7 |
7 files changed, 416 insertions, 0 deletions
diff --git a/coin/provisioning/common/03-conan.ps1 b/coin/provisioning/common/03-conan.ps1 new file mode 100644 index 00000000..6a4b4ebb --- /dev/null +++ b/coin/provisioning/common/03-conan.ps1 @@ -0,0 +1,58 @@ +. "$PSScriptRoot\helpers.ps1" + +$scriptsPath = "C:\Python27\Scripts" + +& "$scriptsPath\pip.exe" install --upgrade conan==0.20.2 + +[Environment]::SetEnvironmentVariable("CI_CONAN_BUILDINFO_DIR", "C:\Utils\conanbuildinfos", "Machine") + +function Start-Process-Logged +{ + Write-Host "Start-Process", $args + Start-Process @args +} + +function Run-Conan-Install +{ + Param ( + [string]$ConanfilesDir, + [string]$BuildinfoDir, + [string]$Arch, + [string]$Compiler, + [string]$CompilerVersion, + [string]$CompilerRuntime, + [string]$CompilerLibcxx + ) + + if ($CompilerRuntime) { + $extraArgs = "-s compiler.runtime=$($CompilerRuntime)" + } + + if ($CompilerLibcxx) { + $extraArgs = "-s compiler.libcxx=$($CompilerLibcxx)" + } + + Get-ChildItem -Path "$ConanfilesDir\*.txt" | + ForEach-Object { + $conanfile = $_.FullName + $outpwd = "C:\Utils\conanbuildinfos\$($BuildinfoDir)\$($_.BaseName)" + $manifestsDir = "$($_.DirectoryName)\$($_.BaseName).manifests" + New-Item $outpwd -Type directory -Force + + $process = Start-Process-Logged ` + "$scriptsPath\conan.exe" ` + -WorkingDirectory $outpwd ` + -ArgumentList "install -f $conanfile --no-imports --verify $manifestsDir", ` + '-s', ('compiler="' + $Compiler + '"'), ` + "-s os=Windows -s arch=$Arch -s compiler.version=$CompilerVersion $extraArgs" ` + -NoNewWindow -Wait -Verbose ` + -PassThru # Return process object + + if ($process.ExitCode -ne 0) { + Write-Host "conan exited with code $($process.ExitCode)" + Exit(1) + } + + Copy-Item -Path $conanfile -Destination "$outpwd\conanfile.txt" + } +} diff --git a/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh b/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh new file mode 100644 index 00000000..b6072062 --- /dev/null +++ b/coin/provisioning/common/InstallAppFromCompressedFileFromURL.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +############################################################################# +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the provisioning scripts of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +# This script receives URLs to a compressed file. It then downloads it, +# uncompresses it and installs it by default +# to /Applications/. This can be overridden by a target parameter. + +# shellcheck source=try_catch.sh +source "${BASH_SOURCE%/*}/try_catch.sh" +# shellcheck source=DownloadURL.sh +source "${BASH_SOURCE%/*}/DownloadURL.sh" + +ExceptionCreateTmpFile=100 +ExceptionCreateTmpDirectory=101 +ExceptionUncompress=102 +ExceptionMoveApp=103 +ExceptionDeleteTmpFile=104 +ExceptionRemoveTmpDirectory=105 +ExceptionUnknownFormat=106 + + +function InstallAppFromCompressedFileFromURL { + url=$1 + url_alt=$2 + expectedSha1=$3 + appPrefix=$4 + target=$5 + + if [ "" == "$target" ]; then + target="/Applications/" + fi + + try + ( + basefilename=${url##*/} + extension=${basefilename##*.} + filename=${basefilename%.*} + if [ "$extension" == "gz" ] && [ "${filename##*.}" == "tar" ]; then + extension="tar.gz" + fi + + echo "Extension for file: $extension" + echo "Creating temporary file and directory" + targetFile=$(mktemp "$TMPDIR$(uuidgen).$extension") || throw $ExceptionCreateTmpFile + targetDirectory=$(mktemp -d) || throw $ExceptionCreateTmpDirectory + DownloadURL "$url" "$url_alt" "$expectedSha1" "$targetFile" + echo "Uncompress $targetFile" + case $extension in + "tar.gz") + tar -xzf "$targetFile" --directory "$targetDirectory" || throw $ExceptionUncompress + ;; + "zip") + unzip "$targetFile" -d "$targetDirectory" || throw $ExceptionUncompress + ;; + *) + throw $ExceptionUnknownFormat + ;; + esac + echo "Moving app to '$target'" + sudo mv "$targetDirectory/$appPrefix/"* "$target" || throw $ExceptionMoveApp + echo "Removing file '$targetFile'" + rm "$targetFile" || throw $ExceptionDeleteTmpFile + echo "Removing directory '$targetDirectory'" + rm -rf "$targetDirectory" || throw $ExceptionRemoveTmpDirectory + ) + + catch || { + case $ex_code in + $ExceptionCreateTmpFile) + echo "Failed to create temporary file" + exit 1; + ;; + $ExceptionUncompress) + echo "Failed extracting compressed file." + exit 1; + ;; + $ExceptionMoveApp) + echo "Failed moving app to '$target'." + exit 1; + ;; + $ExceptionDeleteTmpFile) + echo "Failed deleting temporary file." + exit 1; + ;; + $ExceptionRemoveTmpDirectory) + echo "Failed deleting temporary file." + exit 1; + ;; + $ExceptionUnknownFormat) + echo "Unknown file format." + exit 1; + ;; + esac + } +} diff --git a/coin/provisioning/common/InstallPKGFromURL.sh b/coin/provisioning/common/InstallPKGFromURL.sh new file mode 100644 index 00000000..07f23d62 --- /dev/null +++ b/coin/provisioning/common/InstallPKGFromURL.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +############################################################################# +## +## Copyright (C) 2017 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the provisioning scripts of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +# shellcheck source=try_catch.sh +source "${BASH_SOURCE%/*}/try_catch.sh" + +ExceptionCreateTmpFile=100 +ExceptionDownloadPrimaryUrl=101 +ExceptionDownloadAltUrl=102 +ExceptionSHA1=103 +ExceptionInstallerPKG=104 +ExceptionDeleteTmpFile=105 + + +function InstallPKGFromURL { + url=$1 + url_alt=$2 + expectedSha1=$3 + targetDirectory=$4 + + try + ( + echo "Creating temporary file" + targetFile=$(mktemp "$TMPDIR$(uuidgen).pkg") || trow $ExceptionCreateTmpFile + try + ( + echo "Downloading PKG from primary URL '$url'" + curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" || throw $ExceptionDownloadPrimaryUrl + ) + catch || { + case $ex_code in + $ExceptionDownloadPrimaryUrl) + echo "Failed to download '$url' multiple times" + echo "Downloading PKG from alternative URL '$url_alt'" + curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url_alt" || throw $ExceptionDownloadAltUrl + ;; + esac + } + echo "Checking SHA1 on PKG '$targetFile'" + echo "$expectedSha1 *$targetFile" | shasum --check || throw $ExceptionSHA1 + echo "Run installer on PKG" + sudo installer -package "$targetFile" -target "$targetDirectory" || throw $ExceptionInstallerPKG + echo "Removing file '$targetFile'" + rm "$targetFile" || throw $ExceptionDeleteTmpFile + ) + + catch || { + case $ex_code in + $ExceptionCreateTmpFile) + echo "Failed to create temporary file" + exit 1; + ;; + $ExceptionDownloadAltUrl) + echo "Failed downloading PKG from primary and alternative URLs" + exit 1; + ;; + $ExceptionSHA1) + echo "Failed to check sha1sum." + exit 1; + ;; + $ExceptionInstallerPKG) + echo "Failed running installer on PKG." + exit 1; + ;; + $ExceptionDeleteTmpFile) + echo "Failed deleting temporary file." + exit 1; + ;; + esac + } +} diff --git a/coin/provisioning/common/helpers.ps1 b/coin/provisioning/common/helpers.ps1 index 0e684452..af7f79ff 100644 --- a/coin/provisioning/common/helpers.ps1 +++ b/coin/provisioning/common/helpers.ps1 @@ -15,6 +15,29 @@ function Verify-Checksum } } +function Extract-7Zip +{ + Param ( + [string]$Source, + [string]$Destination + ) + echo "Extracting '$Source' to '$Destination'..." + + if ((Get-Command "7z.exe" -ErrorAction SilentlyContinue) -eq $null) { + $zipExe = join-path (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0] '7-zip\7z.exe' + if (-not (test-path $zipExe)) { + $zipExe = join-path ${env:ProgramW6432} '7-zip\7z.exe' + if (-not (test-path $zipExe)) { + throw "Could not find 7-zip." + } + } + } else { + $zipExe = "7z.exe" + } + + & $zipExe x $Source "-o$Destination" -y +} + function Extract-Zip { Param ( diff --git a/coin/provisioning/common/libusb.ps1 b/coin/provisioning/common/libusb.ps1 new file mode 100644 index 00000000..ed575886 --- /dev/null +++ b/coin/provisioning/common/libusb.ps1 @@ -0,0 +1,47 @@ +############################################################################# +# +# Copyright (C) 2017 The Qt Company Ltd. +# Contact: http://www.qt.io/licensing/ +# +# This file is part of the provisioning scripts of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL21$ +# Commercial License Usage +# Licensees holding valid commercial Qt licenses may use this file in +# accordance with the commercial license agreement provided with the +# Software or, alternatively, in accordance with the terms contained in +# a written agreement between you and The Qt Company. For licensing terms +# and conditions see http://www.qt.io/terms-conditions. For further +# information use the contact form at http://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 2.1 or version 3 as published by the Free +# Software Foundation and appearing in the file LICENSE.LGPLv21 and +# LICENSE.LGPLv3 included in the packaging of this file. Please review the +# following information to ensure the GNU Lesser General Public License +# requirements will be met: https://www.gnu.org/licenses/lgpl.html and +# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +# +# As a special exception, The Qt Company gives you certain additional +# rights. These rights are described in The Qt Company LGPL Exception +# version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +# +# $QT_END_LICENSE$ +# +############################################################################ + +# lisbusb-1.0 is needed by tqtc-boot2qt/qdb + +. "$PSScriptRoot\helpers.ps1" + +$archive = "C:\users\qt\downloads\libusb-1.0.21.7z" +$libusb_location = "C:\Utils\libusb-1.0" + +Download https://vorboss.dl.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z http://ci-files01-hki.ci.local/input/libusb-1.0/libusb-1.0.21.7z $archive +Verify-Checksum $archive "37c8884a0ddca97d492b8ef3e08970ae3ba20653" + +Extract-7Zip $archive $libusb_location + +# Tell tqtc-boot2qt/qdb build system where to find libusb +[Environment]::SetEnvironmentVariable("LIBUSB_PATH", $libusb_location, "Machine") diff --git a/coin/provisioning/common/patch_qnx.ps1 b/coin/provisioning/common/patch_qnx.ps1 new file mode 100644 index 00000000..2fca7b67 --- /dev/null +++ b/coin/provisioning/common/patch_qnx.ps1 @@ -0,0 +1,51 @@ +############################################################################# +## +## Copyright (C) 2016 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the test suite of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +# Patch QNX SDK due to issues in the standard library. +# The patches are available here: +# http://www.qnx.com/download/feature.html?programid=27555 +# A copy of the patch must be in the root of the Coin path in +# provisioning/qnx/patch-660-4367-RS6069_cpp-headers.zip + + +. "$PSScriptRoot\helpers.ps1" + +$zip = "c:\users\qt\downloads\patch-660-4367-RS6069_cpp-headers.zip" +$sha1 = "57A11FFE4434AD567B3C36F7B828DBB468A9E565" +$tempDir = "C:\temp\qnx_path" + +Invoke-WebRequest -UseBasicParsing http://${Env:COIN_WEBSERVER_ADDRESS}/coin/provisioning/qnx/patch-660-4367-RS6069_cpp-headers.zip -OutFile $zip +Verify-Checksum $zip $sha1 +Extract-Zip $zip $tempDir +Copy-Item $tempDir\patches\660-4367\target\* C:\qnx660\target\ -recurse -force +Remove-Item $tempDir -recurse diff --git a/coin/provisioning/common/ruby.ps1 b/coin/provisioning/common/ruby.ps1 new file mode 100644 index 00000000..343bacfc --- /dev/null +++ b/coin/provisioning/common/ruby.ps1 @@ -0,0 +1,7 @@ +. "$PSScriptRoot\helpers.ps1" + +$installer = "c:\users\qt\downloads\rubyinstaller-2.3.1.exe" + +Download https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.1.exe http://ci-files01-hki.ci.local/input/ruby/rubyinstaller-2.3.1.exe $installer +Verify-Checksum $installer "FF377F6F313849C3B0CD72EEC1EFFA436F0E4A36" +& $installer /DIR=C:\ruby /VERYSILENT |