Bug 1117357 - Fix |mach bootstrap| for mobile/android on Mac OS X. r=gps
authorNick Alexander <nalexander@mozilla.com>
Thu, 08 Jan 2015 13:47:42 -0800
changeset 249037 748361b75b03ba734fe5aebf265731eec98aa960
parent 249036 42f2ce6de0c7fba747246e45df43eaeb945ba5f7
child 249038 8fbee3ef525f27acdd79aaeac834eea5f5d8cf6b
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1117357
milestone37.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 1117357 - Fix |mach bootstrap| for mobile/android on Mac OS X. r=gps This does two things. First, it aligns the brew formula name (AndroidNdk) with the brew file name (android-ndk.rb). Second, it makes sure that we actually find the android-ndk.rb file. I think |mach bootstrap| always worked, due to a felicity where the working directory always contained android-ndk.rb; but |python bootstrap.py| failed because android-ndk.rb was downloaded to a temporary location that was not included in the |brew install| command.
python/mozboot/bin/bootstrap.py
python/mozboot/mozboot/android-ndk-r8e.rb
python/mozboot/mozboot/android-ndk.rb
python/mozboot/mozboot/osx.py
--- a/python/mozboot/bin/bootstrap.py
+++ b/python/mozboot/bin/bootstrap.py
@@ -27,17 +27,17 @@ from optparse import OptionParser
 
 # The next two variables define where in the repository the Python files
 # reside. This is used to remotely download file content when it isn't
 # available locally.
 REPOSITORY_PATH_PREFIX = 'python/mozboot'
 
 REPOSITORY_PATHS = [
     'mozboot/__init__.py',
-    'mozboot/android-ndk-r8e.rb',
+    'mozboot/android-ndk.rb',
     'mozboot/android.py',
     'mozboot/base.py',
     'mozboot/bootstrap.py',
     'mozboot/centos.py',
     'mozboot/debian.py',
     'mozboot/fedora.py',
     'mozboot/freebsd.py',
     'mozboot/gentoo.py',
rename from python/mozboot/mozboot/android-ndk-r8e.rb
rename to python/mozboot/mozboot/android-ndk.rb
--- a/python/mozboot/mozboot/android-ndk-r8e.rb
+++ b/python/mozboot/mozboot/android-ndk.rb
@@ -1,10 +1,14 @@
 require "formula"
 
+# This is an antiquated version pinned to NDK revision r8e.  That's
+# the revision Mozilla's automation currently uses.  We could push
+# this to https://github.com/Homebrew/homebrew-versions if there's a
+# problem shipping it locally.
 class AndroidNdk < Formula
   homepage "http://developer.android.com/sdk/ndk/index.html"
 
   if MacOS.prefer_64_bit?
     url "http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86_64.tar.bz2"
     sha1 "8c8f0d7df5f160c3ef82f2f4836cbcaf18aabf68"
   else
     url "http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86.tar.bz2"
--- a/python/mozboot/mozboot/osx.py
+++ b/python/mozboot/mozboot/osx.py
@@ -319,21 +319,26 @@ class OSXBootstrapper(BaseBootstrapper):
             print(PACKAGE_MANAGER_OLD_CLANG % ('Homebrew',))
 
             subprocess.check_call([self.brew, '-v', 'install', 'llvm',
                 '--with-clang', '--all-targets'])
 
     def ensure_homebrew_mobile_android_packages(self):
         import android
 
+        # If we're run from a downloaded bootstrap.py, then android-ndk.rb is
+        # fetched into a temporary directory.  This finds that directory.
+        import inspect
+        path_to_android = os.path.abspath(os.path.dirname(inspect.getfile(android)))
+
         # We don't need wget because we install the Android SDK and NDK from
         # packages.  If we used the android.py module, we'd need wget.
         packages = [
             ('android-sdk', 'android-sdk'),
-            ('android-ndk', 'android-ndk-r8e.rb'), # This is a locally provided brew formula!
+            ('android-ndk', os.path.join(path_to_android, 'android-ndk.rb')), # This is a locally provided brew formula!
             ('ant', 'ant'),
             ('brew-cask', 'caskroom/cask/brew-cask'), # For installing Java later.
         ]
         self._ensure_homebrew_packages(packages)
 
         casks = [
             ('java', 'java'),
         ]