GHA/linux: fix pip3 install impacket breakage

An upstream update `impacket` pip package started requiring `blinker`.
An older version is shipping with Ubuntu, causing this on install:
```
  Attempting uninstall: blinker
    Found existing installation: blinker 1.7.0
ERROR: Cannot uninstall blinker 1.7.0, RECORD file not found. Hint: The package was installed by debian.
```

Fix it by switching to venv and install everything separate from the
system.

The overhead is the same as using `pip --ignore-installed`, which also
installs everything from scratch.

The 3rd option is to uninstall the system `python3-blinker` package, but
it was the slowest.

Closes #15578
This commit is contained in:
Viktor Szakats 2024-11-13 23:43:49 +01:00
parent 04b9054a04
commit 2638570241
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 15 additions and 4 deletions

View File

@ -328,6 +328,7 @@ jobs:
libtasn1-6-dev libidn2-0-dev gawk gperf libtss2-dev dns-root-data bison gtk-doc-tools \ libtasn1-6-dev libidn2-0-dev gawk gperf libtss2-dev dns-root-data bison gtk-doc-tools \
texinfo texlive texlive-extra-utils autopoint libev-dev \ texinfo texlive texlive-extra-utils autopoint libev-dev \
apache2 apache2-dev libnghttp2-dev vsftpd apache2 apache2-dev libnghttp2-dev vsftpd
python3 -m venv $HOME/venv
echo 'CC=gcc-12' >> $GITHUB_ENV echo 'CC=gcc-12' >> $GITHUB_ENV
echo 'CXX=g++-12' >> $GITHUB_ENV echo 'CXX=g++-12' >> $GITHUB_ENV
name: 'install prereqs' name: 'install prereqs'
@ -501,12 +502,14 @@ jobs:
- name: 'install test prereqs' - name: 'install test prereqs'
run: | run: |
sudo python3 -m pip install --break-system-packages -r tests/requirements.txt source $HOME/venv/bin/activate
python3 -m pip install -r tests/requirements.txt
- name: 'run tests' - name: 'run tests'
env: env:
TFLAGS: "${{ matrix.build.tflags }}" TFLAGS: "${{ matrix.build.tflags }}"
run: | run: |
source $HOME/venv/bin/activate
if [ -n '${{ matrix.build.generate }}' ]; then if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build . --verbose --target test-ci cmake --build . --verbose --target test-ci
else else
@ -515,13 +518,15 @@ jobs:
- name: 'install pytest prereqs' - name: 'install pytest prereqs'
run: | run: |
sudo python3 -m pip install --break-system-packages -r tests/http/requirements.txt source $HOME/venv/bin/activate
python3 -m pip install -r tests/http/requirements.txt
- name: 'run pytest' - name: 'run pytest'
env: env:
TFLAGS: "${{ matrix.build.tflags }}" TFLAGS: "${{ matrix.build.tflags }}"
CURL_CI: github CURL_CI: github
run: | run: |
source $HOME/venv/bin/activate
if [ -n '${{ matrix.build.generate }}' ]; then if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build . --verbose --target curl-pytest-ci cmake --build . --verbose --target curl-pytest-ci
else else

View File

@ -290,6 +290,7 @@ jobs:
libtool autoconf automake pkgconf ninja-build stunnel4 \ libtool autoconf automake pkgconf ninja-build stunnel4 \
libpsl-dev libbrotli-dev libzstd-dev \ libpsl-dev libbrotli-dev libzstd-dev \
${{ matrix.build.install_packages }} ${{ matrix.build.install_packages }}
python3 -m venv $HOME/venv
name: 'install prereqs' name: 'install prereqs'
- if: contains(matrix.build.name, 'i686') - if: contains(matrix.build.name, 'i686')
@ -301,6 +302,7 @@ jobs:
libtool autoconf automake pkgconf stunnel4 \ libtool autoconf automake pkgconf stunnel4 \
libpsl-dev:i386 libbrotli-dev:i386 libzstd-dev:i386 \ libpsl-dev:i386 libbrotli-dev:i386 libzstd-dev:i386 \
${{ matrix.build.install_packages }} ${{ matrix.build.install_packages }}
python3 -m venv $HOME/venv
name: 'install prereqs' name: 'install prereqs'
- if: contains(matrix.build.install_steps, 'pytest') - if: contains(matrix.build.install_steps, 'pytest')
@ -616,7 +618,8 @@ jobs:
- name: 'install test prereqs' - name: 'install test prereqs'
if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.container == null }} if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.container == null }}
run: | run: |
sudo python3 -m pip install --break-system-packages -r tests/requirements.txt [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
python3 -m pip install -r tests/requirements.txt
- name: 'run tests' - name: 'run tests'
if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' }} if: ${{ matrix.build.install_steps != 'skipall' && matrix.build.install_steps != 'skiprun' }}
@ -631,6 +634,7 @@ jobs:
TFLAGS+=' ~2077 ~2078' # valgrind errors TFLAGS+=' ~2077 ~2078' # valgrind errors
fi fi
fi fi
[ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
if [ -n '${{ matrix.build.generate }}' ]; then if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build . --verbose --target ${{ matrix.build.torture && 'test-torture' || 'test-ci' }} cmake --build . --verbose --target ${{ matrix.build.torture && 'test-torture' || 'test-ci' }}
else else
@ -640,7 +644,8 @@ jobs:
- name: 'install pytest prereqs' - name: 'install pytest prereqs'
if: contains(matrix.build.install_steps, 'pytest') if: contains(matrix.build.install_steps, 'pytest')
run: | run: |
sudo python3 -m pip install --break-system-packages -r tests/http/requirements.txt [ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
python3 -m pip install -r tests/http/requirements.txt
- name: 'run pytest' - name: 'run pytest'
if: contains(matrix.build.install_steps, 'pytest') if: contains(matrix.build.install_steps, 'pytest')
@ -648,6 +653,7 @@ jobs:
TFLAGS: "${{ matrix.build.tflags }}" TFLAGS: "${{ matrix.build.tflags }}"
CURL_CI: github CURL_CI: github
run: | run: |
[ -x "$HOME/venv/bin/activate" ] && source $HOME/venv/bin/activate
if [ -n '${{ matrix.build.generate }}' ]; then if [ -n '${{ matrix.build.generate }}' ]; then
cmake --build . --verbose --target curl-pytest-ci cmake --build . --verbose --target curl-pytest-ci
else else