At Cauldron this weekend Joel offered to adjust his git hooks (https://github.com/brobecke/git-hooks), which are already used by gdb and glibc, to meet GCC's needs. Separately, Joseph volunteered to deal with converting the gcc-www repository to git and dealing with those hooks.
I expect that Joel's hooks should work fine for gcc-www with minimal changes, but that the main GCC repository will need more work for bugzilla integration. The GCC SVN hooks initially look like pretty vanilla SVN hooks using svnmailer (http://opensource.perlig.de/svnmailer/); the customized part of the svnmailer.conf is just [libstdcxx] for_paths = .*(libstdc..-v3)/.* to_addr = libstdc++-...@gcc.gnu.org [java] for_paths = .*(boehm-gc|fastjar|gcjx|gcc/java|libffi|libjava|zlib)/.* to_addr = java-...@gcc.gnu.org [gccdefault] to_addr = gcc-...@gcc.gnu.org bugzilla_to_addr = gcc-bugzi...@gcc.gnu.org Pretty short...but the last line relies on Daniel's custom bugzilla/svnmailer integration (attached below), and it looks like Joel's hooks don't have anything comparable. Any thoughts about adjusting Daniel's bugzilla.py vs. pulling in something like http://www.theoldmonk.net/gitzilla/ ? Jason
# -*- coding: utf-8 -*- # # Copyright 2004-2006 André Malo or his licensors, as applicable # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Bugzilla based email notifiers (either piped to a program or via SMTP) """ __author__ = "Daniel Berlin" __docformat__ = "epytext en" __all__ = ['getNotifier'] handled_bugs = {} def getNotifier(config, groupset): """ Returns an initialized notifier or nothing @param config: The svnmailer config @type config: C{svnmailer.settings.Settings} @param groupset: The groupset to process @type groupset: C{list} @return: The list of notifiers (containing 0 or 1 member) @rtype: C{list} """ from svnmailer import settings from svnmailer.notifier import _textmail, _multimail cls = None if config.general.sendmail_command: cls = SendmailSubmitter elif config.general.smtp_host: cls = SMTPSubmitter if cls: mtype = (groupset.groups[0].mail_type or u'single').split()[0].lower() is_commit = (config.runtime.mode == settings.modes.commit) mod = (is_commit and mtype == u'multipart') and \ _multimail or _textmail return mod.getNotifier(cls, config, groupset) return [] class SMTPSubmitter(object): """ Use SMTP to submit the mail """ _settings = None def sendMail(self, sender, to_addr, mail): """ Sends the mail via SMTP """ import smtplib, cStringIO fp = cStringIO.StringIO() mail.dump(fp) mail = fp.getvalue() fp.close() general = self._settings.general conn = smtplib.SMTP(general.smtp_host) if general.smtp_user: conn.login(general.smtp_user, general.smtp_pass) conn.sendmail(sender, to_addr, mail) conn.quit() class SendmailSubmitter(object): """ Pipe all stuff to a mailer """ _settings = None def sendMail(self, sender, to_addr, mail): """ Sends the mail via a piped mailer """ global handled_bugs from svnmailer import util import sys import re import cStringIO bugre = re.compile('\s+(?:bug|PR|BZ)\s+\#?\s*(?:[a-z\-\+]+\/)?(?:\/)?(\d+)(.*)$',re.I | re.S | re.M) start = 0 fp = cStringIO.StringIO() mail.dump(fp) mailtxt = fp.getvalue() fp.close() result = bugre.search(mailtxt, start) while result: try: bugnum = result.group(1) if handled_bugs.has_key(bugnum) == False: for group in [group for group in self._groupset.groups if group.bugzilla_to_addr]: handled_bugs[bugnum] = True mail.replace_header('To', group.bugzilla_to_addr) mail.replace_header('Subject',"[Bug %s]" % (bugnum, )) pipe = util.getPipe2(self._getMailCommand(sender, [group.bugzilla_to_addr])) pipe.fromchild.close() # we don't expect something mail.dump(pipe.tochild) pipe.tochild.close() # what do we do with the return code? pipe.wait() start = result.span(1)[1] result = bugre.search(mailtxt, start) except: result = None break def _getMailCommand(self, sender, to_addr): """ Returns the mailer command The command is created using sendmail conventions. If you want another commandline, override this method. @param sender: The sender address @type sender: C{str} @param to_addr: The receivers @type to_addr: C{list} @return: The command @rtype: C{list} """ cmd = list(self._settings.general.sendmail_command) cmd[1:] = [(isinstance(arg, unicode) and [arg.encode("utf-8")] or [arg])[0] for arg in cmd[1:] ] cmd.extend(['-f', sender]) cmd.extend(to_addr) return cmd