mirror of
https://codeberg.org/librewolf/source.git
synced 2024-12-22 05:33:03 -05:00
150 lines
5 KiB
Diff
150 lines
5 KiB
Diff
--- a/python/mozboot/mozboot/opensuse.py
|
|
+++ b/python/mozboot/mozboot/opensuse.py
|
|
@@ -4,18 +4,22 @@
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
-from mozboot.base import BaseBootstrapper
|
|
+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."""
|
|
|
|
SYSTEM_PACKAGES = [
|
|
- "which",
|
|
- "rpmconf",
|
|
"libcurl-devel",
|
|
"libpulse-devel",
|
|
+ "rpmconf",
|
|
+ "which",
|
|
+ "unzip",
|
|
]
|
|
|
|
BROWSER_PACKAGES = [
|
|
@@ -23,7 +27,6 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
|
|
"gcc-c++",
|
|
"gtk3-devel",
|
|
"dbus-1-glib-devel",
|
|
- "gconf2-devel",
|
|
"glibc-devel-static",
|
|
"libstdc++-devel",
|
|
"libXt-devel",
|
|
@@ -33,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"]
|
|
@@ -46,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 {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()
|
|
@@ -54,10 +72,6 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
|
|
def install_browser_artifact_mode_packages(self, mozconfig_builder):
|
|
self.install_browser_packages(mozconfig_builder, artifact_mode=True)
|
|
|
|
- def install_mercurial(self):
|
|
- self(["pip", "install", "--upgrade", "pip", "--user"])
|
|
- self(["pip", "install", "--upgrade", "Mercurial", "--user"])
|
|
-
|
|
def ensure_clang_static_analysis_package(self):
|
|
from mozboot import static_analysis
|
|
|
|
@@ -91,35 +105,51 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
|
|
)
|
|
|
|
def _update_package_manager(self):
|
|
- self.zypper_update
|
|
+ self.zypper_update()
|
|
|
|
def upgrade_mercurial(self, current):
|
|
- self(["pip3", "install", "--upgrade", "pip", "--user"])
|
|
- self(["pip3", "install", "--upgrade", "Mercurial", "--user"])
|
|
-
|
|
- def zypper_install(self, *packages):
|
|
- command = ["zypper", "install"]
|
|
+ """Install Mercurial from pip because system packages could lag."""
|
|
if self.no_interactive:
|
|
- command.append("-n")
|
|
+ # Install via zypper in non-interactive mode because it is the more
|
|
+ # conservative option and less likely to make people upset.
|
|
+ self.zypper_install("mercurial")
|
|
+ return
|
|
|
|
- command.extend(packages)
|
|
+ res = self.prompt_int(MERCURIAL_INSTALL_PROMPT, 1, 3)
|
|
|
|
- self.run_as_root(command)
|
|
+ # zypper.
|
|
+ if res == 2:
|
|
+ self.zypper_install("mercurial")
|
|
+ return False
|
|
|
|
- def zypper_update(self, *packages):
|
|
- command = ["zypper", "update"]
|
|
- if self.no_interactive:
|
|
- command.append("-n")
|
|
+ # No Mercurial.
|
|
+ if res == 3:
|
|
+ print("Not installing Mercurial.")
|
|
+ return False
|
|
+
|
|
+ # pip.
|
|
+ assert res == 1
|
|
+ self.run_as_root(["pip3", "install", "--upgrade", "Mercurial"])
|
|
|
|
- command.extend(packages)
|
|
+ def zypper(self, *args):
|
|
+ if self.no_interactive:
|
|
+ command = ["zypper", "-n", *args]
|
|
+ else:
|
|
+ command = ["zypper", *args]
|
|
|
|
self.run_as_root(command)
|
|
|
|
- def zypper_patterninstall(self, *packages):
|
|
- command = ["zypper", "install", "-t", "pattern"]
|
|
- if self.no_interactive:
|
|
- command.append("-y")
|
|
+ def zypper_install(self, *packages):
|
|
+ self.zypper("install", *packages)
|
|
|
|
- command.extend(packages)
|
|
+ def zypper_can_install(self, package):
|
|
+ return (
|
|
+ subprocess.call(["zypper", "search", package], stdout=subprocess.DEVNULL)
|
|
+ == 0
|
|
+ )
|
|
|
|
- self.run_as_root(command)
|
|
+ def zypper_update(self, *packages):
|
|
+ self.zypper("update", *packages)
|
|
+
|
|
+ def zypper_patterninstall(self, *packages):
|
|
+ self.zypper("install", "-t", "pattern", *packages)
|