From 59fd96b18ffa03dfd590b19cb247b43bbe0895ab Mon Sep 17 00:00:00 2001 From: Tero Heikkinen Date: Thu, 13 Nov 2025 13:13:05 +0200 Subject: [PATCH] sbom: Create virtual env for RHEL 10.0 Python 3.12 requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Python 3.12 SBOM needs jsonschema package newer than 4.19 but cannot uninstall current one installed by RPM: Error: Attempting uninstall: jsonschema Found existing installation: jsonschema 4.19.1 error: uninstall-no-record-file × Cannot uninstall jsonschema 4.19.1 Therefore virtual env is used to fix this. Task-number: QTQAINFRA-7554 Change-Id: I1260ef7fdf0c1ba96acaee1738ed9612e47bedad Reviewed-by: Alexandru Croitor (cherry picked from commit 88177e9ab89c0e689b9862de352272e7fd02b6cc) Reviewed-by: Qt Cherry-pick Bot --- .../common/shared/sbom_requirements.txt | 2 +- .../04-install-packages.sh | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/coin/provisioning/common/shared/sbom_requirements.txt b/coin/provisioning/common/shared/sbom_requirements.txt index 473c8aa7..80e54e38 100644 --- a/coin/provisioning/common/shared/sbom_requirements.txt +++ b/coin/provisioning/common/shared/sbom_requirements.txt @@ -5,4 +5,4 @@ sbomaudit ; python_version >= '3.9' sbom2doc ; python_version >= '3.9' reuse<=5.1.1 ; python_version >= '3.9' cyclonedx-python-lib==11.5.0 ; python_version >= '3.9' -jsonschema>=4.20 ; python_version >= '3.9' +jsonschema>=4.20 ; python_version >= '3.12' diff --git a/coin/provisioning/qtci-linux-RHEL-10.0-x86_64/04-install-packages.sh b/coin/provisioning/qtci-linux-RHEL-10.0-x86_64/04-install-packages.sh index 8208cb1b..3c21fd97 100644 --- a/coin/provisioning/qtci-linux-RHEL-10.0-x86_64/04-install-packages.sh +++ b/coin/provisioning/qtci-linux-RHEL-10.0-x86_64/04-install-packages.sh @@ -175,13 +175,11 @@ sudo pip3 install --upgrade pip sudo pip config --user set global.index https://ci-files01-hki.ci.qt.io/input/python_module_cache sudo pip config --user set global.extra-index-url https://pypi.org/simple/ -sudo pip3 install virtualenv wheel -# Just make sure we have virtualenv to run with python3.8 -m virtualenv -sudo python -m pip install virtualenv wheel -sudo python -m pip install -r "${BASH_SOURCE%/*}/../common/shared/requirements.txt" - -sudo /usr/bin/pip3 install wheel -sudo /usr/bin/pip3 install -r "${BASH_SOURCE%/*}/../common/shared/requirements.txt" +# Create SBOM virtual env compatible with RHEL 10.0 Python 3.12 +mkdir "/home/qt/sbom/" +python3 -m venv /home/qt/sbom/venv +/home/qt/sbom/venv/bin/pip install wheel +/home/qt/sbom/venv/bin/pip install -r "${BASH_SOURCE%/*}/../common/shared/requirements.txt" # Provisioning during installation says: # 'The script sbom2doc is installed in '/usr/local/bin' which is not on PATH.' @@ -189,6 +187,9 @@ sudo /usr/bin/pip3 install -r "${BASH_SOURCE%/*}/../common/shared/requirements.t source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh" SetEnvVar "SBOM_PYTHON_APPS_PATH" "/usr/local/bin" +# Set SBOM_PYTHON_INTERP_PATH to Python3 instance which was used to install SBOM packages from requirements +SetEnvVar "SBOM_PYTHON_INTERP_PATH" "/home/qt/sbom/venv/bin" + # Make FindPython3.cmake to find python3 sudo ln -s /usr/bin/python3 /usr/local/bin/python3