Install Qt6 in CI runners and dev environments

Upgrade from Qt5 to Qt6 in our CI runners and dev environments, since
the latest PySide6 versions do not support Qt5. This leaves only our
Debian / Fedora packages relying on Qt5, since there's no PySide6
package for them yet.

There are some caveats to the Qt6 upgrade:

1. Debian Bullseye has a missing dependency to `libgl1`, so we need to
   install it separately.
2. Ubuntu Jammy has a missing dependency to `libxkbcommon-x11-0`, which
   we have to install separately.
3. Ubuntu Focal does not have Qt6, but surprisingly PySide6 works with
   Qt5.
4. All Debian-based distros require `libxcb-cursor0`.

As a side effect, we have to make our `env.py` a bit more complicated,
to cater to these exceptions.

Refs #482
This commit is contained in:
Alex Pyrgiotis 2023-07-24 10:20:08 +03:00
parent 77b380e7df
commit 26cf3db4b4
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
5 changed files with 34 additions and 18 deletions

View file

@ -140,7 +140,7 @@ jobs:
- run:
name: Install test dependencies
command: |
sudo apt-get install -y libqt5gui5 --no-install-recommends
sudo apt-get install -y libqt5gui5 libxcb-cursor0 --no-install-recommends
- run:
name: Prepare cache directory
command: |

View file

@ -5,7 +5,7 @@
Install dependencies:
```sh
sudo apt install -y podman dh-python build-essential fakeroot make libqt5gui5 \
sudo apt install -y podman dh-python build-essential fakeroot make libqt6gui6 \
pipx python3 python3-dev python3-stdeb python3-all
```
@ -60,7 +60,7 @@ Create a .deb:
Install dependencies:
```sh
sudo dnf install -y rpm-build podman python3 pipx qt5-qtbase-gui
sudo dnf install -y rpm-build podman python3 pipx qt6-qtbase-gui
```
Install Poetry using `pipx`:
@ -174,7 +174,7 @@ specified qubes.
1. Install dependencies:
```
sudo dnf install -y rpm-build pipx qt5-qtbase-gui libreoffice python3-magic \
sudo dnf install -y rpm-build pipx qt6-qtbase-gui libreoffice python3-magic \
tesseract*
```

View file

@ -14,6 +14,7 @@ since 0.4.1, and this project adheres to [Semantic Versioning](https://semver.or
- Platform support: Ubuntu 23.04 (Lunar Lobster)
- Inform about new updates on MacOS/Windows platforms, by periodically checking
our GitHub releases page ([issue #189](https://github.com/freedomofpress/dangerzone/issues/189))
- Development: Use Qt6 in our CI runners and dev environments ([issue #482](https://github.com/freedomofpress/dangerzone/issues/482))
### Removed

View file

@ -64,9 +64,9 @@ RUN apt-get update \
&& apt-get install -y python-all curl wget gnupg2 \
&& rm -rf /var/lib/apt/lists/*
RUN . /etc/os-release \
&& sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' \
&& sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_$VERSION_ID/ /' \
> /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" \
&& wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- \
&& wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_$VERSION_ID/Release.key -O- \
| apt-key add -
"""
@ -89,7 +89,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -y --no-install-recommends dh-python make build-essential \
fakeroot libqt5gui5 pipx python3 python3-dev python3-venv python3-stdeb \
fakeroot {qt_deps} pipx python3 python3-dev python3-venv python3-stdeb \
python3-all \
&& rm -rf /var/lib/apt/lists/*
# NOTE: `pipx install poetry` fails on Ubuntu Focal, when installed through APT. By
@ -108,7 +108,7 @@ RUN apt-get update \
# FIXME: Install Poetry on Fedora via package manager.
DOCKERFILE_BUILD_DEV_FEDORA_DEPS = r"""
RUN dnf install -y rpm-build podman python3 python3-setuptools pipx make qt5-qtbase-gui \
RUN dnf install -y rpm-build podman python3 python3-setuptools pipx make qt6-qtbase-gui \
&& dnf clean all
# FIXME: Drop this fix after it's resolved upstream.
@ -407,16 +407,31 @@ class Env:
"""Build a Linux environment and install tools for Dangerzone development."""
if self.distro == "fedora":
install_deps = DOCKERFILE_BUILD_DEV_FEDORA_DEPS
elif self.distro == "ubuntu" and self.version in ("20.04", "focal"):
else:
# Use Qt6 in all of our Linux dev environments, and add a missing
# libxcb-cursor0 dependency
#
# See https://github.com/freedomofpress/dangerzone/issues/482
qt_deps = "libqt6gui6 libxcb-cursor0"
install_deps = DOCKERFILE_BUILD_DEV_DEBIAN_DEPS
if self.distro == "ubuntu" and self.version in ("20.04", "focal"):
qt_deps = "libqt5gui5 libxcb-cursor0" # Ubuntu Focal has only Qt5.
install_deps = (
DOCKERFILE_UBUNTU_2004_DEPS + DOCKERFILE_BUILD_DEV_DEBIAN_DEPS
)
elif self.distro == "ubuntu" and self.version in ("22.04", "jammy"):
# Ubuntu Jammy misses a dependency to `libxkbcommon-x11-0`, which we can
# install indirectly via `qt6-qpa-plugins`.
qt_deps += " qt6-qpa-plugins"
elif self.distro == "ubuntu" and self.version in ("23.04", "lunar"):
install_deps = (
DOCKERFILE_UBUNTU_2304_REM_USER + DOCKERFILE_BUILD_DEV_DEBIAN_DEPS
)
else:
install_deps = DOCKERFILE_BUILD_DEV_DEBIAN_DEPS
elif self.distro == "debian" and self.version in ("bullseye-backports",):
# Debian Bullseye misses a dependency to libgl1.
qt_deps += " libgl1"
install_deps = install_deps.format(qt_deps=qt_deps)
dockerfile = DOCKERFILE_BUILD_DEV.format(
distro=self.distro, version=self.version, install_deps=install_deps

View file

@ -154,7 +154,7 @@ CONTENT_BUILD_DEBIAN_UBUNTU = r"""## Debian/Ubuntu
Install dependencies:
```sh
sudo apt install -y podman dh-python build-essential fakeroot make libqt5gui5 \
sudo apt install -y podman dh-python build-essential fakeroot make libqt6gui6 \
pipx python3 python3-dev python3-stdeb python3-all
```
@ -210,7 +210,7 @@ CONTENT_BUILD_FEDORA = r"""## Fedora
Install dependencies:
```sh
sudo dnf install -y rpm-build podman python3 pipx qt5-qtbase-gui
sudo dnf install -y rpm-build podman python3 pipx qt6-qtbase-gui
```
Install Poetry using `pipx`: