Bug 1426785 - Allow more `mach artifact toolchain` calls to not use a tooltool manifest. r=gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 22 Dec 2017 07:48:14 +0900
changeset 714563 75d211a946aee1d18d21fadaa3fffd071a0cf365
parent 714562 75e987d6de7f3ae8a3d9b478fc173e191d28aace
child 714564 b392ba0fa06cef3c512cb508a1d4eff3a1170168
push id93948
push userbmo:mh+mozilla@glandium.org
push dateMon, 25 Dec 2017 21:39:19 +0000
reviewersgps
bugs1426785
milestone59.0a1
Bug 1426785 - Allow more `mach artifact toolchain` calls to not use a tooltool manifest. r=gps We're about to remove some tooltool manifests, so we need those calls to work properly when TOOLTOOL_MANIFEST is not set.
taskcluster/scripts/builder/build-haz-linux.sh
taskcluster/scripts/builder/sm-tooltool-config.sh
testing/mozharness/scripts/repackage.py
--- a/taskcluster/scripts/builder/build-haz-linux.sh
+++ b/taskcluster/scripts/builder/build-haz-linux.sh
@@ -48,17 +48,17 @@ GECKO_DIR=$( cd "$GECKO_DIR" && pwd )
 # Directory to populate with tooltool-installed tools
 export TOOLTOOL_DIR="$WORKSPACE"
 
 # Directory to hold the (useless) object files generated by the analysis.
 export MOZ_OBJDIR="$WORKSPACE/obj-analyzed"
 mkdir -p "$MOZ_OBJDIR"
 
 if [ -n "$DO_TOOLTOOL" ]; then
-  ( cd $TOOLTOOL_DIR; $GECKO_DIR/mach artifact toolchain -v --tooltool-url https://tooltool.mozilla-releng.net/ --tooltool-manifest $GECKO_DIR/$TOOLTOOL_MANIFEST --cache-dir $TOOLTOOL_CACHE${MOZ_TOOLCHAINS:+ ${MOZ_TOOLCHAINS}} )
+  ( cd $TOOLTOOL_DIR; $GECKO_DIR/mach artifact toolchain -v${TOOLTOOL_MANIFEST:+ --tooltool-url https://tooltool.mozilla-releng.net/ --tooltool-manifest $GECKO_DIR/$TOOLTOOL_MANIFEST} --cache-dir $TOOLTOOL_CACHE${MOZ_TOOLCHAINS:+ ${MOZ_TOOLCHAINS}} )
 fi
 
 export NO_MERCURIAL_SETUP_CHECK=1
 
 if [[ "$PROJECT" = "browser" ]]; then (
     cd "$WORKSPACE"
     set "$WORKSPACE"
     . setup-ccache.sh
--- a/taskcluster/scripts/builder/sm-tooltool-config.sh
+++ b/taskcluster/scripts/builder/sm-tooltool-config.sh
@@ -51,14 +51,14 @@ fi
 # Install everything needed for the browser on this platform. Not all of it is
 # necessary for the JS shell, but it's less duplication to share tooltool
 # manifests.
 BROWSER_PLATFORM=$PLATFORM_OS$BITS
 
 : ${TOOLTOOL_CHECKOUT:=$WORK}
 export TOOLTOOL_CHECKOUT
 
-(cd $TOOLTOOL_CHECKOUT && ${SRCDIR}/mach artifact toolchain -v $TOOLTOOL_AUTH_FLAGS --tooltool-url $TOOLTOOL_SERVER --tooltool-manifest $SRCDIR/$TOOLTOOL_MANIFEST ${TOOLTOOL_CACHE:+ --cache-dir $TOOLTOOL_CACHE}${MOZ_TOOLCHAINS:+ ${MOZ_TOOLCHAINS}})
+(cd $TOOLTOOL_CHECKOUT && ${SRCDIR}/mach artifact toolchain${TOOLTOOL_MANIFEST:+ -v $TOOLTOOL_AUTH_FLAGS --tooltool-url $TOOLTOOL_SERVER --tooltool-manifest $SRCDIR/$TOOLTOOL_MANIFEST}${TOOLTOOL_CACHE:+ --cache-dir $TOOLTOOL_CACHE}${MOZ_TOOLCHAINS:+ ${MOZ_TOOLCHAINS}})
 
 # Add all the tooltool binaries to our $PATH.
 for bin in $TOOLTOOL_CHECKOUT/*/bin $TOOLTOOL_CHECKOUT/VC/bin/Hostx64/x86; do
     export PATH="$bin:$PATH"
 done
--- a/testing/mozharness/scripts/repackage.py
+++ b/testing/mozharness/scripts/repackage.py
@@ -1,16 +1,15 @@
 import os
 import sys
 
 sys.path.insert(1, os.path.dirname(sys.path[0]))  # noqa - don't warn about imports
 
 from mozharness.base.log import FATAL
 from mozharness.base.script import BaseScript
-from mozharness.mozilla.mock import ERROR_MSGS
 
 
 class Repackage(BaseScript):
 
     def __init__(self, require_config_file=False):
         script_kwargs = {
             'all_actions': [
                 "download_input",
@@ -84,21 +83,22 @@ class Repackage(BaseScript):
                 command=command,
                 cwd=dirs['abs_mozilla_dir'],
                 halt_on_failure=True,
             )
 
     def _run_tooltool(self):
         config = self.config
         dirs = self.query_abs_dirs()
+        toolchains = os.environ.get('MOZ_TOOLCHAINS')
         manifest_src = os.environ.get('TOOLTOOL_MANIFEST')
         if not manifest_src:
             manifest_src = config.get('tooltool_manifest_src')
-        if not manifest_src:
-            return self.warning(ERROR_MSGS['tooltool_manifest_undetermined'])
+        if not manifest_src and not toolchains:
+            return
 
         tooltool_manifest_path = os.path.join(dirs['abs_mozilla_dir'],
                                               manifest_src)
         cmd = [
             sys.executable, '-u',
             os.path.join(dirs['abs_mozilla_dir'], 'mach'),
             'artifact',
             'toolchain',
@@ -112,16 +112,18 @@ class Repackage(BaseScript):
             config['tooltool_url'],
         ]
         auth_file = self._get_tooltool_auth_file()
         if auth_file:
             cmd.extend(['--authentication-file', auth_file])
         cache = config.get('tooltool_cache')
         if cache:
             cmd.extend(['--cache-dir', cache])
+        if toolchains:
+            cmd.extend(toolchains.split())
         self.info(str(cmd))
         self.run_command(cmd, cwd=dirs['abs_mozilla_dir'], halt_on_failure=True)
 
     def _get_tooltool_auth_file(self):
         # set the default authentication file based on platform; this
         # corresponds to where puppet puts the token
         if 'tooltool_authentication_file' in self.config:
             fn = self.config['tooltool_authentication_file']