Relax jq dependency from provisioning

We may read the installed package information from the 'vcpkg list'
command instead of parsing the vcpkg.json. Also instead of using
the jq as a parser, use the cmake script. This allows skipping the
jq installation.

Change-Id: Id3ace62f8f40ff1bd059878da3fd13e466861830
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev
2025-01-08 17:58:25 +01:00
parent 3145c3a5ed
commit c259d85b8e
33 changed files with 77 additions and 138 deletions

View File

@@ -14,9 +14,17 @@ mkdir -p "$VCPKG_ROOT/installed"
cp -R x86-android-qt-tmp/* "$VCPKG_ROOT/installed/"
cp -R x86_64-android-qt-tmp/* "$VCPKG_ROOT/installed/"
versions=$(jq -r '.overrides[] | "vcpkg \(.name) for android = \(.version)"' vcpkg.json)
versions="${versions//vcpkg/\\nvcpkg}"
echo "$versions" >> ~/versions.txt
cmake "-DVCPKG_EXECUTABLE=$VCPKG_ROOT/vcpkg"\
"-DVCPKG_INSTALL_ROOT=$PWD/x86-android-qt-tmp"\
"-DOUTPUT=~/versions.txt"\
-P\
"${BASH_SOURCE%/*}/../shared/vcpkg_parse_packages.cmake"
cmake "-DVCPKG_EXECUTABLE=$VCPKG_ROOT/vcpkg"\
"-DVCPKG_INSTALL_ROOT=$PWD/x86_64-android-qt-tmp"\
"-DOUTPUT=$HOME/versions.txt"\
-P\
"${BASH_SOURCE%/*}/../shared/vcpkg_parse_packages.cmake"
rm -rf x86-android-qt-tmp
rm -rf x86_64-android-qt-tmp

View File

@@ -7,15 +7,19 @@ echo "Installing vcpkg ports"
pushd "${BASH_SOURCE%/*}/vcpkg" || exit
cp "${BASH_SOURCE%/*}/../shared/vcpkg-configuration.json" .
"$VCPKG_ROOT/vcpkg" install --triplet x64-linux-qt --x-install-root x64-linux-qt-tmp --debug
install_root=x64-linux-qt-tmp
"$VCPKG_ROOT/vcpkg" install --triplet x64-linux-qt --x-install-root $install_root --debug
cmake "-DVCPKG_EXECUTABLE=$VCPKG_ROOT/vcpkg"\
"-DVCPKG_INSTALL_ROOT=$PWD/$install_root"\
"-DOUTPUT=$HOME/versions.txt"\
-P\
"${BASH_SOURCE%/*}/../shared/vcpkg_parse_packages.cmake"
mkdir -p "$VCPKG_ROOT/installed"
cp -R x64-linux-qt-tmp/* "$VCPKG_ROOT/installed/"
cp -R $install_root/* "$VCPKG_ROOT/installed/"
versions=$(jq -r '.overrides[] | "vcpkg \(.name) = \(.version)"' vcpkg.json)
versions="${versions//vcpkg/\\nvcpkg}"
echo "$versions" >> ~/versions.txt
rm -rf x64-linux-qt-tmp
rm -rf $install_root
popd || exit

View File

@@ -0,0 +1,45 @@
#!/usr/bin/cmake -P
cmake_minimum_required(VERSION 3.19)
message("VCPKG_EXECUTABLE: ${VCPKG_EXECUTABLE}")
if(NOT VCPKG_EXECUTABLE OR NOT EXISTS "${VCPKG_EXECUTABLE}" OR NOT OUTPUT OR NOT VCPKG_INSTALL_ROOT)
message(FATAL_ERROR "Usage: \ncmake -DVCPKG_EXECUTABLE=<path/to/vcpkg/executable>"
" -DOUTPUT=<path/to/versions.txt> -DVCPKG_INSTALL_ROOT=<path/to/install/root>"
" -P vcpkg_parse_packages.cmake"
)
endif()
execute_process(COMMAND "${VCPKG_EXECUTABLE}"
"list" "--x-install-root=${VCPKG_INSTALL_ROOT}" "--x-json" OUTPUT_VARIABLE result)
string(JSON element_count LENGTH "${result}")
file(STRINGS "${OUTPUT}" output_data)
math(EXPR last_index "${element_count} - 1")
foreach(i RANGE 0 ${last_index})
string(JSON package MEMBER "${result}" "${i}")
# Extract the package name from <package name>:<triplet> pair
if(NOT package MATCHES "^([^:]+):.+$")
continue()
endif()
# Skip vcpkg internal tools
set(package_name "${CMAKE_MATCH_1}")
if(package_name MATCHES "^vcpkg-.+$")
continue()
endif()
string(JSON package_info GET "${result}" "${package}")
string(JSON version GET "${package_info}" "version")
string(STRIP "${package}" package)
string(STRIP "${version}" version)
# Store the package information for the particular triplet
list(APPEND output_data "vcpkg ${package} = ${version}")
endforeach()
if(output_data)
list(JOIN output_data "\n" output_data)
file(WRITE "${OUTPUT}" "${output_data}\n")
endif()

View File

@@ -1,31 +0,0 @@
# Copyright (C) 2019 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
. "$PSScriptRoot\helpers.ps1"
# This script installs jq
$jqProgram = "jq"
$jqVersion = "1.6"
$jqExeSHA1 = "2b7ae7b902aa251b55f2fd73ad5b067d2215ce78"
$jqInstallLocation = "C:\Utils\jq"
$jqExe = "C:\Windows\Temp\jq.exe"
$jqCacheURL = "\\ci-files01-hki.ci.qt.io\provisioning\jq\jq-win64-$jqVersion.exe"
$jqOfficialURL = "https://github.com/jqlang/jq/releases/download/jq-$jqVersion/jq-win64.exe"
Download "$jqOfficialURL" "$jqCacheURL" "$jqExe"
Verify-Checksum $jqExe $jqExeSHA1
New-Item -Path "C:\Utils" -Name "jq" -ItemType "directory" -Force
Move-Item -Path "$jqExe" -Destination "$jqInstallLocation" -Force
if(![System.IO.File]::Exists("$jqInstallLocation\jq.exe")){
Write-Host "Can't find $jqInstallLocation\jq.exe."
exit 1
}
# Add jq to Path. It is necessary to prepend it to $env:Path as well, to make
# it available during provisioning
Prepend-Path "$jqInstallLocation"
$env:Path = "$jqInstallLocation;$env:Path"
Write-Output "jq = $jqVersion" >> ~/versions.txt

View File

@@ -5,19 +5,18 @@
Write-Host "Installing vcpkg android ports"
$vcpkgExe = "$env:VCPKG_ROOT\vcpkg.exe"
$vcpkgRoot = "$env:VCPKG_ROOT"
$vcpkgInstallRoot = "armeabi-v7a-android-qt-tmp"
Set-Location -Path "$PSScriptRoot\vcpkg"
Copy-Item "$PSScriptRoot\..\shared\vcpkg-configuration.json" -Destination "$PSScriptRoot\vcpkg"
Run-Executable "$vcpkgExe" "install --triplet armeabi-v7a-android-qt --x-install-root armeabi-v7a-android-qt-tmp --debug"
Run-Executable "$vcpkgExe" "install --triplet armeabi-v7a-android-qt --x-install-root $vcpkgInstallRoot --debug"
New-Item -Path "$vcpkgRoot" -Name "installed" -ItemType "directory" -Force
Copy-Item -Path "armeabi-v7a-android-qt-tmp\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
Copy-Item -Path "$vcpkgInstallRoot\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
$versions = jq.exe -r '.overrides[] | \"vcpkg \(.name) for android = \(.version)\"' vcpkg.json
$versions = $versions.Replace("vcpkg", "`nvcpkg")
Write-Output "$versions" >> ~/versions.txt
Run-Executable "cmake" "-DVCPKG_EXECUTABLE=$vcpkgExe -DVCPKG_INSTALL_ROOT=$vcpkgInstallRoot -DOUTPUT=$env:USERPROFILE\versions.txt -P $PSScriptRoot\..\shared\vcpkg_parse_packages.cmake"
Remove-Item -Path "armeabi-v7a-android-qt-tmp" -Recurse -Force
Remove-Item -Path "$vcpkgInstallRoot" -Recurse -Force
Set-Location "$PSScriptRoot"

View File

@@ -8,19 +8,18 @@ param([string]$arch="x64")
Write-Host "Installing vcpkg ports"
$vcpkgExe = "$env:VCPKG_ROOT\vcpkg.exe"
$vcpkgRoot = "$env:VCPKG_ROOT"
$vcpkgInstallRoot = "$arch-windows-qt-tmp"
Set-Location -Path "$PSScriptRoot\vcpkg"
Copy-Item "$PSScriptRoot\..\shared\vcpkg-configuration.json" -Destination "$PSScriptRoot\vcpkg"
Run-Executable "$vcpkgExe" "install --triplet $arch-windows-qt --x-install-root $arch-windows-qt-tmp --debug"
Run-Executable "$vcpkgExe" "install --triplet $arch-windows-qt --x-install-root $vcpkginstallroot --debug"
New-Item -Path "$vcpkgRoot" -Name "installed" -ItemType "directory" -Force
Copy-Item -Path "$arch-windows-qt-tmp\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
Copy-Item -Path "$vcpkginstallroot\*" -Destination "$vcpkgRoot\installed" -Recurse -Force
$versions = jq.exe -r '.overrides[] | \"vcpkg \(.name) = \(.version)\"' vcpkg.json
$versions = $versions.Replace("vcpkg", "`nvcpkg")
Write-Output "$versions" >> ~/versions.txt
Run-Executable "cmake" "-DVCPKG_EXECUTABLE=$vcpkgExe -DVCPKG_INSTALL_ROOT=$vcpkgInstallRoot -DOUTPUT=$env:USERPROFILE\versions.txt -P $PSScriptRoot\..\shared\vcpkg_parse_packages.cmake"
Remove-Item -Path "$arch-windows-qt-tmp" -Recurse -Force
Remove-Item -Path "$vcpkginstallroot" -Recurse -Force
Set-Location "$PSScriptRoot"

View File

@@ -147,8 +147,6 @@ installPackages+=(open-vm-tools)
# cifs-utils, for mounting smb drive
installPackages+=(keyutils)
installPackages+=(cifs-utils)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
# zip, needed for vcpkg caching
installPackages+=(zip)
# OpenSSL requirement, built by vcpkg

View File

@@ -148,8 +148,6 @@ installPackages+=(open-vm-tools)
# cifs-utils, for mounting smb drive
installPackages+=(keyutils)
installPackages+=(cifs-utils)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
# zip, needed for vcpkg caching
installPackages+=(zip)
# OpenSSL requirement, built by vcpkg

View File

@@ -159,8 +159,6 @@ installPackages+=(nfs-utils)
# cifs-utils, for mounting smb drive
installPackages+=(keyutils)
installPackages+=(cifs-utils)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
# zip, needed for vcpkg caching
installPackages+=(zip)
# OpenSSL requirement, built by vcpkg

View File

@@ -159,8 +159,6 @@ installPackages+=(nfs-utils)
# cifs-utils, for mounting smb drive
installPackages+=(keyutils)
installPackages+=(cifs-utils)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
# zip, needed for vcpkg caching
installPackages+=(zip)
# OpenSSL requirement, built by vcpkg

View File

@@ -92,9 +92,6 @@ sudo zypper -nq update open-vm-tools
# Tools to build Git
sudo zypper -nq install autoconf libcurl-devel libexpat-devel
# used for reading vcpkg packages version, from vcpkg.json
sudo zypper -nq install jq
# zip, needed for vcpkg caching
sudo zypper -nq install zip

View File

@@ -94,9 +94,6 @@ sudo zypper -nq update open-vm-tools
# Tools to build Git
sudo zypper -nq install autoconf libcurl-devel libexpat-devel
# used for reading vcpkg packages version, from vcpkg.json
sudo zypper -nq install jq
# zip, needed for vcpkg caching
sudo zypper -nq install zip

View File

@@ -233,8 +233,6 @@ installPackages+=(keyutils)
installPackages+=(cifs-utils)
# VxWorks QEMU network setup (tunctl)
installPackages+=(uml-utilities)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
# To save iptables rules
installPackages+=(iptables-persistent)

View File

@@ -225,8 +225,6 @@ installPackages+=(keyutils)
installPackages+=(cifs-utils)
# VxWorks QEMU network setup (tunctl)
installPackages+=(uml-utilities)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
# For building
installPackages+=(cmake)
# extra linkers

View File

@@ -244,8 +244,6 @@ installPackages+=(keyutils)
installPackages+=(cifs-utils)
# VxWorks QEMU network setup (tunctl)
installPackages+=(uml-utilities)
# used for reading vcpkg packages version, from vcpkg.json
installPackages+=(jq)
installPackages+=(patchelf)

View File

@@ -76,9 +76,6 @@ sudo zypper -nq install zip
# OpenSSL 3
sudo zypper -nq install openssl-3
# used for reading vcpkg packages version, from vcpkg.json
sudo zypper -nq install jq
# Valgrind (Needed for testlib selftests)
sudo zypper -nq install valgrind-devel

View File

@@ -72,9 +72,6 @@ sudo zypper -nq install zip
# OpenSSL 3
sudo zypper -nq install openssl-3
# used for reading vcpkg packages version, from vcpkg.json
sudo zypper -nq install jq
# Valgrind (Needed for testlib selftests)
sudo zypper -nq install valgrind-devel

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -ex
brew install jq

View File

@@ -1 +0,0 @@
. "$PSScriptRoot\..\common\windows\install-jq.ps1"

View File

@@ -1 +0,0 @@
. "$PSScriptRoot\..\common\windows\install-jq.ps1"

View File

@@ -1 +0,0 @@
. "$PSScriptRoot\..\common\windows\install-jq.ps1"

View File

@@ -1 +0,0 @@
. "$PSScriptRoot\..\common\windows\install-jq.ps1"

View File

@@ -1 +0,0 @@
. "$PSScriptRoot\..\common\windows\install-jq.ps1"

View File

@@ -1,4 +0,0 @@
# Copyright (C) 2025 The Qt Company Ltd
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
. "$PSScriptRoot\..\common\windows\install-jq.ps1"