3 # removals - generate an RSS feed of removals from Debian
4 # (C) Copyright 2005 Tollef Fog Heen <tfheen@err.no>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # version 2 as published by the Free Software Foundation.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 use MIME::Base64 qw(encode_base64);
26 use POSIX qw(strftime);
27 use CGI qw/:standard/;
29 open REMOVALS, "</srv/ftp.debian.org/web/removals.txt";
34 local $/ = "=========================================================================\n=========================================================================";
35 @removals = reverse <REMOVALS>;
38 my $rss = new XML::RSS (version => '1.0');
40 title => "Removals from Debian",
41 link => "http://ftp-master.debian.org/removals.txt",
42 description => "List of all the removals from Debian's archives",
44 date => POSIX::strftime ("%FT%R+00:00",gmtime()),
45 subject => "Removals from Debian",
46 creator => 'tfheen@debian.org',
47 publisher => 'joerg@debian.org',
48 rights => 'Copyright 2005, Tollef Fog Heen',
52 updatePeriod => "hourly",
53 updateFrequency => "1",
54 updateBase => "1901-01-01T00:00+00:00",
58 my $num_to_display = 16;
59 for my $removal (@removals ) {
60 my ($null, $date, $ftpmaster, $body, $reason);
61 $removal =~ s/=========================================================================//g;
62 $removal =~ m/\[Date: ([^]]+)\] \[ftpmaster: ([^]]+)\]/;
65 ($null, $body) = split /\n/, $removal, 2;
67 $body =~ m/---- Reason ---.*\n(.*)/;
69 my $link = encode_base64($date . $ftpmaster);
72 $rss->add_item(title => "$reason",
73 link => "http://ftp-master.debian.org/removals.txt?" . $link,
74 description => qq[<pre>$body</pre>],
76 creator => "$ftpmaster",
81 last unless $num_to_display;
83 print $rss->as_string;