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

Re: Bug#622117: [PATCH 2/2] Fill field "builder" in pkg_history



Hi,

Am Sonntag, den 19.06.2011, 15:09 +0200 schrieb Kurt Roeckx:
> On Sun, Jun 19, 2011 at 02:48:28PM +0200, Joachim Breitner wrote:
> > Hi,
> > 
> > I first suspected that maybe the format of the first line of the log
> > file has changes (which is parsed in _parse_arch), which seems to be the
> > case when I compare recent build logs with what's in the test suite.
> 
> The first line looks like:
> sbuild (Debian sbuild) 0.61.0 (23 Feb 2011) on barber.debian.org

after more code consulting: The first line is only considered if the
Subject line does not look like expected. So this is irrelevant for our
problem.

> > But then, the build is only extracted from the Sender field, in
> > _parse_sender. And even if the Sender is not in the expected format, it
> > should log "invalid sender F:'%s' S:'%s'" and set the builder to the
> > full content of the Sender line.
> 
> The config has something like this in it:
> $mailfrom = 'buildd on lebrun <buildd@lebrun.debian.org>';
> 
> The email address should be right, or things won't work (when you
> need to manually sign).  So the question is which part of the of
> that field you want to parse?  And should we than standardise our
> config files?

The parsing of the field was already in place:

    def _parse_sender(self):
        """
        Generate a builder name from the From field of the header.  It
        assumes that the machine name is sufficiently unique.  This
        avoids leaking the complete email address.

        pre:
            self._sender is not None
        post:
            self.builder is not None
        """
        # Let's assume that there are two possibilities for email
        # address encodings: "buildd@host.org" and "buildd on host
        # <buildd@host.org>".  For other insane things this regular
        # expression should also return something sane.
        m = re.match('(.*<)?(\S*)@(\S+\.[^\s>]*)(>.*)?', self._sender)
        if m:
            # group 3 is the hostname part of the mail address
            self.builder = m.group(3)
        else:
            # It did not match: just use the sender verbatim and log
            # the strange From line.
            self.factory.logger.info("invalid sender F:'%s' S:'%s'",
                                     self._sender, self._subject)
            self.builder = self._sender


so in any case, self.build should be set. Yet you say that the field is
always null... So it looks like it is somehow not put into the
Database...

ok, found it: There is a file lib/debian/wannabuild/db.py which I have
overlooked and where columns have to be registered. So the value that we
have passed to values() was silently ignored... please try again with
the attached patch.

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
Debian Developer
  nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata
From 8a37e6fc7ec4889b456efa7e7811c243d1758c41 Mon Sep 17 00:00:00 2001
From: Joachim Breitner <mail@joachim-breitner.de>
Date: Sun, 19 Jun 2011 16:09:05 +0200
Subject: [PATCH] Make builder column known to DBFactory

---
 lib/debian/wannabuild/db.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/debian/wannabuild/db.py b/lib/debian/wannabuild/db.py
index b3c53c9..769b5ed 100644
--- a/lib/debian/wannabuild/db.py
+++ b/lib/debian/wannabuild/db.py
@@ -51,6 +51,7 @@ class DBFactory(object):
             Column('version', String, primary_key=True),
             Column('timestamp', DateTime, primary_key=True),
             Column('result', String),
+            Column('builder', String),
             Column('build_time', Integer),
             Column('disk_space', Integer),
             schema=arch)
-- 
1.7.5.4

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: