[llvm-commits] [zorg] r106169 - in /zorg/trunk/lnt/lnt: util/NTEmailReport.py viewer/Config.py

Daniel Dunbar daniel at zuster.org
Wed Jun 16 16:06:20 PDT 2010


Author: ddunbar
Date: Wed Jun 16 18:06:20 2010
New Revision: 106169

URL: http://llvm.org/viewvc/llvm-project?rev=106169&view=rev
Log:
LNT: Support per-database emailer configs, and tidy up LNT/simple reports.

Modified:
    zorg/trunk/lnt/lnt/util/NTEmailReport.py
    zorg/trunk/lnt/lnt/viewer/Config.py

Modified: zorg/trunk/lnt/lnt/util/NTEmailReport.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/NTEmailReport.py?rev=106169&r1=106168&r2=106169&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/util/NTEmailReport.py (original)
+++ zorg/trunk/lnt/lnt/util/NTEmailReport.py Wed Jun 16 18:06:20 2010
@@ -90,6 +90,9 @@
     id = run_summary.get_previous_run_on_machine(run.id)
     if id is not None:
         compare_to = db.getRun(id)
+    else:
+        # FIXME: Look for run across machine.
+        compare_to = None
 
     # Gather the changes to report, mapped by parameter set.
     new_failures = Util.multidict()
@@ -147,7 +150,7 @@
             print >>report, """(%s:%d)""" % (compare_to.machine.name,
                                              compare_to.machine.number)
     else:
-        print >>report, """    To: (none)"""
+        print >>report, """   To: (none)"""
     print >>report
 
     if existing_failures:
@@ -213,9 +216,6 @@
             for name,cr in tests:
                 print >>report, '  %s' % (name,)
 
-    print 'Subject:',subject
-    print report.getvalue()
-    raise SystemExit,0
     return subject, report.getvalue()
 
 def getReport(db, run, baseurl, was_added, will_commit):

Modified: zorg/trunk/lnt/lnt/viewer/Config.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/Config.py?rev=106169&r1=106168&r2=106169&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/Config.py (original)
+++ zorg/trunk/lnt/lnt/viewer/Config.py Wed Jun 16 18:06:20 2010
@@ -6,6 +6,16 @@
 import re
 
 class EmailConfig:
+    @staticmethod
+    def fromData(data):
+        # The email to field can either be a string, or a list of tuples of
+        # the form [(accept-regexp-pattern, to-address)].
+        to_address = data.get('to')
+        if not isinstance(to_address, str):
+            to_address = [(str(a),str(b)) for a,b in to_address]
+        return EmailConfig(bool(data.get('enabled')), str(data.get('host')),
+                           str(data.get('from')), to_address)
+        
     def __init__(self, enabled, host, from_address, to_address):
         self.enabled = enabled
         self.host = host
@@ -28,11 +38,17 @@
         dbPath = dict.get('path')
         if '://' not in dbPath:
             dbPath = os.path.join(baseDir, dbPath)
+
+        # Support per-database email configurations.
+        email_config = default_email_config
+        if 'emailer' in dict:
+            email_config = EmailConfig.fromData(dict['emailer'])
+
         return DBInfo(dbPath,
                       bool(dict.get('showNightlytest')),
                       bool(dict.get('showGeneral')),
                       bool(dict.get('showSimple')),
-                      default_email_config)
+                      email_config)
 
     def __init__(self, path, showNightlytest, showGeneral, showSimple,
                  email_config):
@@ -52,15 +68,7 @@
         # Get the default email config.
         emailer = data.get('nt_emailer')
         if emailer:
-            # The email to field can either be a string, or a list of tuples of
-            # the form [(accept-regexp-pattern, to-address)].
-            to_address = emailer.get('to')
-            if not isinstance(to_address, str):
-                to_address = [(str(a),str(b)) for a,b in to_address]
-            default_email_config = EmailConfig(bool(emailer.get('enabled')),
-                                               str(emailer.get('host')),
-                                               str(emailer.get('from')),
-                                               to_address)
+            default_email_config = EmailConfig.fromData(emailer)
         else:
             default_email_config = EmailConfig(False, '', '', [])
 





More information about the llvm-commits mailing list