Bug 1143013 - Ensure b2g_build passes number of cores to commands to workaround any previous -j settings r=catlee
authorjlal@mozilla.com
Fri, 13 Mar 2015 10:04:57 -0700 (2015-03-13)
changeset 3756 bc2b3ab7c9c6d82b95ccb03a7dbce96395b72294
parent 3755 c89055ada6764b7babed89cdd1652ffa32674eb9
child 3757 622111492288a41b2c3afde62067f7093411db27
child 3758 1deaa6e0dc43d0747edf48f38e9dcd309551d5c3
push id2955
push userjlal@mozilla.com
push dateFri, 13 Mar 2015 17:05:24 +0000 (2015-03-13)
reviewerscatlee
bugs1143013
Bug 1143013 - Ensure b2g_build passes number of cores to commands to workaround any previous -j settings r=catlee
mozharness/mozilla/building/buildb2gbase.py
scripts/b2g_build.py
--- a/mozharness/mozilla/building/buildb2gbase.py
+++ b/mozharness/mozilla/building/buildb2gbase.py
@@ -429,17 +429,17 @@ class B2GBuildBaseScript(BuildbotMixin, 
                 # before running config.sh
                 if os.path.isdir(repo_link):
                     # Delete any projects with broken HEAD references
                     self.info("Deleting broken projects...")
                     cmd = ['./repo', 'forall', '-c', 'git show-ref -q --head HEAD || rm -rfv $PWD']
                     self.run_command(cmd, cwd=dirs['work_dir'])
 
                 config_result = self.run_command([
-                    './config.sh', '-q', self.config['target'], manifest_filename,
+                    './config.sh', '-j100', '-q', self.config['target'], manifest_filename,
                 ], cwd=dirs['work_dir'], output_timeout=55 * 60)
 
                 # TODO: Check return code from these? retry?
                 # Run git reset --hard to make sure we're in a clean state
                 self.info("Resetting all git projects")
                 cmd = ['./repo', 'forall', '-c', 'git reset --hard']
                 self.run_command(cmd, cwd=dirs['work_dir'])
 
--- a/scripts/b2g_build.py
+++ b/scripts/b2g_build.py
@@ -7,16 +7,17 @@
 
 import sys
 import os
 import glob
 import re
 import tempfile
 from datetime import datetime
 import urlparse
+import multiprocessing
 import xml.dom.minidom
 
 try:
     import simplejson as json
     assert json
 except ImportError:
     import json
 
@@ -540,16 +541,21 @@ class B2GBuild(LocalesMixin, PurgeMixin,
         self.run_command(["diff", "-u", sourcesfile_orig, sourcesfile], success_codes=[1])
 
     def generate_build_command(self, target=None):
         cmd = ['./build.sh']
         if target is not None:
             # Workaround bug 984061
             if target == 'package-tests':
                 cmd.append('-j1')
+            else:
+                # Ensure we always utilize the correct number of cores
+                # regardless of the configuration which may be set by repo
+                # config changes...
+                cmd.append('-j{}'.format(multiprocessing.cpu_count()))
             cmd.append(target)
         return cmd
 
     def build(self):
         dirs = self.query_abs_dirs()
         gecko_config = self.load_gecko_config()
         build_targets = gecko_config.get('build_targets', [])
         if not build_targets: