Bug 1169089 - Merge CentOS and Fedora bootstrap code; r=gps
authorSambuddha Basu <sambuddhabasu1@gmail.com>
Thu, 25 Feb 2016 11:11:39 -0800
changeset 321960 da75e05b8efec6676e27fa455c7052ffa764ac36
parent 321959 6016ec1621375c1d2de9b493e133d8bf052d5d71
child 321961 ead11416e86791968d7b845f902e40a24cd5acd8
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1169089
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1169089 - Merge CentOS and Fedora bootstrap code; r=gps DONTBUILD (NPOTB) MozReview-Commit-ID: 6WDykc20TKf
python/mozboot/mozboot/bootstrap.py
python/mozboot/mozboot/centos.py
python/mozboot/mozboot/centosfedora.py
python/mozboot/mozboot/fedora.py
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -6,19 +6,18 @@
 from __future__ import print_function
 
 import platform
 import sys
 import os.path
 
 # Don't forgot to add new mozboot modules to the bootstrap download
 # list in bin/bootstrap.py!
-from mozboot.centos import CentOSBootstrapper
+from mozboot.centosfedora import CentOSFedoraBootstrapper
 from mozboot.debian import DebianBootstrapper
-from mozboot.fedora import FedoraBootstrapper
 from mozboot.freebsd import FreeBSDBootstrapper
 from mozboot.gentoo import GentooBootstrapper
 from mozboot.osx import OSXBootstrapper
 from mozboot.openbsd import OpenBSDBootstrapper
 from mozboot.archlinux import ArchlinuxBootstrapper
 
 APPLICATION_CHOICE = '''
 Please choose the version of Firefox you want to build:
@@ -73,22 +72,21 @@ class Bootstrapper(object):
         self.finished = finished
         self.choice = choice
         cls = None
         args = {'no_interactive': no_interactive}
 
         if sys.platform.startswith('linux'):
             distro, version, dist_id = platform.linux_distribution()
 
-            if distro in ('CentOS', 'CentOS Linux'):
-                cls = CentOSBootstrapper
+            if distro in ('CentOS', 'CentOS Linux', 'Fedora'):
+                cls = CentOSFedoraBootstrapper
+                args['distro'] = distro
             elif distro in DEBIAN_DISTROS:
                 cls = DebianBootstrapper
-            elif distro == 'Fedora':
-                cls = FedoraBootstrapper
             elif distro == 'Gentoo Base System':
                 cls = GentooBootstrapper
             elif os.path.exists('/etc/arch-release'):
                 # Even on archlinux, platform.linux_distribution() returns ['','','']
                 cls = ArchlinuxBootstrapper
             else:
                 raise NotImplementedError('Bootstrap support for this Linux '
                                           'distro not yet available.')
deleted file mode 100644
--- a/python/mozboot/mozboot/centos.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import platform
-
-
-from mozboot.base import BaseBootstrapper
-
-
-class CentOSBootstrapper(BaseBootstrapper):
-    def __init__(self, version, dist_id, **kwargs):
-        BaseBootstrapper.__init__(self, **kwargs)
-
-        self.version = version
-        self.dist_id = dist_id
-
-        self.group_packages = [
-            'Development Tools',
-            'Development Libraries',
-            'GNOME Software Development',
-        ]
-
-        self.packages = [
-            'autoconf213',
-            'curl-devel',
-            'mercurial',
-        ]
-
-        self.browser_group_packages = [
-            'GNOME Software Development',
-        ]
-
-        self.browser_packages = [
-            'alsa-lib-devel',
-            'dbus-glib-devel',
-            'GConf2-devel',
-            'glibc-static',
-            'gtk2-devel',
-            'gtk3-devel',
-            'libstdc++-static',
-            'libXt-devel',
-            'mesa-libGL-devel',
-            'pulseaudio-libs-devel',
-            'wireless-tools-devel',
-            'yasm',
-        ]
-
-    def install_system_packages(self):
-        self.dnf_groupinstall(*self.group_packages)
-        self.dnf_install(*self.packages)
-
-    def install_browser_packages(self):
-        self.dnf_groupinstall(*self.browser_group_packages)
-        self.dnf_install(*self.browser_packages)
-
-        yasm = 'http://pkgs.repoforge.org/yasm/yasm-1.1.0-1.el6.rf.i686.rpm'
-        if platform.architecture()[0] == '64bit':
-            yasm = 'http://pkgs.repoforge.org/yasm/yasm-1.1.0-1.el6.rf.x86_64.rpm'
-
-        self.run_as_root(['rpm', '-ivh', yasm])
-
-    def upgrade_mercurial(self, current):
-        self.dnf_update('mercurial')
new file mode 100644
--- /dev/null
+++ b/python/mozboot/mozboot/centosfedora.py
@@ -0,0 +1,125 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import os
+import platform
+
+from mozboot.base import BaseBootstrapper
+
+
+class CentOSFedoraBootstrapper(BaseBootstrapper):
+    def __init__(self, distro, version, dist_id, **kwargs):
+        BaseBootstrapper.__init__(self, **kwargs)
+
+        self.distro = distro
+        self.version = version
+        self.dist_id = dist_id
+
+        self.group_packages = []
+
+        self.packages = [
+            'autoconf213',
+            'mercurial',
+        ]
+
+        self.browser_group_packages = [
+            'GNOME Software Development',
+        ]
+
+        self.browser_packages = [
+            'alsa-lib-devel',
+            'GConf2-devel',
+            'glibc-static',
+            'gtk2-devel',  # It is optional in Fedora 20's GNOME Software
+                           # Development group.
+            'libstdc++-static',
+            'libXt-devel',
+            'mesa-libGL-devel',
+            'pulseaudio-libs-devel',
+            'wireless-tools-devel',
+            'yasm',
+        ]
+
+        self.mobile_android_packages = []
+
+        if self.distro in ('CentOS', 'CentOS Linux'):
+            self.group_packages += [
+                'Development Tools',
+                'Development Libraries',
+                'GNOME Software Development',
+            ]
+
+            self.packages += [
+                'curl-devel',
+            ]
+
+            self.browser_packages += [
+                'dbus-glib-devel',
+                'gtk3-devel',
+            ]
+
+        elif self.distro == 'Fedora':
+            self.group_packages += [
+                'C Development Tools and Libraries',
+            ]
+
+            self.packages += [
+                'python2-devel',
+            ]
+
+            self.browser_packages += [
+                'gcc-c++',
+            ]
+
+            self.mobile_android_packages += [
+                'ncurses-devel.i686',
+                'libstdc++.i686',
+                'zlib-devel.i686',
+            ]
+
+    def install_system_packages(self):
+        self.dnf_groupinstall(*self.group_packages)
+        self.dnf_install(*self.packages)
+
+    def install_browser_packages(self):
+        self.dnf_groupinstall(*self.browser_group_packages)
+        self.dnf_install(*self.browser_packages)
+
+        if self.distro in ('CentOS', 'CentOS Linux'):
+            yasm = 'http://pkgs.repoforge.org/yasm/yasm-1.1.0-1.el6.rf.i686.rpm'
+            if platform.architecture()[0] == '64bit':
+                yasm = 'http://pkgs.repoforge.org/yasm/yasm-1.1.0-1.el6.rf.x86_64.rpm'
+
+            self.run_as_root(['rpm', '-ivh', yasm])
+
+    def install_mobile_android_packages(self):
+        if self.distro in ('CentOS', 'CentOS Linux'):
+            BaseBootstrapper.install_mobile_android_packages(self)
+        elif self.distro == 'Fedora':
+            self.install_fedora_mobile_android_packages()
+
+    def install_fedora_mobile_android_packages(self):
+        import android
+
+        # Install Android specific packages.
+        self.dnf_install(*self.mobile_android_packages)
+
+        # Fetch Android SDK and NDK.
+        mozbuild_path = os.environ.get('MOZBUILD_STATE_PATH', os.path.expanduser(os.path.join('~', '.mozbuild')))
+        self.sdk_path = os.environ.get('ANDROID_SDK_HOME', os.path.join(mozbuild_path, 'android-sdk-linux'))
+        self.ndk_path = os.environ.get('ANDROID_NDK_HOME', os.path.join(mozbuild_path, 'android-ndk-r10e'))
+        self.sdk_url = 'https://dl.google.com/android/android-sdk_r24.0.1-linux.tgz'
+        self.ndk_url = android.android_ndk_url('linux')
+
+        android.ensure_android_sdk_and_ndk(path=mozbuild_path,
+                                           sdk_path=self.sdk_path, sdk_url=self.sdk_url,
+                                           ndk_path=self.ndk_path, ndk_url=self.ndk_url)
+
+    def suggest_mobile_android_mozconfig(self):
+        import android
+        android.suggest_mozconfig(sdk_path=self.sdk_path,
+                                  ndk_path=self.ndk_path)
+
+    def upgrade_mercurial(self):
+        self.dnf_update('mercurial')
deleted file mode 100644
--- a/python/mozboot/mozboot/fedora.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import os
-
-from mozboot.base import BaseBootstrapper
-
-
-class FedoraBootstrapper(BaseBootstrapper):
-    def __init__(self, version, dist_id, **kwargs):
-        BaseBootstrapper.__init__(self, **kwargs)
-
-        self.version = version
-        self.dist_id = dist_id
-
-        self.group_packages = [
-            'C Development Tools and Libraries',
-        ]
-
-        self.packages = [
-            'autoconf213',
-            'mercurial',
-            'python2-devel',
-        ]
-
-        self.browser_group_packages = [
-            'GNOME Software Development',
-        ]
-
-        self.browser_packages = [
-            'alsa-lib-devel',
-            'gcc-c++',
-            'GConf2-devel',
-            'glibc-static',
-            'gtk2-devel',  # it's optional in Fedora 20's GNOME Software
-                           # Development group.
-            'libstdc++-static',
-            'libXt-devel',
-            'mesa-libGL-devel',
-            'pulseaudio-libs-devel',
-            'wireless-tools-devel',
-            'yasm',
-        ]
-
-        self.mobile_android_packages = [
-            'ncurses-devel.i686',
-            'libstdc++.i686',
-            'zlib-devel.i686',
-        ]
-
-    def install_system_packages(self):
-        self.dnf_groupinstall(*self.group_packages)
-        self.dnf_install(*self.packages)
-
-    def install_browser_packages(self):
-        self.dnf_groupinstall(*self.browser_group_packages)
-        self.dnf_install(*self.browser_packages)
-
-    def install_mobile_android_packages(self):
-        import android
-
-        # Install Android specific packages.
-        self.dnf_install(*self.mobile_android_packages)
-
-        # Fetch Android SDK and NDK.
-        mozbuild_path = os.environ.get('MOZBUILD_STATE_PATH', os.path.expanduser(os.path.join('~', '.mozbuild')))
-        self.sdk_path = os.environ.get('ANDROID_SDK_HOME', os.path.join(mozbuild_path, 'android-sdk-linux'))
-        self.ndk_path = os.environ.get('ANDROID_NDK_HOME', os.path.join(mozbuild_path, 'android-ndk-r10e'))
-        self.sdk_url = 'https://dl.google.com/android/android-sdk_r24.0.1-linux.tgz'
-        self.ndk_url = android.android_ndk_url('linux')
-
-        android.ensure_android_sdk_and_ndk(path=mozbuild_path,
-                                           sdk_path=self.sdk_path, sdk_url=self.sdk_url,
-                                           ndk_path=self.ndk_path, ndk_url=self.ndk_url)
-
-    def suggest_mobile_android_mozconfig(self):
-        import android
-        android.suggest_mozconfig(sdk_path=self.sdk_path,
-                                  ndk_path=self.ndk_path)
-
-    def upgrade_mercurial(self, current):
-        self.dnf_update('mercurial')