Bug 1535501 - Allow to get full crashreporter symbols on artifact builds. r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 15 Mar 2019 21:56:14 +0000
changeset 464464 4a22873c03f6
parent 464463 49ffc8567e79
child 464465 5ddb915061d2
push id35716
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:42:17 +0000
treeherdermozilla-central@8ee97c045359 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1535501
milestone67.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 1535501 - Allow to get full crashreporter symbols on artifact builds. r=mshal Differential Revision: https://phabricator.services.mozilla.com/D23605
Makefile.in
moz.configure
python/mozbuild/mozbuild/artifacts.py
python/mozbuild/mozbuild/mach_commands.py
toolkit/mozapps/installer/packager.mk
--- a/Makefile.in
+++ b/Makefile.in
@@ -163,17 +163,17 @@ binaries::
 	@$(MAKE) install-manifests install_manifests=dist/include
 endif
 
 # Host binaries are not produced for macOS consumers: that is, there's
 # no macOS-hosted job to produce them at this time.  Therefore we
 # enable --host-bins only for automation builds, which only require Linux and
 # Windows host binaries.
 recurse_artifact:
-	$(topsrcdir)/mach --log-no-times artifact install$(if $(MOZ_ARTIFACT_BUILD_SYMBOLS), --symbols)$(if $(MOZ_AUTOMATION), --host-bins)
+	$(topsrcdir)/mach --log-no-times artifact install$(if $(MOZ_ARTIFACT_BUILD_SYMBOLS), --symbols$(addprefix =,$(filter full,$(MOZ_ARTIFACT_BUILD_SYMBOLS))))$(if $(MOZ_AUTOMATION), --host-bins)
 
 ifdef MOZ_EME_WIN32_ARTIFACT
 recurse_win32-artifact:
 	rm -rf $(DIST)/i686
 	$(topsrcdir)/mach --log-no-times artifact install --job $(if $(MOZ_PGO),win32-pgo,win32-opt) --no-tests --distdir $(DIST)/i686
 	mv $(DIST)/i686/bin/* $(DIST)/i686
 endif
 
--- a/moz.configure
+++ b/moz.configure
@@ -23,21 +23,22 @@ def artifact_builds(value):
         return True
 
 set_config('MOZ_ARTIFACT_BUILDS', artifact_builds)
 
 imply_option('--enable-artifact-build-symbols',
              depends(artifact_builds)(lambda v: False if v is None else None),
              reason='--disable-artifact-builds')
 
-option('--enable-artifact-build-symbols',
+option('--enable-artifact-build-symbols', nargs='?', choices=('full',),
        help='Download symbols when artifact builds are enabled.')
 
 set_config('MOZ_ARTIFACT_BUILD_SYMBOLS',
-           depends_if('--enable-artifact-build-symbols')(lambda _: True))
+           depends('--enable-artifact-build-symbols')(
+               lambda v: v[0] if len(v) else (bool(v) or None)))
 
 @depends('--enable-artifact-builds')
 def imply_disable_compile_environment(value):
     if value:
         return False
 
 option(env='MOZ_COPY_PDBS',
     help='For builds that do not support symbols in the normal fashion,'
--- a/python/mozbuild/mozbuild/artifacts.py
+++ b/python/mozbuild/mozbuild/artifacts.py
@@ -158,17 +158,19 @@ class ArtifactJob(object):
         if download_tests:
             self._tests_re = re.compile(r'public/build/target\.common\.tests\.(zip|tar\.gz)')
         self._host_bins_re = None
         if download_host_bins:
             self._host_bins_re = re.compile(r'public/build/host/bin/(mar|mbsdiff)(.exe)?')
         self._log = log
         self._substs = substs
         self._symbols_archive_suffix = None
-        if download_symbols:
+        if download_symbols == 'full':
+            self._symbols_archive_suffix = 'crashreporter-symbols-full.zip'
+        elif download_symbols:
             self._symbols_archive_suffix = 'crashreporter-symbols.zip'
 
     def log(self, *args, **kwargs):
         if self._log:
             self._log(*args, **kwargs)
 
     def find_candidate_artifacts(self, artifacts):
         # TODO: Handle multiple artifacts, taking the latest one.
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1206,16 +1206,24 @@ class ArtifactSubCommand(SubCommand):
             CommandArgument('--verbose', '-v', action='store_true',
                 help='Print verbose output.'),
         ]
         for arg in args:
             after = arg(after)
         return after
 
 
+class SymbolsAction(argparse.Action):
+    def __call__(self, parser, namespace, values, option_string=None):
+        # If this function is called, it means the --symbols option was given,
+        # so we want to store the value `True` if no explicit value was given
+        # to the option.
+        setattr(namespace, self.dest, values or True)
+
+
 @CommandProvider
 class PackageFrontend(MachCommandBase):
     """Fetch and install binary artifacts from Mozilla automation."""
 
     @Command('artifact', category='post-build',
         description='Use pre-built artifacts to build Firefox.')
     def artifact(self):
         '''Download, cache, and install pre-built binary artifacts to build Firefox.
@@ -1261,17 +1269,17 @@ class PackageFrontend(MachCommandBase):
         help='Where to fetch and install artifacts from.  Can be omitted, in '
             'which case the current hg repository is inspected; an hg revision; '
             'a remote URL; or a local file.',
         default=None)
     @CommandArgument('--skip-cache', action='store_true',
         help='Skip all local caches to force re-fetching remote artifacts.',
         default=False)
     @CommandArgument('--no-tests', action='store_true', help="Don't install tests.")
-    @CommandArgument('--symbols', action='store_true', help='Download symbols.')
+    @CommandArgument('--symbols', nargs='?', action=SymbolsAction, help='Download symbols.')
     @CommandArgument('--host-bins', action='store_true', help='Download host binaries.')
     @CommandArgument('--distdir', help='Where to install artifacts to.')
     def artifact_install(self, source=None, skip_cache=False, tree=None, job=None, verbose=False,
                          no_tests=False, symbols=False, host_bins=False, distdir=None):
         self._set_log_level(verbose)
         artifacts = self._make_artifacts(tree=tree, job=job, skip_cache=skip_cache,
                                          download_tests=not no_tests,
                                          download_symbols=symbols,
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -48,16 +48,21 @@ ifdef MOZ_PACKAGE_JSSHELL
 	$(RM) $(PKG_JSSHELL)
 	$(MAKE_JSSHELL)
 endif # MOZ_PACKAGE_JSSHELL
 ifdef MOZ_ARTIFACT_BUILD_SYMBOLS
 	@echo 'Packaging existing crashreporter symbols from artifact build...'
 	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
 	cd $(DIST)/crashreporter-symbols && \
           zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'
+ifeq ($(MOZ_ARTIFACT_BUILD_SYMBOLS),full)
+	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
+	cd $(DIST)/crashreporter-symbols && \
+          zip -r5D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' .
+endif
 endif # MOZ_ARTIFACT_BUILD_SYMBOLS
 ifdef MOZ_CODE_COVERAGE
 	@echo 'Generating chrome-map for coverage data...'
 	$(topsrcdir)/mach build-backend -b ChromeMap
 	@echo 'Packaging code coverage data...'
 	$(RM) $(CODE_COVERAGE_ARCHIVE_BASENAME).zip
 	$(PYTHON) -mmozbuild.codecoverage.packager \
 		--output-file='$(DIST)/$(PKG_PATH)$(CODE_COVERAGE_ARCHIVE_BASENAME).zip'