diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-02-07 15:21:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-07 14:21:34 +0000 |
commit | 38b11afb22b31002200d02e955e969bcda9c121c (patch) | |
tree | 94c6cd0eebb1be5f8f09abb3a425de4b17c5fce4 /python | |
parent | b62d169f0f2b31d87dcfe0fd20389e26e89d4269 (diff) | |
download | servo-38b11afb22b31002200d02e955e969bcda9c121c.tar.gz servo-38b11afb22b31002200d02e955e969bcda9c121c.zip |
bootstrap: More resiliently install Deiban-like platform dependencies (#31281)
1. First check to see if a package is available before trying to install
it. This means that we always do our best to install everything, but
don't fail if we cannot.
2. Install crown and taplo first. This means that if the
platform-specific bits fail, we still install Servo-specific
dependencies.
Diffstat (limited to 'python')
-rw-r--r-- | python/servo/platform/base.py | 4 | ||||
-rw-r--r-- | python/servo/platform/linux.py | 18 |
2 files changed, 12 insertions, 10 deletions
diff --git a/python/servo/platform/base.py b/python/servo/platform/base.py index e6d3e955cda..cb0c1be527b 100644 --- a/python/servo/platform/base.py +++ b/python/servo/platform/base.py @@ -55,9 +55,9 @@ class Base: return False def bootstrap(self, force: bool): - installed_something = self._platform_bootstrap(force) - installed_something |= self.install_taplo(force) + installed_something = self.install_taplo(force) installed_something |= self.install_crown(force) + installed_something |= self._platform_bootstrap(force) if not installed_something: print("Dependencies were already installed!") diff --git a/python/servo/platform/linux.py b/python/servo/platform/linux.py index b895a0aa08c..879e8f45926 100644 --- a/python/servo/platform/linux.py +++ b/python/servo/platform/linux.py @@ -153,15 +153,17 @@ class Linux(Base): def install_non_gstreamer_dependencies(self, force: bool) -> bool: install = False pkgs = [] - if self.distro in ['Ubuntu', 'Raspbian GNU/Linux']: - command = ['apt-get', 'install'] + if self.distro in ['Ubuntu', 'Debian GNU/Linux', 'Raspbian GNU/Linux']: + command = ['apt-get', 'install', "-m"] pkgs = APT_PKGS - if subprocess.call(['dpkg', '-s'] + pkgs, shell=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: - install = True - elif self.distro == 'Debian GNU/Linux': - command = ['apt-get', 'install'] - pkgs = [pkg for pkg in APT_PKGS if pkg != 'libgstreamer-plugins-good1.0-dev'] + + # Try to filter out unknown packages from the list. This is important for Debian + # as it does not ship all of the packages we want. + installable = subprocess.check_output(['apt-cache', '--generate', 'pkgnames']) + if installable: + installable = installable.decode("ascii").splitlines() + pkgs = list(filter(lambda pkg: pkg in installable, pkgs)) + if subprocess.call(['dpkg', '-s'] + pkgs, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: install = True |