Bug 1085513 part1: Detect the mozconfig obj directory. r=lightsofapollo, garndt
authorWander Lairson Costa <wcosta@mozilla.com>
Wed, 26 Nov 2014 10:11:30 -0800
changeset 225669 804a26eea2424aa230b663965aaa44f5c2dfacbf
parent 225668 719d280a5383b0d217f87f18df5d9fd091fb51c2
child 225670 7b098c2b6c2a02f7cdf583e1cf2a96e8fa678490
push id28174
push userryanvm@gmail.com
push dateMon, 26 Jan 2015 21:23:42 +0000
treeherdermozilla-central@c3a90afa2dee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslightsofapollo, garndt
bugs1085513
milestone38.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 1085513 part1: Detect the mozconfig obj directory. r=lightsofapollo, garndt We cannot hardcode the object directory because it is configurable inside the mozconfig file. Parse the mozconfig and extract the object directory. If it is not defined, defaults to "/home/worker/object-folder".
testing/docker/builder/Dockerfile
testing/docker/builder/build-b2g-desktop.sh
testing/docker/builder/get-objdir.py
--- a/testing/docker/builder/Dockerfile
+++ b/testing/docker/builder/Dockerfile
@@ -3,14 +3,15 @@ MAINTAINER    Jonas Finnemann Jensen <jo
 
 ENV PATH $PATH:/home/worker/bin/
 
 # Add utilities and configuration
 ADD           mozconfigs/           /home/worker/mozconfigs/
 RUN           mkdir -p              /home/worker/bin
 ADD           build.sh              /home/worker/bin/build.sh
 ADD           build-b2g-desktop.sh  /home/worker/bin/build-b2g-desktop.sh
+ADD           get-objdir.py         /home/worker/bin/get-objdir.py
 ADD           get_gaia_repo.js      /home/worker/bin/get_gaia_repo.js
 ADD           get_gaia_revision.js  /home/worker/bin/get_gaia_revision.js
 ADD           build-setup.sh        /home/worker/bin/build-setup.sh
 
 # Set a default command useful for debugging
 CMD ["/bin/bash", "--login"]
--- a/testing/docker/builder/build-b2g-desktop.sh
+++ b/testing/docker/builder/build-b2g-desktop.sh
@@ -18,27 +18,34 @@ hg update $REVISION;
 cd $gaia_dir
 GAIA_REV=$(get_gaia_revision.js)
 GAIA_REPO="https://hg.mozilla.org$(get_gaia_repo.js)"
 hg pull -r $GAIA_REV $GAIA_REPO;
 hg update $GAIA_REV;
 
 cd $gecko_dir
 
+# Nightly mozconfig expects gaia repo be inside mozilla-central tree
+if [ ! -d "gaia" ]; then
+  ln -s ../../gaia/source gaia
+fi
+
+export MOZ_OBJDIR=$(get-objdir.py $gecko_dir)
+
 ./mach build;
 
 ### Make package
-cd /home/worker/object-folder;
+cd $MOZ_OBJDIR
 make package package-tests;
 
 ### Extract artifacts
 # Navigate to dist/ folder
-cd /home/worker/object-folder/dist;
+cd $MOZ_OBJDIR/dist
 
-ls -lah /home/worker/object-folder/dist/
+ls -lah $MOZ_OBJDIR/dist/
 
 
 # Target names are cached so make sure we discard them first if found.
 rm -f target.linux-x86_64.tar.bz2 target.linux-x86_64.json target.tests.zip
 
 # Artifacts folder is outside of the cache.
 mkdir -p /home/worker/artifacts/
 
new file mode 100755
--- /dev/null
+++ b/testing/docker/builder/get-objdir.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import sys
+import os.path
+
+DEFAULT_OBJDIR = "/home/worker/object-folder"
+
+gecko_dir = sys.argv[1]
+
+base_path = os.path.join(gecko_dir, 'python')
+sys.path.append(os.path.join(base_path, 'mozbuild'))
+sys.path.append(os.path.join(base_path, 'mach'))
+sys.path.append(os.path.join(gecko_dir, 'testing', 'mozbase', 'mozprocess'))
+
+from mozbuild.mozconfig import MozconfigLoader
+
+loader = MozconfigLoader(gecko_dir)
+result = loader.read_mozconfig()
+
+topobjdir = result['topobjdir']
+print(topobjdir if topobjdir else DEFAULT_OBJDIR)