1# This Source Code Form is subject to the terms of the Mozilla Public 2# License, v. 2.0. If a copy of the MPL was not distributed with this file, 3# You can obtain one at http://mozilla.org/MPL/2.0/. 4 5from __future__ import absolute_import, print_function, unicode_literals 6 7from mozboot.base import BaseBootstrapper 8from mozboot.linux_common import LinuxBootstrapper 9 10 11class CentOSFedoraBootstrapper(LinuxBootstrapper, BaseBootstrapper): 12 def __init__(self, distro, version, dist_id, **kwargs): 13 BaseBootstrapper.__init__(self, **kwargs) 14 15 self.distro = distro 16 self.version = int(version.split(".")[0]) 17 self.dist_id = dist_id 18 19 self.group_packages = [] 20 21 # For CentOS 7, later versions of nodejs come from nodesource 22 # and include the npm package. 23 self.packages = ["nodejs", "which"] 24 25 self.browser_group_packages = ["GNOME Software Development"] 26 27 self.browser_packages = [ 28 "alsa-lib-devel", 29 "dbus-glib-devel", 30 "glibc-static", 31 # Development group. 32 "libstdc++-static", 33 "libXt-devel", 34 "nasm", 35 "pulseaudio-libs-devel", 36 "gcc-c++", 37 ] 38 39 self.mobile_android_packages = [ 40 "java-1.8.0-openjdk-devel", 41 # For downloading the Android SDK and NDK. 42 "wget", 43 ] 44 45 if self.distro in ("centos", "rocky"): 46 self.group_packages += ["Development Tools"] 47 48 self.packages += ["curl-devel"] 49 50 self.browser_packages += ["gtk3-devel"] 51 52 if self.version == 6: 53 self.group_packages += [ 54 "Development Libraries", 55 "GNOME Software Development", 56 ] 57 58 self.packages += ["npm"] 59 60 else: 61 self.packages += ["redhat-rpm-config"] 62 63 self.browser_group_packages = ["Development Tools"] 64 65 elif self.distro == "fedora": 66 self.group_packages += ["C Development Tools and Libraries"] 67 68 self.packages += ["npm", "redhat-rpm-config"] 69 70 self.mobile_android_packages += ["ncurses-compat-libs"] 71 72 if self.distro in ("centos", "rocky") and self.version == 8: 73 self.packages += ["python3-devel"] 74 else: 75 self.packages += ["python-devel"] 76 77 def install_system_packages(self): 78 self.dnf_groupinstall(*self.group_packages) 79 self.dnf_install(*self.packages) 80 81 def install_browser_packages(self, mozconfig_builder): 82 self.ensure_browser_packages() 83 84 def install_browser_artifact_mode_packages(self, mozconfig_builder): 85 self.ensure_browser_packages(artifact_mode=True) 86 87 def install_mobile_android_packages(self, mozconfig_builder): 88 self.ensure_mobile_android_packages(mozconfig_builder, artifact_mode=False) 89 90 def install_mobile_android_artifact_mode_packages(self, mozconfig_builder): 91 self.ensure_mobile_android_packages(mozconfig_builder, artifact_mode=True) 92 93 def ensure_browser_packages(self, artifact_mode=False): 94 # TODO: Figure out what not to install for artifact mode 95 self.dnf_groupinstall(*self.browser_group_packages) 96 self.dnf_install(*self.browser_packages) 97 98 def ensure_mobile_android_packages(self, mozconfig_builder, artifact_mode=False): 99 # Install Android specific packages. 100 self.dnf_install(*self.mobile_android_packages) 101 102 self.ensure_java(mozconfig_builder) 103 super().ensure_mobile_android_packages(artifact_mode=artifact_mode) 104 105 def upgrade_mercurial(self, current): 106 if current is None: 107 self.dnf_install("mercurial") 108 else: 109 self.dnf_update("mercurial") 110