0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-22 05:33:03 -05:00
LibreWolf/patches/tumbleweed-bootstrap.patch

175 lines
6.3 KiB
Diff
Raw Permalink Normal View History

2022-07-25 10:24:43 -05:00
diff --git a/python/mozboot/mozboot/base.py b/python/mozboot/mozboot/base.py
index 6921964..bc8dafd 100644
--- a/python/mozboot/mozboot/base.py
+++ b/python/mozboot/mozboot/base.py
@@ -50,6 +50,22 @@ If it continues to fail, consider installing Mercurial by following the
instructions at http://mercurial.selenic.com/.
"""
+MERCURIAL_INSTALL_PROMPT = """
+Mercurial releases a new version every 3 months and your distro's package
+may become out of date. This may cause incompatibility with some
+Mercurial extensions that rely on new Mercurial features. As a result,
+you may not have an optimal version control experience.
+
+To have the best Mercurial experience possible, we recommend installing
+Mercurial via the "pip" Python packaging utility. This will likely result
+in files being placed in /usr/local/bin and /usr/local/lib.
+
+How would you like to continue?
+ 1. Install a modern Mercurial via pip [default]
+ 2. Install a legacy Mercurial via the distro package manager
+ 3. Do not install Mercurial
+Your choice: """
+
PYTHON_UNABLE_UPGRADE = """
You are currently running Python %s. Running %s or newer (but
not 3.x) is required.
diff --git a/python/mozboot/mozboot/opensuse.py b/python/mozboot/mozboot/opensuse.py
index d5ab72e..4aa89b6 100644
2022-07-19 08:39:37 -05:00
--- a/python/mozboot/mozboot/opensuse.py
+++ b/python/mozboot/mozboot/opensuse.py
2022-07-25 10:24:43 -05:00
@@ -4,9 +4,11 @@
2022-07-21 09:07:17 -05:00
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."""
2022-07-25 10:24:43 -05:00
@@ -17,6 +19,7 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
"rpmconf",
"watchman",
"which",
2022-07-19 08:39:37 -05:00
+ "unzip",
]
BROWSER_PACKAGES = [
2022-07-25 10:24:43 -05:00
@@ -24,7 +27,6 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
2022-07-19 08:39:37 -05:00
"gcc-c++",
"gtk3-devel",
"dbus-1-glib-devel",
- "gconf2-devel",
"glibc-devel-static",
"libstdc++-devel",
"libXt-devel",
2022-07-25 10:24:43 -05:00
@@ -34,6 +36,10 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
2022-07-21 09:07:17 -05:00
"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"]
2022-07-25 10:24:43 -05:00
@@ -47,7 +53,18 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
2022-07-21 09:07:17 -05:00
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()
2022-07-25 10:24:43 -05:00
@@ -55,10 +72,6 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
2022-07-21 09:07:17 -05:00
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
2022-07-25 10:24:43 -05:00
@@ -92,35 +105,51 @@ class OpenSUSEBootstrapper(LinuxBootstrapper, BaseBootstrapper):
2022-07-21 09:07:17 -05:00
)
def _update_package_manager(self):
- self.zypper_update
+ self.zypper_update()
2022-07-19 08:39:37 -05:00
2022-07-21 09:07:17 -05:00
def upgrade_mercurial(self, current):
- self(["pip3", "install", "--upgrade", "pip", "--user"])
- self(["pip3", "install", "--upgrade", "Mercurial", "--user"])
-
2022-07-19 08:39:37 -05:00
- def zypper_install(self, *packages):
- command = ["zypper", "install"]
2022-07-21 09:07:17 -05:00
+ """Install Mercurial from pip because system packages could lag."""
2022-07-19 08:39:37 -05:00
if self.no_interactive:
- command.append("-n")
2022-07-21 09:07:17 -05:00
+ # 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
2022-07-19 08:39:37 -05:00
- command.extend(packages)
2022-07-21 09:07:17 -05:00
+ res = self.prompt_int(MERCURIAL_INSTALL_PROMPT, 1, 3)
2022-07-19 08:39:37 -05:00
2022-07-21 09:07:17 -05:00
- self.run_as_root(command)
+ # zypper.
+ if res == 2:
+ self.zypper_install("mercurial")
+ return False
2022-07-19 08:39:37 -05:00
- def zypper_update(self, *packages):
- command = ["zypper", "update"]
- if self.no_interactive:
- command.append("-n")
2022-07-21 09:07:17 -05:00
+ # No Mercurial.
+ if res == 3:
+ print("Not installing Mercurial.")
+ return False
2022-07-25 10:24:43 -05:00
- command.extend(packages)
2022-07-21 09:07:17 -05:00
+ # pip.
+ assert res == 1
+ self.run_as_root(["pip3", "install", "--upgrade", "Mercurial"])
2022-07-25 10:24:43 -05:00
+
2022-07-21 09:07:17 -05:00
+ def zypper(self, *args):
+ if self.no_interactive:
+ command = ["zypper", "-n", *args]
+ else:
+ command = ["zypper", *args]
2022-07-19 08:39:37 -05:00
2022-07-21 09:07:17 -05:00
self.run_as_root(command)
2022-07-19 08:39:37 -05:00
2022-07-21 09:07:17 -05:00
- def zypper_patterninstall(self, *packages):
2022-07-19 08:39:37 -05:00
- command = ["zypper", "install", "-t", "pattern"]
- if self.no_interactive:
- command.append("-y")
2022-07-21 09:07:17 -05:00
+ def zypper_install(self, *packages):
+ self.zypper("install", *packages)
2022-07-19 08:39:37 -05:00
- command.extend(packages)
2022-07-21 09:07:17 -05:00
+ def zypper_can_install(self, package):
+ return (
+ subprocess.call(["zypper", "search", package], stdout=subprocess.DEVNULL)
+ == 0
+ )
2022-07-19 08:39:37 -05:00
- self.run_as_root(command)
2022-07-21 09:07:17 -05:00
+ def zypper_update(self, *packages):
+ self.zypper("update", *packages)
+
+ def zypper_patterninstall(self, *packages):
2022-07-19 08:39:37 -05:00
+ self.zypper("install", "-t", "pattern", *packages)