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.
This commit is contained in:
Martin Robinson 2024-02-07 15:21:34 +01:00 committed by GitHub
parent b62d169f0f
commit 38b11afb22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 10 deletions

View file

@ -55,9 +55,9 @@ class Base:
return False return False
def bootstrap(self, force: bool): 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.install_crown(force)
installed_something |= self._platform_bootstrap(force)
if not installed_something: if not installed_something:
print("Dependencies were already installed!") print("Dependencies were already installed!")

View file

@ -153,15 +153,17 @@ class Linux(Base):
def install_non_gstreamer_dependencies(self, force: bool) -> bool: def install_non_gstreamer_dependencies(self, force: bool) -> bool:
install = False install = False
pkgs = [] pkgs = []
if self.distro in ['Ubuntu', 'Raspbian GNU/Linux']: if self.distro in ['Ubuntu', 'Debian GNU/Linux', 'Raspbian GNU/Linux']:
command = ['apt-get', 'install'] command = ['apt-get', 'install', "-m"]
pkgs = APT_PKGS pkgs = APT_PKGS
if subprocess.call(['dpkg', '-s'] + pkgs, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: # Try to filter out unknown packages from the list. This is important for Debian
install = True # as it does not ship all of the packages we want.
elif self.distro == 'Debian GNU/Linux': installable = subprocess.check_output(['apt-cache', '--generate', 'pkgnames'])
command = ['apt-get', 'install'] if installable:
pkgs = [pkg for pkg in APT_PKGS if pkg != 'libgstreamer-plugins-good1.0-dev'] installable = installable.decode("ascii").splitlines()
pkgs = list(filter(lambda pkg: pkg in installable, pkgs))
if subprocess.call(['dpkg', '-s'] + pkgs, shell=True, if subprocess.call(['dpkg', '-s'] + pkgs, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0: stdout=subprocess.PIPE, stderr=subprocess.PIPE) != 0:
install = True install = True