[jhbuild] [buildbot] also notify of changes modules that do not match their git name



commit 7d4d274c5c5d27e66f62bd24e4f5d45701edd320
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Jan 8 19:21:39 2011 +0100

    [buildbot] also notify of changes modules that do not match their git name
    
    GTK+ is pulled in both gtk+ and gtk+-3 modules, the email hook should queue
    both for rebuild when a change happen inside the gtk+ repository.
    
    (GNOME bug 638919)

 jhbuild/buildbot/changes.py            |   24 +++++++++++++++++++++---
 jhbuild/buildbot/status/web/changes.py |    4 ++--
 jhbuild/commands/bot.py                |    1 +
 3 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/jhbuild/buildbot/changes.py b/jhbuild/buildbot/changes.py
index fb2d82f..9543693 100644
--- a/jhbuild/buildbot/changes.py
+++ b/jhbuild/buildbot/changes.py
@@ -26,9 +26,14 @@ from email.Iterators import body_line_iterator
 
 import base64
 
+from jhbuild.versioncontrol.git import GitBranch
+
 class GnomeMaildirSource(MaildirSource):
+    name = "GNOME commits-list"
 
-    name = "Gnome svn-commits-list"
+    def __init__(self, mailbox, modules, prefix):
+        MaildirSource.__init__(self, mailbox, prefix=prefix)
+        self.modules = modules
 
     def parse(self, m, prefix=None):
         if m is None:
@@ -121,6 +126,19 @@ class GnomeMaildirSource(MaildirSource):
             comments = unicode(comments.strip(), m.get_content_charset() or 'ascii', 'ignore')
 
         c = changes.Change(name, files, comments, isdir, revision=revision, links=links, when=when)
-        c.project = project # custom attribute
-        return c
+        c.project = project
+        c.git_module_name = project
+
+        # some modules may have alternate checkouts under different names, look
+        # for those, and create appropriate Change objects
+        for module in self.modules:
+            if isinstance(module.branch, GitBranch):
+                git_module_name = module.branch.module.rsplit('/', 1)[-1]
+                if module.name != project and git_module_name == project:
+                    change = changes.Change(name, files, comments, isdir,
+                                    revision=revision, links=links, when=when)
+                    change.project = module.name
+                    change.git_module_name = git_module_name
+                    self.parent.addChange(change)
 
+        return c
diff --git a/jhbuild/buildbot/status/web/changes.py b/jhbuild/buildbot/status/web/changes.py
index e267ee5..bb97dee 100644
--- a/jhbuild/buildbot/status/web/changes.py
+++ b/jhbuild/buildbot/status/web/changes.py
@@ -72,9 +72,9 @@ class ChangeResource(HtmlResource):
             if len(self.change.revision) == 40:
                 # git commit
                 link = 'http://git.gnome.org/browse/%s/commit/?id=%s' % (
-                        self.change.project, self.change.revision)
+                        self.change.git_module_name, self.change.revision)
                 data += '<p>View in GNOME cgit: <a href="%s">%s commit %s</a></dd>\n' % (
-                        link, self.change.project, self.change.revision[:8])
+                        link, self.change.git_module_name, self.change.revision[:8])
             else:
                 link = 'http://svn.gnome.org/viewvc/%s?view=revision&revision=%s' % (
                         self.change.project, self.change.revision)
diff --git a/jhbuild/commands/bot.py b/jhbuild/commands/bot.py
index e33206a..20a4ca7 100644
--- a/jhbuild/commands/bot.py
+++ b/jhbuild/commands/bot.py
@@ -409,6 +409,7 @@ class cmd_bot(Command):
                     from jhbuild.buildbot.changes import GnomeMaildirSource
                     config['change_source'] = GnomeMaildirSource(
                             self.jhbuild_config.jhbuildbot_svn_commits_box,
+                            modules=module_list,
                             prefix=None)
                 else:
                     # support injection (use 'buildbot sendchange')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]