Exemplo n.º 1
0
 def _buggraph(self, irc, msg, args, items):
     """Link to bug graph."""
     for package in items:
         msg = (
             "[desc]Bug graph for[reset] [package]%s[reset]: [url]https://qa.debian.org/data/bts/graphs/%s/%s.png[/url]"
             % (package, package[0], package))
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 2
0
 def _new(self, irc, msg, args):
     """Link to NEW queue."""
     line = (
         "[desc]NEW queue is[reset]: [url]%s[/url]. [desc]Current size is:[reset] %d"
         % ("https://ftp-master.debian.org/new.html",
            self.new_queue.get_size()))
     irc.reply(colourise(line))
Exemplo n.º 3
0
 def _buildd(self, irc, msg, args, items):
     """Link to buildd page."""
     for package in items:
         msg = (
             "[desc]buildd status for[reset] [package]%s[reset]: [url]https://buildd.debian.org/pkg.cgi?pkg=%s[/url]"
             % (package, package))
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 4
0
 def _testing(self, irc, msg, args, items):
     """Check testing migration status."""
     for package in items:
         msg = (
             "[desc]Testing migration status for[reset] [package]%s[reset]: [url]https://qa.debian.org/excuses.php?package=%s[/url]"
             % (package, package))
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 5
0
 def _popcon(self, irc, msg, args, package):
     try:
         msg = popcon(package)
         if msg:
             irc.reply(colourise(msg.for_irc()), prefixNick=False)
     except Exception, e:
         irc.reply("Error: unable to obtain popcon data for %s" % package)
Exemplo n.º 6
0
 def _popcon(self, irc, msg, args, package):
     try:
         msg = popcon(package)
         if msg:
             irc.reply(colourise(msg.for_irc()), prefixNick=False)
     except Exception, e:
         irc.reply("Error: unable to obtain popcon data for %s" % package)
Exemplo n.º 7
0
 def _popcon(self, irc, msg, args, package):
     """Get popcon data."""
     try:
         msg = popcon(package, self.requests_session)
         if msg:
             irc.reply(colourise(msg.for_irc()), prefixNick=False)
     except Exception as e:
         irc.reply("Error: unable to obtain popcon data for %s" % package)
Exemplo n.º 8
0
 def _qa(self, irc, msg, args, items):
     """Get link to QA page."""
     for package in items:
         url = "https://packages.qa.debian.org/%s/%s.html" % self.get_pool_url(
             package)
         msg = "[desc]QA page for[reset] [package]%s[reset]: [url]%s[/url]" % (
             package, url)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 9
0
 def _copyright(self, irc, msg, args, items):
     """Link to copyright files."""
     for package in items:
         url = "https://packages.debian.org/changelogs/pool/main/%s/%s/current/copyright" % self.get_pool_url(
             package)
         msg = "[desc]debian/copyright for[reset] [package]%s[reset]: [url]%s[/url]" % (
             package, url)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 10
0
 def _popcon(self, irc, msg, args, package):
     """Get popcon data."""
     try:
         msg = popcon(package, self.requests_session)
         if msg:
             irc.reply(colourise(msg.for_irc()), prefixNick=False)
     except Exception as e:
         irc.reply("Error: unable to obtain popcon data for %s" % package)
Exemplo n.º 11
0
    def _email_callback(self, fileobj):
        try:
            email = parse_mail(fileobj)
            msg = get_message(email, new_queue=self.new_queue)

            if not msg:
                return

            txt = colourise(msg.for_irc())

            # Simple flood/duplicate detection
            if txt in self.last_n_messages:
                return
            self.last_n_messages.insert(0, txt)
            self.last_n_messages = self.last_n_messages[:20]

            for channel in self.irc.state.channels:
                package_regex = self.registryValue(
                    'package_regex',
                    channel,
                ) or 'a^' # match nothing by default

                package_match = re.search(package_regex, msg.package)

                maintainer_match = False
                maintainer_regex = self.registryValue(
                    'maintainer_regex',
                    channel)
                if maintainer_regex:
                    info = Maintainer().get_maintainer(msg.package)
                    if info:
                        maintainer_match = re.search(maintainer_regex, info['email'])

                if not package_match and not maintainer_match:
                    continue

                distribution_regex = self.registryValue(
                    'distribution_regex',
                    channel,
                )

                if distribution_regex:
                    if not hasattr(msg, 'distribution'):
                        # If this channel has a distribution regex, don't
                        # bother continuing unless the message actually has a
                        # distribution. This filters security messages, etc.
                        continue

                    if not re.search(distribution_regex, msg.distribution):
                        # Distribution doesn't match regex; don't send this
                        # message.
                        continue

                ircmsg = supybot.ircmsgs.privmsg(channel, txt)
                self.irc.queueMsg(ircmsg)

        except Exception as e:
            log.exception('Uncaught exception: %s ' % e)
Exemplo n.º 12
0
 def bug(self, irc, msg, args, bug_string):
     try:
         msg = bug_synopsis(bug_string)
         if msg:
             irc.reply(colourise(msg.for_irc()), prefixNick=False)
     except ValueError:
         irc.reply('Could not parse bug number')
     except Exception, e:
         irc.reply("Error: %s" % e.message)
Exemplo n.º 13
0
 def _swirl(self, irc, msg, args):
     swirl = [
         "  [brightred] ,''`.[reset]",
         "  [brightred]: :' :[reset]           [b]Debian GNU/Linux[/b]",
         "  [brightred]`. `' [reset]           [url]http://www.debian.org/[/url]",
         "  [brightred]  `-  [reset]",
     ]
     for line in swirl:
         irc.reply(colourise(line), prefixNick=False)
Exemplo n.º 14
0
 def _swirl(self, irc, msg, args):
     swirl = [
         "  [brightred] ,''`.[reset]",
         "  [brightred]: :' :[reset]           [b]Debian GNU/Linux[/b]",
         "  [brightred]`. `' [reset]           [url]https://www.debian.org/[/url]",
         "  [brightred]  `-  [reset]",
     ]
     for line in swirl:
         irc.reply(colourise(line), prefixNick=False)
Exemplo n.º 15
0
 def _changelog(self, irc, msg, args, items):
     """Get link to changelog."""
     for package in items:
         url = (
             "https://packages.debian.org/changelogs/pool/main/%s/%s/current/changelog"
             % self.get_pool_url(package))
         msg = (
             "[desc]debian/changelog for[reset] [package]%s[reset]: [url]%s[/url]"
             % (package, url))
         irc.reply(colourise(msg), prefixNick=False)
        def testFunc(self, filename=filename):
            try:
                headers, body = parse_mail(file(filename))
                msg = parser.parse(headers, body)
            except Exception:
                print "Exception when parsing %s" % filename
                raise

            self.assertEqual(type(msg), expected_type,
                "%s did not match with its parser" % filename)
            self.assert_(test(msg), "%s did not pass test" % filename)

            if msg:
                txt = msg.format()
                txt = colourise(txt)
Exemplo n.º 17
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)
Exemplo n.º 18
0
    def madison(self, irc, msg, args, package):
        try:
            lines = madison(package)
            if not lines:
                irc.reply('Did not get a response -- is "%s" a valid package?' % package)
                return

            field_styles = ('package', 'version', 'distribution', 'section')
            for line in lines:
                out = []
                fields = line.strip().split('|', len(field_styles))
                for style, data in zip(field_styles, fields):
                    out.append('[%s]%s' % (style, data))
                irc.reply(colourise('[reset]|'.join(out)), prefixNick=False)
        except Exception, e:
            irc.reply("Error: %s" % e.message)
Exemplo n.º 19
0
    def madison(self, irc, msg, args, package):
        try:
            lines = madison(package)
            if not lines:
                irc.reply('Did not get a response -- is "%s" a valid package?' % package)
                return

            field_styles = ('package', 'version', 'distribution', 'section')
            for line in lines:
                out = []
                fields = line.strip().split('|', len(field_styles))
                for style, data in zip(field_styles, fields):
                    out.append('[%s]%s' % (style, data))
                irc.reply(colourise('[reset]|'.join(out)), prefixNick=False)
        except Exception, e:
            irc.reply("Error: %s" % e.message)
Exemplo n.º 20
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 testFunc(self, filename=filename):
            try:
                headers, body = parse_mail(file(filename))
                msg = parser.parse(headers, body)
            except Exception:
                print "Exception when parsing %s" % filename
                raise

            self.assertTrue(
                isinstance(msg, expected_type),
                "%s did not match with its parser: expected %s, got %s" %
                (filename, expected_type, type(msg)))
            self.assert_(test(msg), "%s did not pass test" % filename)

            if msg:
                txt = msg.format()
                txt = colourise(txt)
Exemplo n.º 22
0
        def testFunc(self, filename=filename):
            with open(filename, "rb") as infile:
                try:
                    headers, body = parse_mail(infile)
                    msg = parser.parse(headers, body)
                except Exception:
                    print("Exception when parsing %s" % filename)
                    raise

            self.assertTrue(
                isinstance(msg, expected_type),
                "%s did not match with its parser: expected %s, got %s" %
                    (filename, expected_type, type(msg)))
            self.assertTrue(test(msg), "%s did not pass test" % filename)

            if msg:
                txt = msg.format()
                txt = colourise(txt)
Exemplo n.º 23
0
    def madison(self, irc, msg, args, package):
        """List packages."""
        try:
            lines = madison(package)
            if not lines:
                irc.reply(
                    'Did not get a response -- is "%s" a valid package?' %
                    package)
                return

            field_styles = ("package", "version", "distribution", "section")
            for line in lines:
                out = []
                fields = line.strip().split("|", len(field_styles))
                for style, data in zip(field_styles, fields):
                    out.append("[%s]%s" % (style, data))
                irc.reply(colourise("[reset]|".join(out)), prefixNick=False)
        except Exception as e:
            irc.reply("Error: %s" % e.message)
Exemplo n.º 24
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)
Exemplo n.º 25
0
    def _email_callback(self, fileobj):
        try:
            email = parse_mail(fileobj)
            msg = get_message(email)

            if not msg:
                return

            txt = colourise(msg.for_irc())

            # Simple flood/duplicate detection
            if txt in self.last_n_messages:
                return
            self.last_n_messages.insert(0, txt)
            self.last_n_messages = self.last_n_messages[:20]

            for channel in self.irc.state.channels:
                regex = self.registryValue('package_regex', channel) or 'a^'
                if re.search(regex, msg.package):
                    ircmsg = supybot.ircmsgs.privmsg(channel, txt)
                    self.irc.queueMsg(ircmsg)

        except:
            log.exception('Uncaught exception')
Exemplo n.º 26
0
    def _email_callback(self, fileobj):
        try:
            emailmsg = parse_mail(fileobj)
            msg = get_message(emailmsg, new_queue=self.new_queue)

            if not msg:
                return

            txt = colourise(msg.for_irc())

            # Simple flood/duplicate detection
            if txt in self.last_n_messages:
                return
            self.last_n_messages.insert(0, txt)
            self.last_n_messages = self.last_n_messages[:20]

            maintainer_info = None
            if hasattr(msg, 'maintainer'):
                maintainer_info = (split_address(msg.maintainer), )
            else:
                maintainer_info = []
                for package in msg.package.split(','):
                    package = package.strip()
                    try:
                        maintainer_info.append(
                            self.apt_archive.get_maintainer(package))
                    except NewDataSource.DataError as e:
                        log.info("Failed to query maintainer for {}.".format(
                            package))

            for channel in self.irc.state.channels:
                package_regex = self.registryValue(
                    'package_regex',
                    channel,
                ) or 'a^'  # match nothing by default

                package_match = re.search(package_regex, msg.package)

                maintainer_match = False
                maintainer_regex = self.registryValue('maintainer_regex',
                                                      channel)
                if maintainer_regex and maintainer_info is not None and len(
                        maintainer_info) >= 0:
                    for mi in maintainer_info:
                        maintainer_match = re.search(maintainer_regex,
                                                     mi['email'])
                        if maintainer_match:
                            break

                if not package_match and not maintainer_match:
                    continue

                distribution_regex = self.registryValue(
                    'distribution_regex',
                    channel,
                )

                if distribution_regex:
                    if not hasattr(msg, 'distribution'):
                        # If this channel has a distribution regex, don't
                        # bother continuing unless the message actually has a
                        # distribution. This filters security messages, etc.
                        continue

                    if not re.search(distribution_regex, msg.distribution):
                        # Distribution doesn't match regex; don't send this
                        # message.
                        continue

                send_privmsg = self.registryValue('send_privmsg', channel)
                # Send NOTICE per default and if 'send_privmsg' is set for the
                # channel, send PRIVMSG instead.
                if send_privmsg:
                    ircmsg = supybot.ircmsgs.privmsg(channel, txt)
                else:
                    ircmsg = supybot.ircmsgs.notice(channel, txt)

                self.irc.queueMsg(ircmsg)

        except Exception as e:
            log.exception('Uncaught exception: %s ' % e)
Exemplo n.º 27
0
 def _buggraph(self, irc, msg, args, items):
     for package in items:
         msg = "[desc]Bug graph for[reset] [package]%s[reset]: [url]http://people.debian.org/~glandium/bts/%s/%s.png[/url]" % \
             (package, package[0], package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 28
0
 def _buildd(self, irc, msg, args, items):
     for package in items:
         msg = "[desc]buildd status for[reset] [package]%s[reset]: [url]http://buildd.debian.org/pkg.cgi?pkg=%s[/url]" % \
             (package, package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 29
0
    def _email_callback(self, fileobj):
        try:
            emailmsg = parse_mail(fileobj)
            msg = get_message(emailmsg, new_queue=self.new_queue)

            if not msg:
                return

            txt = colourise(msg.for_irc())

            # Simple flood/duplicate detection
            if txt in self.last_n_messages:
                return
            self.last_n_messages.insert(0, txt)
            self.last_n_messages = self.last_n_messages[:20]

            maintainer_info = None
            if hasattr(msg, 'maintainer'):
                maintainer_info = (split_address(msg.maintainer), )
            else:
                maintainer_info = []
                for package in msg.package.split(','):
                    package = package.strip()
                    try:
                        maintainer_info.append(self.apt_archive.get_maintainer(package))
                    except NewDataSource.DataError as e:
                        log.info("Failed to query maintainer for {}.".format(package))

            for channel in self.irc.state.channels:
                package_regex = self.registryValue(
                    'package_regex',
                    channel,
                ) or 'a^'  # match nothing by default

                package_match = re.search(package_regex, msg.package)

                maintainer_match = False
                maintainer_regex = self.registryValue(
                    'maintainer_regex',
                    channel)
                if maintainer_regex and maintainer_info is not None and len(maintainer_info) >= 0:
                    for mi in maintainer_info:
                        maintainer_match = re.search(maintainer_regex, mi['email'])
                        if maintainer_match:
                            break

                if not package_match and not maintainer_match:
                    continue

                distribution_regex = self.registryValue(
                    'distribution_regex',
                    channel,
                )

                if distribution_regex:
                    if not hasattr(msg, 'distribution'):
                        # If this channel has a distribution regex, don't
                        # bother continuing unless the message actually has a
                        # distribution. This filters security messages, etc.
                        continue

                    if not re.search(distribution_regex, msg.distribution):
                        # Distribution doesn't match regex; don't send this
                        # message.
                        continue

                send_privmsg = self.registryValue('send_privmsg', channel)
                # Send NOTICE per default and if 'send_privmsg' is set for the
                # channel, send PRIVMSG instead.
                if send_privmsg:
                    ircmsg = supybot.ircmsgs.privmsg(channel, txt)
                else:
                    ircmsg = supybot.ircmsgs.notice(channel, txt)

                self.irc.queueMsg(ircmsg)

        except Exception as e:
            log.exception('Uncaught exception: %s ' % e)
Exemplo n.º 30
0
 def _buggraph(self, irc, msg, args, items):
     """Link to bug graph."""
     for package in items:
         msg = "[desc]Bug graph for[reset] [package]%s[reset]: [url]https://qa.debian.org/data/bts/graphs/%s/%s.png[/url]" % \
             (package, package[0], package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 31
0
 def _testing(self, irc, msg, args, items):
     """Check testing migration status."""
     for package in items:
         msg = "[desc]Testing migration status for[reset] [package]%s[reset]: [url]https://qa.debian.org/excuses.php?package=%s[/url]" % \
             (package, package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 32
0
 def _testing(self, irc, msg, args, items):
     for package in items:
         msg = "[desc]Testing migration status for[reset] [package]%s[reset]: [url]http://release.debian.org/migration/testing.pl?package=%s[/url]" % \
             (package, package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 33
0
 def randombug(self, irc, msg, args):
     bug = random.choice(list(TestingRCBugs().get_bugs()))
     msg = "Your randomly chosen squeeze RC bug is: %s. Happy bugfixing!" % bug_synopsis(str(bug)).for_irc()
     irc.reply(colourise(msg))
Exemplo n.º 34
0
 def _copyright(self, irc, msg, args, items):
     for package in items:
         url = "http://packages.debian.org/changelogs/pool/main/%s/%s/current/copyright" % self.get_pool_url(package)
         msg = "[desc]debian/copyright for[reset] [package]%s[reset]: [url]%s[/url]" % (package, url)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 35
0
 def _buildde(self, irc, msg, args, items):
     for package in items:
         msg = "[desc]experimental/backports.org buildd status for[reset] [package]%s[reset]: [url]http://experimental.ftbfs.de/build.php?pkg=%s[/url]" % \
             (package, package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 36
0
 def _new(self, irc, msg, args):
     line = "[desc]NEW queue is[reset]: [url]%s[/url]. [desc]Current size is:[reset] %d" % \
         ("http://ftp-master.debian.org/new.html", NewQueue().get_size())
     irc.reply(colourise(line))
Exemplo n.º 37
0
 def _pas(self, irc, msg, args):
     line = "[desc]Packages-arch-specific[reset]: [url]http://cvs.debian.org/srcdep/Packages-arch-specific?root=dak&view=auto[/url]"
     irc.reply(colourise(line))
Exemplo n.º 38
0
 def _testing(self, irc, msg, args, items):
     for package in items:
         msg = "[desc]Testing migration status for[reset] [package]%s[reset]: [url]https://release.debian.org/migration/testing.pl?package=%s[/url]" % \
             (package, package)
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 39
0
 def _new(self, irc, msg, args):
     """Link to NEW queue."""
     line = "[desc]NEW queue is[reset]: [url]%s[/url]. [desc]Current size is:[reset] %d" % \
         ("https://ftp-master.debian.org/new.html", self.new_queue.get_size())
     irc.reply(colourise(line))
Exemplo n.º 40
0
 def _dehs(self, irc, msg, args, items):
     for package in items:
         msg = "[desc]Debian External Health Status for[reset] [package]%s[reset]: [url]http://dehs.alioth.debian.org/report.php?package=%s[/url]" % \
             (package, urllib.quote(package))
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 41
0
 def _dehs(self, irc, msg, args, items):
     """Link to DEHS."""
     for package in items:
         msg = "[desc]Debian External Health Status for[reset] [package]%s[reset]: [url]https://dehs.alioth.debian.org/report.php?package=%s[/url]" % \
             (package, urllib.parse.quote(package))
         irc.reply(colourise(msg), prefixNick=False)
Exemplo n.º 42
0
 def _qa(self, irc, msg, args, items):
     for package in items:
         url = "http://packages.qa.debian.org/%s/%s.html" % self.get_pool_url(package)
         msg = "[desc]QA page for[reset] [package]%s[reset]: [url]%s[/url]" % (package, url)
         irc.reply(colourise(msg), prefixNick=False)