]> git.donarmstrong.com Git - infobot.git/blob - src/Modules/DebianExtra.pl
Initial revision
[infobot.git] / src / Modules / DebianExtra.pl
1 #
2 #  DebianExtra.pl: Extra stuff for debian
3 #          Author: xk <xk@leguin.openprojects.net>
4 #         Version: v0.1 (20000520)
5 #         Created: 20000520
6 #
7
8 use strict;
9
10 my $bugs_url = "http://master.debian.org/~wakkerma/bugs";
11
12 sub debianBugs {
13     my @results = &main::getURL($bugs_url);
14     my ($date, $rcbugs, $remove);
15     my ($bugs_closed, $bugs_opened) = (0,0);
16
17     if (scalar @results) {
18         foreach (@results) {
19             s/<.*?>//g;
20             $date   = $1 if (/status at (.*)\s*$/);
21             $rcbugs = $1 if (/bugs: (\d+)/);
22             $remove = $1 if (/REMOVE\S+ (\d+)\s*$/);
23             if (/^(\d+) r\S+ b\S+ w\S+ c\S+ a\S+ (\d+)/) {
24                 $bugs_closed = $1;
25                 $bugs_opened = $2;
26             }
27         }
28         my $xtxt = ($bugs_closed >=$bugs_opened) ?
29                         "It's good to see " :
30                         "Oh no, the bug count is rising -- ";
31
32         &main::performStrictReply(
33                 "Debian bugs statistics, last updated on $date... ".
34                 "There are \002$rcbugs\002 release-critical bugs;  $xtxt".
35                 "\002$bugs_closed\002 bugs closed, opening \002$bugs_opened\002 bugs.  ".
36                 "About \002$remove\002 packages will be removed."
37         );
38     } else {
39         &main::msg($main::who, "Couldn't retrieve data for debian bug stats.");
40     }
41 }
42
43 1;