Bug 1492128: [mozrelease] Add command to generate buglist for a given release; r=mtabara
authorTom Prince <mozilla@hocat.ca>
Tue, 30 Oct 2018 18:21:40 +0000
changeset 443841 5a4d509ac7a512558b8ceef69e45425938b0d11a
parent 443840 8f2c67323ea308768da3df00a4f76741b4b56ab0
child 443842 5e9ec632aff496509c338b56952ae10263e03fe7
push id34972
push userebalazs@mozilla.com
push dateThu, 01 Nov 2018 09:11:48 +0000
treeherdermozilla-central@cfb6077ee31b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtabara
bugs1492128
milestone65.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 1492128: [mozrelease] Add command to generate buglist for a given release; r=mtabara Differential Revision: https://phabricator.services.mozilla.com/D10154
build/mach_bootstrap.py
python/mozrelease/mozrelease/mach_commands.py
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -42,16 +42,17 @@ MACH_MODULES = [
     'python/safety/mach_commands.py',
     'python/mach/mach/commands/commandinfo.py',
     'python/mach/mach/commands/settings.py',
     'python/mozboot/mozboot/mach_commands.py',
     'python/mozbuild/mozbuild/mach_commands.py',
     'python/mozbuild/mozbuild/backend/mach_commands.py',
     'python/mozbuild/mozbuild/compilation/codecomplete.py',
     'python/mozbuild/mozbuild/frontend/mach_commands.py',
+    'python/mozrelease/mozrelease/mach_commands.py',
     'taskcluster/mach_commands.py',
     'testing/awsy/mach_commands.py',
     'testing/firefox-ui/mach_commands.py',
     'testing/geckodriver/mach_commands.py',
     'testing/mach_commands.py',
     'testing/marionette/mach_commands.py',
     'testing/mochitest/mach_commands.py',
     'testing/mozharness/mach_commands.py',
@@ -84,40 +85,45 @@ CATEGORIES = {
     'testing': {
         'short': 'Testing',
         'long': 'Run tests.',
         'priority': 60,
     },
     'ci': {
         'short': 'CI',
         'long': 'Taskcluster commands',
-        'priority': 59
+        'priority': 59,
     },
     'devenv': {
         'short': 'Development Environment',
         'long': 'Set up and configure your development environment.',
         'priority': 50,
     },
     'build-dev': {
         'short': 'Low-level Build System Interaction',
         'long': 'Interact with specific parts of the build system.',
         'priority': 20,
     },
     'misc': {
         'short': 'Potpourri',
         'long': 'Potent potables and assorted snacks.',
         'priority': 10,
     },
+    'release': {
+        'short': 'Release automation',
+        'long': 'Commands for used in release automation.',
+        'priority': 5,
+    },
     'disabled': {
         'short': 'Disabled',
         'long': 'The disabled commands are hidden by default. Use -v to display them. '
         'These commands are unavailable for your current context, '
         'run "mach <command>" to see why.',
         'priority': 0,
-    }
+    },
 }
 
 
 # We submit data to telemetry approximately every this many mach invocations
 TELEMETRY_SUBMISSION_FREQUENCY = 10
 
 
 def search_path(mozilla_dir, packages_txt):
new file mode 100644
--- /dev/null
+++ b/python/mozrelease/mozrelease/mach_commands.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+
+# 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/.
+
+
+from __future__ import absolute_import, print_function, unicode_literals
+
+import sys
+import logging
+
+from mach.decorators import (
+    CommandArgument,
+    CommandProvider,
+    Command,
+    SubCommand,
+)
+
+from mozbuild.base import MachCommandBase
+from mozilla_version.gecko import GeckoVersion
+
+
+@CommandProvider
+class MachCommands(MachCommandBase):
+
+    @Command('release', category="release",
+             description="Task that are part of the release process.")
+    def release(self):
+        """
+        The release subcommands all relate to the release process.
+        """
+
+    @SubCommand('release', 'buglist',
+                description="Generate list of bugs since the last release.")
+    @CommandArgument('--version',
+                     required=True,
+                     type=GeckoVersion.parse,
+                     help="The version being built.")
+    @CommandArgument('--product',
+                     required=True,
+                     help="The product being built.")
+    @CommandArgument('--revision',
+                     required=True,
+                     help="The revision being built.")
+    def buglist(self, version, product, revision):
+        self.setup_logging()
+        from mozrelease.buglist_creator import create_bugs_url
+        print(create_bugs_url(
+            product=product,
+            current_version=version,
+            current_revision=revision,
+        ))
+
+    def setup_logging(self, quiet=False, verbose=True):
+        """
+        Set up Python logging for all loggers, sending results to stderr (so
+        that command output can be redirected easily) and adding the typical
+        mach timestamp.
+        """
+        # remove the old terminal handler
+        old = self.log_manager.replace_terminal_handler(None)
+
+        # re-add it, with level and fh set appropriately
+        if not quiet:
+            level = logging.DEBUG if verbose else logging.INFO
+            self.log_manager.add_terminal_logging(
+                fh=sys.stderr, level=level,
+                write_interval=old.formatter.write_interval,
+                write_times=old.formatter.write_times)
+
+        # all of the taskgraph logging is unstructured logging
+        self.log_manager.enable_unstructured()