Bug 1143013 - Ensure b2g_build passes number of cores to commands to workaround any previous -j settings r=catlee
--- 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: