def parse(headers, body):
        if headers.get('List-Id', '') != '<debian-bugs-closed.lists.debian.org>':
            return

        msg = BugClosedMessage()

        m = SUBJECT.match(headers['Subject'])
        if m:
            msg.bug_number = int(m.group(1))
            msg.title = m.group(2)
        else:
            return

        msg.by = headers['To']

        # Bug was closed via [email protected], so To: is wrong.
        if '*****@*****.**' in msg.by:
            msg.by = headers['From']

        # Let binary package name override binary package
        msg.package = headers.get('X-Debian-PR-Source', None)
        msg.package = headers.get('X-Debian-PR-Package', msg.package)

        if msg.package is None:
            return

        msg.title = tidy_bug_title(msg.title, msg.package)
        msg.by = format_email_address(msg.by)

        return msg
    def parse(headers, body, **kwargs):
        if headers.get('List-Id',
                       '') != '<debian-bugs-closed.lists.debian.org>':
            return

        m = SUBJECT.match(headers['Subject'])
        if not m:
            return

        msg = BugClosedMessage()
        msg.bug_number = int(m.group(1))
        msg.title = m.group(2)
        msg.by = headers['To']

        # Bug was closed via [email protected], so To: is wrong.
        if '*****@*****.**' in msg.by:
            msg.by = headers['From']

        # Let binary package name override binary package
        msg.package = headers.get('X-Debian-PR-Source', None)
        msg.package = headers.get('X-Debian-PR-Package', msg.package)

        if msg.package is None:
            return

        msg.title = tidy_bug_title(msg.title, msg.package)
        msg.by = format_email_address(msg.by)

        return msg
Пример #3
0
    def parse(headers, body, **kwargs):
        if headers.get("List-Id", "") != "<debian-bugs-closed.lists.debian.org>":
            return

        m = SUBJECT.match(headers["Subject"])
        if not m:
            return

        msg = BugClosedMessage()
        msg.bug_number = int(m.group(1))
        msg.title = m.group(2)
        msg.by = headers["To"]

        # Bug was closed via [email protected], so To: is wrong.
        if "*****@*****.**" in msg.by:
            msg.by = headers["From"]

        # Let binary package name override source package
        msg.package = headers.get("X-Debian-PR-Source", None)
        msg.package = headers.get("X-Debian-PR-Package", msg.package)

        if msg.package is None:
            return

        msg.title = tidy_bug_title(msg.title, msg.package)
        msg.by = format_email_address(msg.by)

        return msg
    def parse(headers, body, **kwargs):
        if headers.get('List-Id', '') not in lists:
            return

        mapping = {
            'Source': 'package',
            'Version': 'version',
            'Distribution': 'distribution',
            'Urgency': 'urgency',
            'Changed-By': 'by',
            'Closes': 'closes',
            'Maintainer': 'maintainer'
        }

        msg = AcceptedUploadMessage()
        for line in body:
            for field, target in mapping.iteritems():
                if line.startswith('%s: ' % field):
                    val = line[len(field) + 2:]
                    setattr(msg, target, val)
                    del mapping[field]
                    break

            # If we have found all the fields, stop looking
            if len(mapping) == 0:
                break

        if msg.by:
            msg.by = format_email_address(quoted_printable(msg.by))

        try:
            if msg.closes:
                msg.closes = [int(x) for x in msg.closes.split(' ')]
        except ValueError:
            return

        if msg.urgency:
            msg.urgency = msg.urgency.lower()

        if msg.maintainer:
            msg.maintainer = format_email_address(quoted_printable(msg.by))

        if 'new_queue' in kwargs:
            new_queue = kwargs['new_queue']
            msg.new_upload = new_queue.is_new(msg.package, msg.version)

        return msg
Пример #5
0
    def parse(headers, body, **kwargs):
        if headers.get('List-Id', '') not in lists:
            return

        mapping = {
            'Source': 'package',
            'Version': 'version',
            'Distribution': 'distribution',
            'Urgency': 'urgency',
            'Changed-By': 'by',
            'Closes': 'closes',
            'Maintainer': 'maintainer'
        }

        msg = AcceptedUploadMessage()
        for line in body:
            for field, target in mapping.iteritems():
                if line.startswith('%s: ' % field):
                    val = line[len(field) + 2:]
                    setattr(msg, target, val)
                    del mapping[field]
                    break

            # If we have found all the fields, stop looking
            if len(mapping) == 0:
                break

        if msg.by:
            msg.by = format_email_address(quoted_printable(msg.by))

        try:
            if msg.closes:
                msg.closes = [int(x) for x in msg.closes.split(' ')]
        except ValueError:
            return

        if msg.urgency:
            msg.urgency = msg.urgency.lower()

        if msg.maintainer:
            msg.maintainer = format_email_address(quoted_printable(msg.by))

        if 'new_queue' in kwargs:
            new_queue = kwargs['new_queue']
            msg.new_upload = new_queue.is_new(msg.package, msg.version)

        return msg
    def parse(headers, body, **kwargs):
        if headers.get('List-Id', '') != '<debian-bugs-dist.lists.debian.org>':
            return

        msg = BugSubmittedMessage()

        m = SUBJECT.match(headers['Subject'])
        if m:
            msg.bug_number = int(m.group(1))
            msg.title = m.group(2)
        else:
            return

        if not headers.get('X-Debian-PR-Message', '').startswith('report '):
            return

        msg.package = headers.get('X-Debian-PR-Package', None)
        if len(msg.package) >= 75:
            return

        msg.by = format_email_address(headers['From'])

        mapping = {
            VERSION: 'version',
            SEVERITY: 'severity',
        }

        for line in body[:10]:
            for pattern, target in mapping.iteritems():
                m = pattern.match(line)
                if m:
                    val = m.group(1).lower()
                    setattr(msg, target, val)
                    del mapping[pattern]
                    break

            if len(mapping.keys()) == 0:
                break

        if type(msg.version) is str and msg.version.find('GnuPG') != -1:
            msg.version = None

        if not msg.package:
            return

        msg.title = tidy_bug_title(msg.title, msg.package)

        return msg
    def parse(headers, body):
        if headers.get('List-Id', '') != '<debian-bugs-dist.lists.debian.org>':
            return

        msg = BugSubmittedMessage()

        m = SUBJECT.match(headers['Subject'])
        if m:
            msg.bug_number = int(m.group(1))
            msg.title = m.group(2)
        else:
            return

        if not headers.get('X-Debian-PR-Message', '').startswith('report '):
            return

        msg.package = headers.get('X-Debian-PR-Package', None)
        if len(msg.package) >= 75:
            return

        msg.by = format_email_address(headers['From'])

        mapping = {
            VERSION: 'version',
            SEVERITY: 'severity',
        }

        for line in body[:10]:
            for pattern, target in mapping.iteritems():
                m = pattern.match(line)
                if m:
                    val = m.group(1).lower()
                    setattr(msg, target, val)
                    del mapping[pattern]
                    break

            if len(mapping.keys()) == 0:
                break

        if type(msg.version) is str and msg.version.find('GnuPG') != -1:
            msg.version = None

        if not msg.package:
            return

        msg.title = tidy_bug_title(msg.title, msg.package)

        return msg
Пример #8
0
    def _maintainer(self, irc, msg, args, items):
        for package in items:
            info = Maintainer().get_maintainer(package)
            if info:
                display_name = format_email_address("%s <%s>" % (info['name'], info['email']), max_domain=18)

                login = info['email']
                if login.endswith('@debian.org'):
                    login = login.replace('@debian.org', '')

                msg = "[desc]Maintainer for[reset] [package]%s[reset] [desc]is[reset] [by]%s[reset]: " % (package, display_name)
                msg += "[url]http://qa.debian.org/developer.php?login=%s[/url]" % login
            else:
                msg = 'Unknown source package "%s"' % package

            irc.reply(colourise(msg), prefixNick=False)
Пример #9
0
    def _maintainer(self, irc, msg, args, items):
        for package in items:
            info = Maintainer().get_maintainer(package)
            if info:
                display_name = format_email_address("%s <%s>" % (info['name'], info['email']), max_domain=18)

                login = info['email']
                if login.endswith('@debian.org'):
                    login = login.replace('@debian.org', '')

                msg = "[desc]Maintainer for[reset] [package]%s[reset] [desc]is[reset] [by]%s[reset]: " % (package, display_name)
                msg += "[url]https://qa.debian.org/developer.php?login=%s[/url]" % login
            else:
                msg = 'Unknown source package "%s"' % package

            irc.reply(colourise(msg), prefixNick=False)
    def parse(headers, body, **kwargs):
        if headers.get("List-Id", "") not in lists:
            return

        mapping = {
            "Source": "package",
            "Version": "version",
            "Distribution": "distribution",
            "Urgency": "urgency",
            "Changed-By": "by",
            "Closes": "closes",
            "Maintainer": "maintainer",
        }

        msg = AcceptedUploadMessage()
        for line in body:
            for field, target in mapping.items():
                if line.startswith("%s: " % field):
                    val = line[len(field) + 2:]
                    setattr(msg, target, val)
                    del mapping[field]
                    break

            # If we have found all the fields, stop looking
            if len(mapping) == 0:
                break

        if msg.by:
            msg.by = format_email_address(quoted_printable(msg.by))

        try:
            if msg.closes:
                msg.closes = [int(x) for x in msg.closes.split(" ")]
        except ValueError:
            return

        if msg.urgency:
            msg.urgency = msg.urgency.lower()

        if "new_queue" in kwargs:
            new_queue = kwargs["new_queue"]
            msg.new_upload = new_queue.is_new(
                msg.package, msg.version) or new_queue.is_backports_new(
                    msg.package, msg.version)

        return msg
    def parse(headers, body, **kwargs):
        if headers.get("List-Id", "") != "<debian-bugs-dist.lists.debian.org>":
            return
        if not headers.get("X-Debian-PR-Message", "").startswith("report "):
            return

        msg = BugSubmittedMessage()

        m = SUBJECT.match(headers["Subject"])
        if m is None:
            return

        msg.bug_number = int(m.group(1))
        msg.title = m.group(2)

        msg.package = headers.get("X-Debian-PR-Package", None)
        if msg.package is None or len(msg.package) >= 75:
            return

        msg.by = format_email_address(headers["From"])

        mapping = {"version": VERSION, "severity": SEVERITY}
        for line in body[:10]:
            for target, pattern in mapping.items():
                m = pattern.match(line)
                if m:
                    val = m.group(1).lower()
                    setattr(msg, target, val)
                    del mapping[target]
                    break

            if not mapping.keys():
                break

        if type(msg.version) is str and msg.version.find("GnuPG") != -1:
            msg.version = None

        if not msg.package:
            return

        msg.title = tidy_bug_title(msg.title, msg.package)

        return msg
Пример #12
0
    def _maintainer(self, irc, msg, args, items):
        """Get maintainer for package."""
        for package in items:
            info = self.apt_archive.get_maintainer(package)
            if info:
                display_name = format_email_address(
                    "%s <%s>" % (info["name"], info["email"]), max_domain=18)

                login = info["email"]
                if login.endswith("@debian.org"):
                    login = login.replace("@debian.org", "")

                msg = (
                    "[desc]Maintainer for[reset] [package]%s[reset] [desc]is[reset] [by]%s[reset]: "
                    % (package, display_name))
                msg += "[url]https://qa.debian.org/developer.php?login=%s[/url]" % login
            else:
                msg = 'Unknown source package "%s"' % package

            irc.reply(colourise(msg), prefixNick=False)
    def parse(headers, body):
        if headers.get('List-Id', '') not in ('<debian-devel-changes.lists.debian.org>',
            '<debian-backports-changes.lists.debian.org>'):
            return

        msg = AcceptedUploadMessage()

        mapping = {
            'Source': 'package',
            'Version': 'version',
            'Distribution': 'distribution',
            'Urgency': 'urgency',
            'Changed-By': 'by',
            'Closes': 'closes',
        }

        for line in body:
            for field, target in mapping.iteritems():
                if line.startswith('%s: ' % field):
                    val = line[len(field) + 2:]
                    setattr(msg, target, val)
                    del mapping[field]
                    break

            # If we have found all the fields, stop looking
            if len(mapping) == 0:
                break

        if msg.by:
            msg.by = format_email_address(quoted_printable(msg.by))

        try:
            if msg.closes:
                msg.closes = [int(x) for x in msg.closes.split(' ')]
        except ValueError:
            return

        if msg.urgency:
            msg.urgency = msg.urgency.lower()

        return msg
 def _test(self, val, ret, max_user, max_domain):
     self.assertEqual(format_email_address(val, max_user=max_user,
         max_domain=max_domain), ret)
 def _test(self, val, ret):
     self.assertEqual(format_email_address(val, max_user=100, max_domain=100), ret)