Bug 1464235 - option to upload tup db r=mshal
authorSofia Carillo <scarrillo@mozilla.com>
Wed, 06 Jun 2018 14:04:47 -0700
changeset 421992 c77f7fe4c21b50dc7525602f9b147530e89c2e8b
parent 421991 192713c16fc1f199c78f470f11c3c6f12109ec27
child 421993 437d495c93b657420be63d179b420f956050d4c9
push id34113
push userbtara@mozilla.com
push dateSat, 09 Jun 2018 12:05:46 +0000
treeherdermozilla-central@21bc698a4d9c [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)