mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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>
This commit is contained in:
parent
35ca050bfb
commit
c9548d82ef
1 changed files with 7 additions and 4 deletions
|
@ -57,7 +57,7 @@ DNF_PKGS = ['libtool', 'gcc-c++', 'libXi-devel', 'freetype-devel',
|
||||||
'gstreamer1-devel', 'gstreamer1-plugins-base-devel',
|
'gstreamer1-devel', 'gstreamer1-plugins-base-devel',
|
||||||
'gstreamer1-plugins-good', 'gstreamer1-plugins-bad-free-devel',
|
'gstreamer1-plugins-good', 'gstreamer1-plugins-bad-free-devel',
|
||||||
'gstreamer1-plugins-ugly-free', 'libjpeg-turbo-devel',
|
'gstreamer1-plugins-ugly-free', 'libjpeg-turbo-devel',
|
||||||
'zlib', 'libjpeg', 'vulkan-loader', 'libxkbcommon',
|
'zlib-ng', 'libjpeg-turbo', 'vulkan-loader', 'libxkbcommon',
|
||||||
'libxkbcommon-x11']
|
'libxkbcommon-x11']
|
||||||
|
|
||||||
# https://voidlinux.org/packages/
|
# https://voidlinux.org/packages/
|
||||||
|
@ -181,11 +181,14 @@ class Linux(Base):
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
|
||||||
install = True
|
install = True
|
||||||
elif self.distro in ['CentOS', 'CentOS Linux', 'Fedora', 'Fedora Linux', 'Fedora Linux Asahi Remix']:
|
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
|
pkgs = DNF_PKGS
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
command = ['dnf', 'install']
|
if pkg not in installed_pkgs:
|
||||||
if "|{}".format(pkg) not in installed_pkgs:
|
|
||||||
install = True
|
install = True
|
||||||
break
|
break
|
||||||
elif self.distro == 'void':
|
elif self.distro == 'void':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue