commit:     7bcbb68920519aae210f2ad3504d641743fee61f
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun May  2 15:20:18 2021 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun May  2 15:20:18 2021 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=7bcbb689

Add color to the output of IRC reporter

Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>

 buildbot_gentoo_ci/config/reporters.py | 10 +++++-----
 buildbot_gentoo_ci/reporters/irc.py    |  7 +++----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/buildbot_gentoo_ci/config/reporters.py 
b/buildbot_gentoo_ci/config/reporters.py
index cc0c656..44edeab 100644
--- a/buildbot_gentoo_ci/config/reporters.py
+++ b/buildbot_gentoo_ci/config/reporters.py
@@ -6,10 +6,11 @@ from buildbot.reporters.generators.build import 
BuildStatusGenerator
 from buildbot.reporters.message import MessageFormatter
 
 from buildbot_gentoo_ci.reporters import irc
-#FIXME can colors be added here or is it needed in IRCStatusPush
-irc_template = '''\
-Buildbot: {{ build['properties']['cpv'][0] }} repo/{{ projects }} {{ 
build['properties']['revision'][0] }} \
-{{ build['properties']['owners'][0] }} {{ 
build['properties']['project_data'][0]['name'] }} {{ summary }} {{ build_url }}\
+irc_template = '''{% set resultsList = ["\x0303SUCCESS", "\x0308WARNINGS", 
"\x0304FAILURE"] %}\
+Buildbot: {{ "\x02" }}{{ build['properties']['cpv'][0] }}{{ "\x02" }} {{ 
"\x0303" }}repo/{{ projects }}{{ "\x03" }} \
+{{ build['properties']['revision'][0]|truncate(10, True) }} {{ "\x0302" }}{{ 
build['properties']['owners'][0][0] }}{{ "\x03" }} \
+{{ build['properties']['project_data'][0]['name'] }} \
+{{ "\x02" }}{{ "Build: "}}{{ resultsList[build['results']] }}{{ "\x03" }}{{ 
"\x02" }} {{ "\x0312" }}{{ build_url }}{{ "\x03" }}\
 '''
 
 def ircGenerators():
@@ -34,7 +35,6 @@ def ircGenerators():
 #FIXME:
 # server, nick channel should be set in config
 irc_reporter = irc.IRCStatusPush("irc.freenode.net", "gentoo_ci_test",
-                 useColors=False,
                  channels=[{"channel": "#gentoo-ci"},
                         ],
                  generators=ircGenerators()

diff --git a/buildbot_gentoo_ci/reporters/irc.py 
b/buildbot_gentoo_ci/reporters/irc.py
index 86d262b..6e0bc6b 100644
--- a/buildbot_gentoo_ci/reporters/irc.py
+++ b/buildbot_gentoo_ci/reporters/irc.py
@@ -99,8 +99,8 @@ class IRCStatusPush(ReporterBase):
     def reconfigService(self, host, nick, channels, pm_to_nicks=None, 
port=6667,
                         allowForce=None, tags=None, password=None, 
generators=None,
                         showBlameList=True, useRevisions=False,
-                        useSSL=False, lostDelay=None, failedDelay=None, 
useColors=True,
-                        allowShutdown=None, noticeOnChannel=False, authz=None, 
context=None,**kwargs
+                        useSSL=False, lostDelay=None, failedDelay=None, 
useColors=False,
+                        allowShutdown=None, noticeOnChannel=False, authz=None, 
**kwargs
                         ):
 
         # need to stash these so we can detect changes later
@@ -162,11 +162,10 @@ class IRCStatusPush(ReporterBase):
                 message_formatter=formatter
             )
         ]
-    #FIXME: add colors and notice support
+    #FIXME: add notice support
     def sendMessage(self, reports):
         body = reports[0].get('body', None)
         print(body)
-        print(assembleFormattedText(A.normal[body]))
         for c in self.join_channels:
             if isinstance(c, dict):
                 channel = c.get('channel', None)

Reply via email to