sbom: Create virtual env for RHEL 10.0 Python 3.12 requirements

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 <alexandru.croitor@qt.io>
(cherry picked from commit 88177e9ab8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tero Heikkinen
2025-11-13 13:13:05 +02:00
parent 30a9d5669c
commit 59fd96b18f
2 changed files with 9 additions and 8 deletions

View File

@@ -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'

View File

@@ -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