From 26cf3db4b42a49a8141de8a1dfff8f283a32772d Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Mon, 24 Jul 2023 10:20:08 +0300 Subject: [PATCH] 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 --- .circleci/config.yml | 2 +- BUILD.md | 6 +++--- CHANGELOG.md | 1 + dev_scripts/env.py | 39 +++++++++++++++++++++++++++------------ dev_scripts/qa.py | 4 ++-- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dd08b69..05f084a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: | diff --git a/BUILD.md b/BUILD.md index 2bd6d9c..f8494b6 100644 --- a/BUILD.md +++ b/BUILD.md @@ -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* ``` diff --git a/CHANGELOG.md b/CHANGELOG.md index ec7395a..9f4f9a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/dev_scripts/env.py b/dev_scripts/env.py index ba33dfd..c82b7b6 100755 --- a/dev_scripts/env.py +++ b/dev_scripts/env.py @@ -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"): - install_deps = ( - DOCKERFILE_UBUNTU_2004_DEPS + DOCKERFILE_BUILD_DEV_DEBIAN_DEPS - ) - elif self.distro == "ubuntu" and self.version in ("23.04", "lunar"): - install_deps = ( - DOCKERFILE_UBUNTU_2304_REM_USER + DOCKERFILE_BUILD_DEV_DEBIAN_DEPS - ) 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 + ) + 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 diff --git a/dev_scripts/qa.py b/dev_scripts/qa.py index 10d45a1..424fd00 100755 --- a/dev_scripts/qa.py +++ b/dev_scripts/qa.py @@ -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`: