Bug 1494091: [mozharness] Remove in-tree copies of vcssync code; r=dhouse
authorTom Prince <mozilla@hocat.ca>
Mon, 01 Oct 2018 20:57:41 +0000
changeset 495011 20aa576e6fc2323e6e03d0ecb45771bc6fcd698c
parent 495010 a6f066f5fbdac97fef39bf7f0ba411a64da97965
child 495012 d210ac107dd7211e53e12762ccfd14078b718ee1
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhouse
bugs1494091
milestone64.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 1494091: [mozharness] Remove in-tree copies of vcssync code; r=dhouse The production code lives in https://hg.mozilla.org/build/mozharness This code is left over from the initial import of the repository. Differential Revision: https://phabricator.services.mozilla.com/D6834
testing/mozharness/docs/mozharness.base.vcs.rst
testing/mozharness/mozharness/base/vcs/vcssync.py
--- a/testing/mozharness/docs/mozharness.base.vcs.rst
+++ b/testing/mozharness/docs/mozharness.base.vcs.rst
@@ -23,24 +23,15 @@ mozharness.base.vcs.mercurial module
 mozharness.base.vcs.vcsbase module
 ----------------------------------
 
 .. automodule:: mozharness.base.vcs.vcsbase
     :members:
     :undoc-members:
     :show-inheritance:
 
-mozharness.base.vcs.vcssync module
-----------------------------------
-
-.. automodule:: mozharness.base.vcs.vcssync
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
-
 Module contents
 ---------------
 
 .. automodule:: mozharness.base.vcs
     :members:
     :undoc-members:
     :show-inheritance:
deleted file mode 100644
--- a/testing/mozharness/mozharness/base/vcs/vcssync.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-# ***** BEGIN LICENSE BLOCK *****
-# 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/.
-# ***** END LICENSE BLOCK *****
-"""Generic VCS support.
-"""
-
-import os
-import smtplib
-import sys
-import time
-
-sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.dirname(sys.path[0]))))
-
-from mozharness.base.log import ERROR, INFO
-from mozharness.base.vcs.vcsbase import VCSScript
-
-
-# VCSSyncScript {{{1
-class VCSSyncScript(VCSScript):
-    start_time = time.time()
-
-    def __init__(self, **kwargs):
-        super(VCSSyncScript, self).__init__(**kwargs)
-
-    def notify(self, message=None, fatal=False):
-        """ Email people in the notify_config (depending on status and failure_only)
-            """
-        c = self.config
-        dirs = self.query_abs_dirs()
-        job_name = c.get('job_name', c.get('conversion_dir', os.getcwd()))
-        end_time = time.time()
-        seconds = int(end_time - self.start_time)
-        self.info("Job took %d seconds." % seconds)
-        subject = "[vcs2vcs] Successful conversion for %s" % job_name
-        text = ''
-        error_contents = ''
-        max_log_sample_size = c.get('email_max_log_sample_size') # default defined in vcs_sync.py
-        error_log = os.path.join(dirs['abs_log_dir'], self.log_obj.log_files[ERROR])
-        info_log = os.path.join(dirs['abs_log_dir'], self.log_obj.log_files[INFO])
-        if os.path.exists(error_log) and os.path.getsize(error_log) > 0:
-            error_contents = self.get_output_from_command(
-                ["egrep", "-C5", "^[0-9:]+ +(ERROR|CRITICAL|FATAL) -", info_log],
-                silent=True,
-            )
-        if fatal:
-            subject = "[vcs2vcs] Failed conversion for %s" % job_name
-            text = ''
-            if len(message) > max_log_sample_size:
-                text += '*** Message below has been truncated: it was %s characters, and has been reduced to %s characters:\n\n' % (len(message), max_log_sample_size)
-            text += message[0:max_log_sample_size] + '\n\n' # limit message to max_log_sample_size in size (large emails fail to send)
-        if not self.successful_repos:
-            subject = "[vcs2vcs] Successful no-op conversion for %s" % job_name
-        if error_contents and not fatal:
-            subject += " with warnings"
-        if self.successful_repos:
-            if len(self.successful_repos) <= 5:
-                subject += ' (' + ','.join(self.successful_repos) + ')'
-            else:
-                text += "Successful repos: %s\n\n" % ', '.join(self.successful_repos)
-        subject += ' (%ds)' % seconds
-        if self.summary_list:
-            text += 'Summary is non-zero:\n\n'
-            for item in self.summary_list:
-                text += '%s - %s\n' % (item['level'], item['message'])
-        if not fatal and error_contents and not self.summary_list:
-            text += 'Summary is empty; the below errors have probably been auto-corrected.\n\n'
-        if error_contents:
-            if len(error_contents) > max_log_sample_size:
-                text += '\n*** Message below has been truncated: it was %s characters, and has been reduced to %s characters:\n' % (len(error_contents), max_log_sample_size)
-            text += '\n%s\n\n' % error_contents[0:max_log_sample_size] # limit message to 100KB in size (large emails fail to send)
-        if not text:
-            subject += " <EOM>"
-        for notify_config in c.get('notify_config', []):
-            if not fatal:
-                if notify_config.get('failure_only'):
-                    self.info("Skipping notification for %s (failure_only)" % notify_config['to'])
-                    continue
-                if not text and notify_config.get('skip_empty_messages'):
-                    self.info("Skipping notification for %s (skip_empty_messages)" % notify_config['to'])
-                    continue
-            fromaddr = notify_config.get('from', c['default_notify_from'])
-            message = '\r\n'.join((
-                "From: %s" % fromaddr,
-                "To: %s" % notify_config['to'],
-                "CC: %s" % ','.join(notify_config.get('cc', [])),
-                "Subject: %s" % subject,
-                "",
-                text
-            ))
-            toaddrs = [notify_config['to']] + notify_config.get('cc', [])
-            # TODO allow for a different smtp server
-            # TODO deal with failures
-            server = smtplib.SMTP('localhost')
-            self.retry(
-                server.sendmail,
-                args=(fromaddr, toaddrs, message),
-            )
-            server.quit()