diff options
author | Jonathan Schwender <55576758+jschwe@users.noreply.github.com> | 2024-09-02 08:56:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 06:56:38 +0000 |
commit | c9548d82efc5568ec66f67940b543f4709ceb152 (patch) | |
tree | 42855a0312681bf1243628a9b247f1488e96a85b /python/servo | |
parent | 35ca050bfb82b27cac0fe142768a4876759fced0 (diff) | |
download | servo-c9548d82efc5568ec66f67940b543f4709ceb152.tar.gz servo-c9548d82efc5568ec66f67940b543f4709ceb152.zip |
bootstrap: Avoid needless sudo when pkgs are installed (#33281)
- Previously on fedora `./mach bootstrap` would always detect it needs to
reinstall packages and require root permissions.
- use custom queryformat for `rpm -qa` to to just get the package name
(e.g. `openssl-libs` instead of `openssl-libs-3.2.2-3.fc40.i686`
- Use a list to store the output result instead of one string
- Fedora (40) installs `zlib-ng` instead of `zlib` and `libjpeg-turbo` instead
of `libjpeg`, meaning that `rpm` / dnf commands report `zlib` as not installed.
Specifying the actually installed package avoids this problem.
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Diffstat (limited to 'python/servo')
-rw-r--r-- | python/servo/platform/linux.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/servo/platform/linux.py b/python/servo/platform/linux.py index 1397a4f16de..41ec851de83 100644 --- a/python/servo/platform/linux.py +++ b/python/servo/platform/linux.py @@ -57,7 +57,7 @@ DNF_PKGS = ['libtool', 'gcc-c++', 'libXi-devel', 'freetype-devel', 'gstreamer1-devel', 'gstreamer1-plugins-base-devel', 'gstreamer1-plugins-good', 'gstreamer1-plugins-bad-free-devel', 'gstreamer1-plugins-ugly-free', 'libjpeg-turbo-devel', - 'zlib', 'libjpeg', 'vulkan-loader', 'libxkbcommon', + 'zlib-ng', 'libjpeg-turbo', 'vulkan-loader', 'libxkbcommon', 'libxkbcommon-x11'] # https://voidlinux.org/packages/ @@ -181,11 +181,14 @@ class Linux(Base): stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: install = True elif self.distro in ['CentOS', 'CentOS Linux', 'Fedora', 'Fedora Linux', 'Fedora Linux Asahi Remix']: - installed_pkgs = str(subprocess.check_output(['rpm', '-qa'])).replace('\n', '|') + command = ['dnf', 'install'] + installed_pkgs: [str] = ( + subprocess.check_output(['rpm', '--query', '--all', '--queryformat', '%{NAME}\n'], + encoding='utf-8') + .split('\n')) pkgs = DNF_PKGS for pkg in pkgs: - command = ['dnf', 'install'] - if "|{}".format(pkg) not in installed_pkgs: + if pkg not in installed_pkgs: install = True break elif self.distro == 'void': |