summaryrefslogtreecommitdiffstats
path: root/mozilla/build
diff options
context:
space:
mode:
authorChristoph Goehre <chris@sigxcpu.org>2014-12-03 12:12:04 -0500
committerChristoph Goehre <chris@sigxcpu.org>2014-12-03 12:12:04 -0500
commite2572a7f5bd5691754039ca746d33a80b91c139e (patch)
treec523dadc93240e3c65add08c5e2561507a0e6032 /mozilla/build
parentae54a5c2bd3ff360b1b08d2a1008fb4168bba0fd (diff)
Imported Upstream version 31.3.0upstream/31.3.0
Diffstat (limited to 'mozilla/build')
-rw-r--r--mozilla/build/autoconf/altoptions.m443
-rwxr-xr-xmozilla/build/autoconf/mozconfig-find76
-rwxr-xr-xmozilla/build/autoconf/mozconfig2client-mk76
-rwxr-xr-xmozilla/build/autoconf/mozconfig2configure103
-rw-r--r--mozilla/build/automation.py.in1
-rw-r--r--mozilla/build/automationutils.py14
-rw-r--r--mozilla/build/gen_mach_buildprops.py115
-rw-r--r--mozilla/build/mach_bootstrap.py65
-rw-r--r--mozilla/build/macosx/mozconfig.common6
-rw-r--r--mozilla/build/moz-automation.mk115
-rw-r--r--mozilla/build/mozconfig.automation32
-rw-r--r--mozilla/build/mozconfig.common2
-rw-r--r--mozilla/build/mozconfig.win-common9
-rw-r--r--mozilla/build/unix/mozconfig.asan2
-rw-r--r--mozilla/build/unix/mozconfig.linux5
15 files changed, 360 insertions, 304 deletions
diff --git a/mozilla/build/autoconf/altoptions.m4 b/mozilla/build/autoconf/altoptions.m4
index 3dc8c6e..6c40ad6 100644
--- a/mozilla/build/autoconf/altoptions.m4
+++ b/mozilla/build/autoconf/altoptions.m4
@@ -116,7 +116,42 @@ echo "
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
AC_DEFUN([MOZ_READ_MOZCONFIG],
[AC_REQUIRE([AC_INIT_BINSH])dnl
-# Read in '.mozconfig' script to set the initial options.
-# See the mozconfig2configure script for more details.
-_AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf
-. $_AUTOCONF_TOOLS_DIR/mozconfig2configure])
+inserted=
+dnl Shell is hard, so here is what the following does:
+dnl - Reset $@ (command line arguments)
+dnl - Add the configure options from mozconfig to $@ one by one
+dnl - Add the original command line arguments after that, one by one
+dnl
+dnl There are several tricks involved:
+dnl - It is not possible to preserve the whitespaces in $@ by assigning to
+dnl another variable, so the two first steps above need to happen in the first
+dnl iteration of the third step.
+dnl - We always want the configure options to be added, so the loop must be
+dnl iterated at least once, so we add a dummy argument first, and discard it.
+dnl - something | while read line ... makes the while run in a subshell, meaning
+dnl that anything it does is not propagated to the main shell, so we can't do
+dnl set -- foo there. As a consequence, what the while loop reading mach
+dnl environment output does is output a set of shell commands for the main shell
+dnl to eval.
+dnl - Extra care is due when lines from mach environment output contain special
+dnl shell characters, so we use ' for quoting and ensure no ' end up in between
+dnl the quoting mark unescaped.
+dnl Some of the above is directly done in mach environment --format=configure.
+failed_eval() {
+ echo "Failed eval'ing the following:"
+ $(dirname [$]0)/[$1]/mach environment --format=configure
+ exit 1
+}
+
+set -- dummy "[$]@"
+for ac_option
+do
+ if test -z "$inserted"; then
+ set --
+ eval "$($(dirname [$]0)/[$1]/mach environment --format=configure)" || failed_eval
+ inserted=1
+ else
+ set -- "[$]@" "$ac_option"
+ fi
+done
+])
diff --git a/mozilla/build/autoconf/mozconfig-find b/mozilla/build/autoconf/mozconfig-find
deleted file mode 100755
index 97dd90c..0000000
--- a/mozilla/build/autoconf/mozconfig-find
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-#
-# 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/.
-
-# mozconfigfind - Loads options from .mozconfig onto configure's
-# command-line. The .mozconfig file is searched for in the
-# order:
-# If $MOZCONFIG is set, use that.
-# If one of $TOPSRCDIR/.mozconfig or $TOPSRCDIR/mozconfig exists, use it.
-# If both exist, or if various legacy locations contain a mozconfig, error.
-# Otherwise, use the default build options.
-#
-topsrcdir=$1
-
-abspath() {
- if uname -s | grep -q MINGW; then
- # We have no way to figure out whether we're in gmake or pymake right
- # now. gmake gives us Unix-style paths while pymake gives us Windows-style
- # paths, so attempt to handle both.
- regexes='^\([A-Za-z]:\|\\\\\|\/\) ^\/'
- else
- regexes='^\/'
- fi
-
- for regex in $regexes; do
- if echo $1 | grep -q $regex; then
- echo $1
- return
- fi
- done
-
- # If we're at this point, we have a relative path
- echo `pwd`/$1
-}
-
-if [ -n "$MOZCONFIG" ] && ! [ -f "$MOZCONFIG" ]; then
- echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!" 1>&2
- exit 1
-fi
-
-if [ -n "$MOZ_MYCONFIG" ]; then
- echo "Your environment currently has the MOZ_MYCONFIG variable set to \"$MOZ_MYCONFIG\". MOZ_MYCONFIG is no longer supported. Please use MOZCONFIG instead." 1>&2
- exit 1
-fi
-
-if [ -z "$MOZCONFIG" ] && [ -f "$topsrcdir/.mozconfig" ] && [ -f "$topsrcdir/mozconfig" ]; then
- echo "Both \$topsrcdir/.mozconfig and \$topsrcdir/mozconfig are supported, but you must choose only one. Please remove the other." 1>&2
- exit 1
-fi
-
-for _config in "$MOZCONFIG" \
- "$topsrcdir/.mozconfig" \
- "$topsrcdir/mozconfig"
-do
- if test -f "$_config"; then
- abspath $_config
- exit 0
- fi
-done
-
-# We used to support a number of other implicit .mozconfig locations. We now
-# detect if we were about to use any of these locations and issue an error if we
-# find any.
-for _config in "$topsrcdir/mozconfig.sh" \
- "$topsrcdir/myconfig.sh" \
- "$HOME/.mozconfig" \
- "$HOME/.mozconfig.sh" \
- "$HOME/.mozmyconfig.sh"
-do
- if test -f "$_config"; then
- echo "You currently have a mozconfig at \"$_config\". This implicit location is no longer supported. Please move it to $topsrcdir/.mozconfig or specify it explicitly via \$MOZCONFIG." 1>&2
- exit 1
- fi
-done
diff --git a/mozilla/build/autoconf/mozconfig2client-mk b/mozilla/build/autoconf/mozconfig2client-mk
deleted file mode 100755
index aaf8de1..0000000
--- a/mozilla/build/autoconf/mozconfig2client-mk
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-#
-# 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/.
-
-# mozconfig2client-mk - Translates .mozconfig into options for client.mk.
-# Prints defines to stdout.
-#
-# See mozconfig2configure for more details
-
-print_header() {
- cat <<EOF
-# gmake
-# This file is automatically generated for client.mk.
-# Do not edit. Edit $FOUND_MOZCONFIG instead.
-
-EOF
-}
-
-ac_add_options() {
- for _opt
- do
- case "$_opt" in
- --target=*)
- echo $_opt | sed s/--target/CONFIG_GUESS/
- ;;
- *)
- echo "# $_opt is used by configure (not client.mk)"
- ;;
- esac
- done
-}
-
-ac_add_app_options() {
- echo "# $* is used by configure (not client.mk)"
-}
-
-mk_add_options() {
- for _opt
- do
- # Escape shell characters, space, tab, dollar, quote, backslash,
- # and substitute '@<word>@' with '$(<word>)'.
- _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'`
- echo $_opt;
- done
-}
-
-# Main
-#--------------------------------------------------
-
-scriptdir=`dirname $0`
-topsrcdir=$1
-
-# If the path changes, configure should be rerun
-echo "# PATH=$PATH"
-
-# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
-isfoundset=${FOUND_MOZCONFIG+yes}
-if [ -z $isfoundset ]; then
- FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir`
- if [ $? -ne 0 ]; then
- echo '$(error Fix above errors before continuing.)'
- else
- isfoundset=yes
- fi
-fi
-
-if [ -n $isfoundset ]; then
- if [ "$FOUND_MOZCONFIG" ]
- then
- print_header
- . "$FOUND_MOZCONFIG"
- echo "FOUND_MOZCONFIG := $FOUND_MOZCONFIG"
- fi
-fi
diff --git a/mozilla/build/autoconf/mozconfig2configure b/mozilla/build/autoconf/mozconfig2configure
deleted file mode 100755
index 99623b6..0000000
--- a/mozilla/build/autoconf/mozconfig2configure
+++ /dev/null
@@ -1,103 +0,0 @@
-#! /bin/sh
-#
-# 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/.
-
-# mozconfig2configure - Loads options from .mozconfig onto configure's
-# command-line. See mozconfig-find for how the config file is
-# found
-#
-# The options from .mozconfig are inserted into the command-line
-# before the real command-line options. This way the real options
-# will override any .mozconfig options.
-#
-# .mozconfig is a shell script. To add an option to configure's
-# command-line use the pre-defined function, ac_add_options,
-#
-# ac_add_options <configure-option> [<configure-option> ... ]
-#
-# For example,
-#
-# ac_add_options --with-pthreads --enable-debug
-#
-# ac_add_options can be called multiple times in .mozconfig.
-# Each call adds more options to configure's command-line.
-
-# Note: $_AUTOCONF_TOOLS_DIR must be defined in the script that includes this.
-
-ac_add_options() {
- for _opt
- do
- # Escape shell characters, space, tab, dollar, quote, backslash, parentheses.
- _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\\(\)]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'`
- _opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'`
-
- # Avoid adding duplicates
- case "$ac_options" in
- # Note that all options in $ac_options are enclosed in quotes,
- # so there will always be a last character to match [^-A-Za-z0-9_]
- *"\"$_opt[^-A-Za-z0-9_]"* ) ;;
- * ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;;
- esac
- done
-}
-
-ac_add_app_options() {
- APP=$1
- shift;
- if [ "$APP" = "$MOZ_BUILD_APP" ]; then
- ac_add_options "$*";
- fi
-}
-
-mk_add_options() {
- # These options are for client.mk
- # configure can safely ignore them.
- :
-}
-
-ac_echo_options() {
- echo "Adding configure options from $FOUND_MOZCONFIG:"
- eval "set -- $mozconfig_ac_options"
- for _opt
- do
- echo " $_opt"
- done
-}
-
-# Main
-#--------------------------------------------------
-topsrcdir=$(cd `dirname $0`; pwd -W 2>/dev/null || pwd)
-ac_options=
-mozconfig_ac_options=
-
-# Save the real command-line options
-for _opt
-do
- # Escape shell characters, space, tab, dollar, quote, backslash.
- _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'`
- ac_options="$ac_options \"$_opt\""
-done
-
-
-# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
-isfoundset=${FOUND_MOZCONFIG+yes}
-if [ -z $isfoundset ]; then
- FOUND_MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir`
- if [ $? -ne 0 ]; then
- echo "Fix above errors before continuing." 1>&2
- exit 1
- fi
-fi
-
-if [ "$FOUND_MOZCONFIG" ]; then
- . "$FOUND_MOZCONFIG"
-fi
-export FOUND_MOZCONFIG
-
-if [ "$mozconfig_ac_options" ]; then
- ac_echo_options 1>&2
-fi
-
-eval "set -- $mozconfig_ac_options $ac_options"
diff --git a/mozilla/build/automation.py.in b/mozilla/build/automation.py.in
index b7a9cf2..12953d8 100644
--- a/mozilla/build/automation.py.in
+++ b/mozilla/build/automation.py.in
@@ -217,7 +217,6 @@ class Automation(object):
universal_newlines=False,
startupinfo=None,
creationflags=0):
- args = automationutils.wrapCommand(args)
_log.info("INFO | automation.py | Launching: %s", subprocess.list2cmdline(args))
subprocess.Popen.__init__(self, args, bufsize, executable,
stdin, stdout, stderr,
diff --git a/mozilla/build/automationutils.py b/mozilla/build/automationutils.py
index 15f9b4f..eb3fcfe 100644
--- a/mozilla/build/automationutils.py
+++ b/mozilla/build/automationutils.py
@@ -43,7 +43,6 @@ __all__ = [
"getDebuggerInfo",
"DEBUGGER_INFO",
"replaceBackSlashes",
- "wrapCommand",
'KeyValueParseError',
'parseKeyValue',
'systemMemory',
@@ -407,19 +406,6 @@ def processLeakLog(leakLogFile, leakThreshold = 0):
def replaceBackSlashes(input):
return input.replace('\\', '/')
-def wrapCommand(cmd):
- """
- If running on OS X 10.5 or older, wrap |cmd| so that it will
- be executed as an i386 binary, in case it's a 32-bit/64-bit universal
- binary.
- """
- if platform.system() == "Darwin" and \
- hasattr(platform, 'mac_ver') and \
- platform.mac_ver()[0][:4] < '10.6':
- return ["arch", "-arch", "i386"] + cmd
- # otherwise just execute the command normally
- return cmd
-
class KeyValueParseError(Exception):
"""error when parsing strings of serialized key-values"""
def __init__(self, msg, errors=()):
diff --git a/mozilla/build/gen_mach_buildprops.py b/mozilla/build/gen_mach_buildprops.py
new file mode 100644
index 0000000..9c0b175
--- /dev/null
+++ b/mozilla/build/gen_mach_buildprops.py
@@ -0,0 +1,115 @@
+#!/usr/bin/python
+#
+# 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 sys
+import os
+import hashlib
+import json
+import re
+import errno
+from argparse import ArgumentParser
+
+def getFileHashAndSize(filename):
+ sha512Hash = 'UNKNOWN'
+ size = 'UNKNOWN'
+
+ try:
+ # open in binary mode to make sure we get consistent results
+ # across all platforms
+ f = open(filename, "rb")
+ shaObj = hashlib.sha512(f.read())
+ sha512Hash = shaObj.hexdigest()
+
+ size = os.path.getsize(filename)
+ except:
+ pass
+
+ return (sha512Hash, size)
+
+def getMarProperties(filename, partial=False):
+ if not os.path.exists(filename):
+ return {}
+ (mar_hash, mar_size) = getFileHashAndSize(filename)
+ martype = 'partial' if partial else 'complete'
+ return {
+ '%sMarFilename' % martype: os.path.basename(filename),
+ '%sMarSize' % martype: mar_size,
+ '%sMarHash' % martype: mar_hash,
+ }
+
+def getUrlProperties(filename):
+ # let's create a switch case using name-spaces/dict
+ # rather than a long if/else with duplicate code
+ property_conditions = [
+ # key: property name, value: condition
+ ('symbolsUrl', lambda m: m.endswith('crashreporter-symbols.zip') or
+ m.endswith('crashreporter-symbols-full.zip')),
+ ('testsUrl', lambda m: m.endswith(('tests.tar.bz2', 'tests.zip'))),
+ ('unsignedApkUrl', lambda m: m.endswith('apk') and
+ 'unsigned-unaligned' in m),
+ ('robocopApkUrl', lambda m: m.endswith('apk') and 'robocop' in m),
+ ('jsshellUrl', lambda m: 'jsshell-' in m and m.endswith('.zip')),
+ ('completeMarUrl', lambda m: m.endswith('.complete.mar')),
+ ('partialMarUrl', lambda m: m.endswith('.mar') and '.partial.' in m),
+ # packageUrl must be last!
+ ('packageUrl', lambda m: True),
+ ]
+ url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz))$''')
+ properties = {}
+
+ try:
+ with open(filename) as f:
+ for line in f:
+ m = url_re.match(line)
+ if m:
+ m = m.group(1)
+ for prop, condition in property_conditions:
+ if condition(m):
+ properties.update({prop: m})
+ break
+ except IOError as e:
+ if e.errno != errno.ENOENT:
+ raise
+ properties = {prop: 'UNKNOWN' for prop, condition in property_conditions}
+ return properties
+
+def getPartialInfo(props):
+ return [{
+ "from_buildid": props.get("previous_buildid"),
+ "size": props.get("partialMarSize"),
+ "hash": props.get("partialMarHash"),
+ "url": props.get("partialMarUrl"),
+ }]
+
+if __name__ == '__main__':
+ parser = ArgumentParser(description='Generate mach_build_properties.json for automation builds.')
+ parser.add_argument("--complete-mar-file", required=True,
+ action="store", dest="complete_mar_file",
+ help="Path to the complete MAR file, relative to the objdir.")
+ parser.add_argument("--partial-mar-file", required=False,
+ action="store", dest="partial_mar_file",
+ help="Path to the partial MAR file, relative to the objdir.")
+ parser.add_argument("--upload-output", required=True,
+ action="store", dest="upload_output",
+ help="Path to the text output of 'make upload'")
+ args = parser.parse_args()
+
+ json_data = getMarProperties(args.complete_mar_file)
+ json_data.update(getUrlProperties(args.upload_output))
+ if args.partial_mar_file:
+ json_data.update(getMarProperties(args.partial_mar_file, partial=True))
+
+ # Pull the previous buildid from the partial mar filename.
+ res = re.match(r'.*\.([0-9]+)-[0-9]+.mar', args.partial_mar_file)
+ if res:
+ json_data['previous_buildid'] = res.group(1)
+
+ # Set partialInfo to be a collection of the partial mar properties
+ # useful for balrog.
+ json_data['partialInfo'] = getPartialInfo(json_data)
+
+ with open('mach_build_properties.json', 'w') as outfile:
+ json.dump(json_data, outfile, indent=4)
diff --git a/mozilla/build/mach_bootstrap.py b/mozilla/build/mach_bootstrap.py
index ff7c0d1..bf222f8 100644
--- a/mozilla/build/mach_bootstrap.py
+++ b/mozilla/build/mach_bootstrap.py
@@ -144,42 +144,47 @@ def bootstrap(topsrcdir, mozilla_dir=None):
# case. For default behavior, we educate users and give them an opportunity
# to react. We always exit after creating the directory because users don't
# like surprises.
- state_user_dir = os.path.expanduser('~/.mozbuild')
- state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None)
- if state_env_dir:
- if not os.path.exists(state_env_dir):
- print('Creating global state directory from environment variable: %s'
- % state_env_dir)
- os.makedirs(state_env_dir, mode=0o770)
- print('Please re-run mach.')
- sys.exit(1)
- state_dir = state_env_dir
- else:
- if not os.path.exists(state_user_dir):
- print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir))
- try:
- for i in range(20, -1, -1):
- time.sleep(1)
- sys.stdout.write('%d ' % i)
- sys.stdout.flush()
- except KeyboardInterrupt:
- sys.exit(1)
-
- print('\nCreating default state directory: %s' % state_user_dir)
- os.mkdir(state_user_dir)
- print('Please re-run mach.')
- sys.exit(1)
- state_dir = state_user_dir
-
try:
import mach.main
except ImportError:
sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
import mach.main
- def populate_context(context):
- context.state_dir = state_dir
- context.topdir = topsrcdir
+ def populate_context(context, key=None):
+ if key is None:
+ return
+ if key == 'state_dir':
+ state_user_dir = os.path.expanduser('~/.mozbuild')
+ state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None)
+ if state_env_dir:
+ if not os.path.exists(state_env_dir):
+ print('Creating global state directory from environment variable: %s'
+ % state_env_dir)
+ os.makedirs(state_env_dir, mode=0o770)
+ print('Please re-run mach.')
+ sys.exit(1)
+ state_dir = state_env_dir
+ else:
+ if not os.path.exists(state_user_dir):
+ print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir))
+ try:
+ for i in range(20, -1, -1):
+ time.sleep(1)
+ sys.stdout.write('%d ' % i)
+ sys.stdout.flush()
+ except KeyboardInterrupt:
+ sys.exit(1)
+
+ print('\nCreating default state directory: %s' % state_user_dir)
+ os.mkdir(state_user_dir)
+ print('Please re-run mach.')
+ sys.exit(1)
+ state_dir = state_user_dir
+
+ return state_dir
+ if key == 'topdir':
+ return topsrcdir
+ raise AttributeError(key)
mach = mach.main.Mach(os.getcwd())
mach.populate_context_handler = populate_context
diff --git a/mozilla/build/macosx/mozconfig.common b/mozilla/build/macosx/mozconfig.common
index e258b0d..2dbf40b 100644
--- a/mozilla/build/macosx/mozconfig.common
+++ b/mozilla/build/macosx/mozconfig.common
@@ -2,6 +2,12 @@
# 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/.
+MOZ_AUTOMATION_L10N_CHECK=0
+
+if [ "x$IS_NIGHTLY" = "xyes" ]; then
+ MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
+ MOZ_AUTOMATION_UPDATE_PACKAGING=1
+fi
. "$topsrcdir/build/mozconfig.common"
if [ -d "$topsrcdir/clang" ]; then
diff --git a/mozilla/build/moz-automation.mk b/mozilla/build/moz-automation.mk
new file mode 100644
index 0000000..d031eff
--- /dev/null
+++ b/mozilla/build/moz-automation.mk
@@ -0,0 +1,115 @@
+#
+# 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/.
+
+ifneq (,$(filter automation/%,$(MAKECMDGOALS)))
+ifeq (4.0,$(firstword $(sort 4.0 $(MAKE_VERSION))))
+MAKEFLAGS += --output-sync=target
+else
+.NOTPARALLEL:
+endif
+endif
+
+include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
+
+# Log file from the 'make upload' step. We need this to parse out the URLs of
+# the uploaded files.
+AUTOMATION_UPLOAD_OUTPUT = $(DIST)/automation-upload.txt
+
+# Helper variables to convert from MOZ_AUTOMATION_* variables to the
+# corresponding the make target
+tier_BUILD_SYMBOLS = buildsymbols
+tier_L10N_CHECK = l10n-check
+tier_PRETTY_L10N_CHECK = pretty-l10n-check
+tier_INSTALLER = installer
+tier_PRETTY_INSTALLER = pretty-installer
+tier_PACKAGE = package
+tier_PRETTY_PACKAGE = pretty-package
+tier_PACKAGE_TESTS = package-tests
+tier_PRETTY_PACKAGE_TESTS = pretty-package-tests
+tier_UPDATE_PACKAGING = update-packaging
+tier_PRETTY_UPDATE_PACKAGING = pretty-update-packaging
+tier_UPLOAD_SYMBOLS = uploadsymbols
+tier_UPLOAD = upload
+
+# Automation build steps. Everything in MOZ_AUTOMATION_TIERS also gets used in
+# TIERS for mach display. As such, the MOZ_AUTOMATION_TIERS are roughly sorted
+# here in the order that they will be executed (since mach doesn't know of the
+# dependencies between them).
+moz_automation_symbols = \
+ PACKAGE_TESTS \
+ PRETTY_PACKAGE_TESTS \
+ BUILD_SYMBOLS \
+ UPLOAD_SYMBOLS \
+ PACKAGE \
+ PRETTY_PACKAGE \
+ INSTALLER \
+ PRETTY_INSTALLER \
+ UPDATE_PACKAGING \
+ PRETTY_UPDATE_PACKAGING \
+ L10N_CHECK \
+ PRETTY_L10N_CHECK \
+ UPLOAD \
+ $(NULL)
+MOZ_AUTOMATION_TIERS := $(foreach sym,$(moz_automation_symbols),$(if $(filter 1,$(MOZ_AUTOMATION_$(sym))),$(tier_$(sym))))
+
+# Dependencies between automation build steps
+automation/uploadsymbols: automation/buildsymbols
+
+automation/update-packaging: automation/package
+automation/pretty-update-packaging: automation/pretty-package
+automation/pretty-update-packaging: automation/pretty-installer
+
+automation/l10n-check: automation/package
+automation/l10n-check: automation/installer
+automation/pretty-l10n-check: automation/pretty-package
+automation/pretty-l10n-check: automation/pretty-installer
+
+automation/upload: automation/installer
+automation/upload: automation/package
+automation/upload: automation/package-tests
+automation/upload: automation/buildsymbols
+automation/upload: automation/update-packaging
+
+# automation/{pretty-}package should depend on build (which is implicit due to
+# the way client.mk invokes automation/build), but buildsymbols changes the
+# binaries/libs, and that's what we package/test.
+automation/pretty-package: automation/buildsymbols
+
+# The 'pretty' versions of targets run before the regular ones to avoid
+# conflicts in writing to the same files.
+automation/installer: automation/pretty-installer
+automation/package: automation/pretty-package
+automation/package-tests: automation/pretty-package-tests
+automation/l10n-check: automation/pretty-l10n-check
+automation/update-packaging: automation/pretty-update-packaging
+
+automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
+ $(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT)
+
+# We need the log from make upload to grep it for urls in order to set
+# properties.
+AUTOMATION_EXTRA_CMDLINE-upload = 2>&1 | tee $(AUTOMATION_UPLOAD_OUTPUT)
+
+# Note: We have to force -j1 here, at least until bug 1036563 is fixed.
+AUTOMATION_EXTRA_CMDLINE-l10n-check = -j1
+AUTOMATION_EXTRA_CMDLINE-pretty-l10n-check = -j1
+
+# And force -j1 here until bug 1077670 is fixed.
+AUTOMATION_EXTRA_CMDLINE-package-tests = -j1
+AUTOMATION_EXTRA_CMDLINE-pretty-package-tests = -j1
+
+# The commands only run if the corresponding MOZ_AUTOMATION_* variable is
+# enabled. This means, for example, if we enable MOZ_AUTOMATION_UPLOAD, then
+# 'buildsymbols' will only run if MOZ_AUTOMATION_BUILD_SYMBOLS is also set.
+# However, the target automation/buildsymbols will still be executed in this
+# case because it is a prerequisite of automation/upload.
+define automation_commands
+$(call BUILDSTATUS,TIER_START $1)
+@$(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
+$(call BUILDSTATUS,TIER_FINISH $1)
+endef
+
+automation/%:
+ $(if $(filter $*,$(MOZ_AUTOMATION_TIERS)),$(call automation_commands,$*))
diff --git a/mozilla/build/mozconfig.automation b/mozilla/build/mozconfig.automation
new file mode 100644
index 0000000..b65f0fa
--- /dev/null
+++ b/mozilla/build/mozconfig.automation
@@ -0,0 +1,32 @@
+# 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/.
+
+# Common mozconfig for automation builds.
+#
+# We export MOZ_AUTOMATION_* variables here to trigger various steps in
+# automation builds. For example, if MOZ_AUTOMATION_PACKAGE is set, then the
+# package step will run. This file contains the default settings, which can be
+# overridden by setting them earlier in the appropriate mozconfig.
+
+mk_add_options "export MOZ_AUTOMATION_BUILD_SYMBOLS=${MOZ_AUTOMATION_BUILD_SYMBOLS-1}"
+mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
+mk_add_options "export MOZ_AUTOMATION_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
+mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
+mk_add_options "export MOZ_AUTOMATION_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
+mk_add_options "export MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-0}"
+mk_add_options "export MOZ_AUTOMATION_UPLOAD=${MOZ_AUTOMATION_UPLOAD-1}"
+mk_add_options "export MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-0}"
+
+# If we are also building with MOZ_PKG_PRETTYNAMES, set the corresponding
+# stages.
+if test "$MOZ_AUTOMATION_PRETTY" = "1"; then
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
+
+ # Note that we always build the update packaging with pretty names even if
+ # we don't build it without, so this is set to 1.
+ mk_add_options "export MOZ_AUTOMATION_PRETTY_UPDATE_PACKAGING=1"
+fi
diff --git a/mozilla/build/mozconfig.common b/mozilla/build/mozconfig.common
index edd7c40..3b49b81 100644
--- a/mozilla/build/mozconfig.common
+++ b/mozilla/build/mozconfig.common
@@ -15,3 +15,5 @@ mk_add_options AUTOCLOBBER=1
ac_add_options --enable-crashreporter
ac_add_options --enable-release
+
+. "$topsrcdir/build/mozconfig.automation"
diff --git a/mozilla/build/mozconfig.win-common b/mozilla/build/mozconfig.win-common
new file mode 100644
index 0000000..396f0e6
--- /dev/null
+++ b/mozilla/build/mozconfig.win-common
@@ -0,0 +1,9 @@
+# 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/.
+
+if [ "x$IS_NIGHTLY" = "xyes" ]; then
+ MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
+ MOZ_AUTOMATION_UPDATE_PACKAGING=1
+fi
+MOZ_AUTOMATION_INSTALLER=1
diff --git a/mozilla/build/unix/mozconfig.asan b/mozilla/build/unix/mozconfig.asan
index 8bd9e2d..7abc4f6 100644
--- a/mozilla/build/unix/mozconfig.asan
+++ b/mozilla/build/unix/mozconfig.asan
@@ -1,3 +1,5 @@
+MOZ_AUTOMATION_L10N_CHECK=0
+
. "$topsrcdir/build/mozconfig.common"
# Use Clang as specified in manifest
diff --git a/mozilla/build/unix/mozconfig.linux b/mozilla/build/unix/mozconfig.linux
index dd6883d..dc9259f 100644
--- a/mozilla/build/unix/mozconfig.linux
+++ b/mozilla/build/unix/mozconfig.linux
@@ -1,3 +1,8 @@
+if [ "x$IS_NIGHTLY" = "xyes" ]; then
+ MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
+ MOZ_AUTOMATION_UPDATE_PACKAGING=1
+fi
+
. "$topsrcdir/build/mozconfig.common"
# some b2g desktop builds still happen on i686 machines, and the tooltool