Bug 1464235 - option to upload tup db r=mshal
authorSofia Carillo <scarrillo@mozilla.com>
Wed, 06 Jun 2018 14:04:47 -0700
changeset 421998 c77f7fe4c21b
parent 421997 192713c16fc1
child 422009 437d495c93b6
push id65069
push usermshal@mozilla.com
push dateFri, 08 Jun 2018 21:38:27 +0000
treeherderautoland@c77f7fe4c21b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1464235
milestone62.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 1464235 - option to upload tup db r=mshal MozReview-Commit-ID: JkzWTu0g41X
browser/config/mozconfigs/linux64/tup
moz.configure
python/mozbuild/mozbuild/backend/tup.py
--- a/browser/config/mozconfigs/linux64/tup
+++ b/browser/config/mozconfigs/linux64/tup
@@ -8,8 +8,9 @@ MOZ_AUTOMATION_UPLOAD_SYMBOLS=0
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 export TUP=${TOOLTOOL_DIR}/tup/tup
 
 . "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
 . "$topsrcdir/build/mozconfig.common.override"
 
 ac_add_options --enable-build-backends=Tup
+ac_add_options --upload-tup-db
--- a/moz.configure
+++ b/moz.configure
@@ -437,16 +437,25 @@ def tup_is_ldpreload(tup):
     return True
 
 @depends_if(tup, using_sccache)
 def tup_and_sccache(tup, using_sccache):
     if tup and using_sccache:
         die('Cannot use sccache with tup yet. Please disable sccache or use '
             'the make backend until it is supported.')
 
+option('--upload-tup-db', help= 'Upload the tup database from an automated build.')
+
+@depends('--upload-tup-db')
+def upload_tdb(value):
+    if value:
+        return True
+
+set_config('UPLOAD_TUP_DB', upload_tdb)
+
 # watchman detection
 # ==============================================================
 
 option(env='WATCHMAN', nargs=1, help='Path to the watchman program')
 
 @depends('WATCHMAN')
 @checking('for watchman', callback=lambda w: w.path if w else 'not found')
 def watchman(prog):
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -2,16 +2,17 @@
 # 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/.
 
 from __future__ import absolute_import, unicode_literals
 
 import os
 import json
 import sys
+import shutil
 
 import mozpack.path as mozpath
 from mozbuild import shellutil
 from mozbuild.base import MozbuildObject
 from mozbuild.backend.base import PartialBackend, HybridBackend
 from mozbuild.backend.recursivemake import RecursiveMakeBackend
 from mozbuild.mozconfig import MozconfigLoader
 from mozbuild.shellutil import quote as shell_quote
@@ -272,20 +273,27 @@ class TupBackend(CommonBackend):
         if self.environment.substs.get('MOZ_AUTOMATION'):
             args += ['--quiet']
         if verbose:
             args += ['--verbose']
         if jobs > 0:
             args += ['-j%d' % jobs]
         else:
             args += ['-j%d' % multiprocessing.cpu_count()]
-        return config.run_process(args=args,
+        status = config.run_process(args=args,
                                   line_handler=output.on_line,
                                   ensure_exit_code=False,
                                   append_env=self._get_mozconfig_env(config))
+        # upload Tup db
+        if (not status and
+            self.environment.substs.get('MOZ_AUTOMATION') and self.environment.substs.get('UPLOAD_TUP_DB')):
+            src = mozpath.join(self.environment.topsrcdir, '.tup')
+            dst = mozpath.join(os.environ['UPLOAD_PATH'], 'tup_db')
+            shutil.make_archive(dst, 'zip', src)
+        return status
 
     def _get_backend_file(self, relobjdir):
         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
         if objdir not in self._backend_files:
             self._backend_files[objdir] = \
                     BackendTupfile(objdir, self.environment,
                                    self.environment.topsrcdir, self.environment.topobjdir,
                                    self.dry_run)