Bug 1779931 - Make installing `gconf2-devel` during openSUSE bootstrap optional r=ahochheiden

- Added the variable `OPTIONAL_BROWSER_PACKAGES`, which contains
  a list of packages which should, if possible, be installed with
  zypper. If that isn't possible because the package can't be
  found, just display a warning and continue.
- Add `gconf2-devel` to `OPTIONAL_BROWSER_PACKAGES`, since
  gconf2-devel is not available in Tumbleweed repos and also
  not required to build Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D152217
This commit is contained in:
Malte Jürgens 2022-10-04 16:38:55 +00:00
Родитель f593e162fd
Коммит de658cd08f
1 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -7,6 +7,9 @@ from __future__ import absolute_import, print_function, unicode_literals
from mozboot.base import BaseBootstrapper, MERCURIAL_INSTALL_PROMPT
from mozboot.linux_common import LinuxBootstrapper
import distro
import subprocess
class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
"""openSUSE experimental bootstrapper."""
@ -24,7 +27,6 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
"gcc-c++",
"gtk3-devel",
"dbus-1-glib-devel",
"gconf2-devel",
"glibc-devel-static",
"libstdc++-devel",
"libXt-devel",
@ -34,6 +36,10 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
"patterns-gnome-devel_gnome",
]
OPTIONAL_BROWSER_PACKAGES = [
"gconf2-devel", # https://bugzilla.mozilla.org/show_bug.cgi?id=1779931
]
BROWSER_GROUP_PACKAGES = ["devel_C_C++", "devel_gnome"]
MOBILE_ANDROID_COMMON_PACKAGES = ["java-1_8_0-openjdk"]
@ -47,7 +53,18 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
def install_browser_packages(self, mozconfig_builder, artifact_mode=False):
# TODO: Figure out what not to install for artifact mode
self.zypper_install(*self.BROWSER_PACKAGES)
packages_to_install = self.BROWSER_PACKAGES.copy()
for package in self.OPTIONAL_BROWSER_PACKAGES:
if self.zypper_can_install(package):
packages_to_install.append(package)
else:
print(
f"WARNING! zypper cannot find a package for '{package}' for "
f"{distro.name(True)}. It will not be automatically installed."
)
self.zypper_install(*packages_to_install)
def install_browser_group_packages(self):
self.ensure_browser_group_packages()
@ -125,6 +142,12 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
def zypper_install(self, *packages):
self.zypper("install", *packages)
def zypper_can_install(self, package):
return (
subprocess.call(["zypper", "search", package], stdout=subprocess.DEVNULL)
== 0
)
def zypper_update(self, *packages):
self.zypper("update", *packages)