]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'master' into bpo
authorJoerg Jaspert <joerg@debian.org>
Tue, 7 Sep 2010 22:21:13 +0000 (00:21 +0200)
committerJoerg Jaspert <joerg@debian.org>
Tue, 7 Sep 2010 22:21:13 +0000 (00:21 +0200)
* master:
  Call with the configfile as argument
  Add (C) for uli
  Use the right path
  add config file for removalsrss
  move removals.pl magic constants into config file

Signed-off-by: Joerg Jaspert <joerg@debian.org>
config/debian/cron.hourly
config/debian/removalsrss.rc [new file with mode: 0755]
tools/removals.pl

index 0c06b74f3c3196ad92d134b88c9788c53a07427c..30e81b59e0d8a20af82871e1ed56117272133f7b 100755 (executable)
@@ -21,6 +21,6 @@ cat removals-20*.822 > removals-full.822
 cat removals.822 >> removals-full.822
 
 $base/dak/tools/queue_rss.py -q $queuedir/new -o $webdir/rss/ -d $base/misc -l $base/log/
-$base/dak/tools/removals.pl > $webdir/rss/removals.rss
+$base/dak/tools/removals.pl $configdir/removalsrss.rc > $webdir/rss/removals.rss
 
 $scriptsdir/generate-di
diff --git a/config/debian/removalsrss.rc b/config/debian/removalsrss.rc
new file mode 100755 (executable)
index 0000000..446da97
--- /dev/null
@@ -0,0 +1,11 @@
+input: /srv/ftp.debian.org/web/removals.txt
+items: 16
+
+title: Removals from Debian
+link: http://ftp-master.debian.org/removals.txt
+description: List of all the removals from Debian's archives
+subject: Removals from Debian
+creator: tfheen@debian.org
+publisher: joerg@debian.org
+rights: Copyright 2005, Tollef Fog Heen
+language: en-us
index 062600bd86fb94b52edf2fc94deaf51fe1e6ca08..0689fffdfdbb324c8716c3d7a5dda76e960b7b37 100755 (executable)
@@ -2,6 +2,7 @@
 
 #    removals - generate an RSS feed of removals from Debian
 #    (C) Copyright 2005 Tollef Fog Heen <tfheen@err.no>
+#    (C) Copyright 2010 Uli Martens <uli@youam.net>
 #
 #    This program is free software; you can redistribute it and/or
 #    modify it under the terms of the GNU General Public License
@@ -26,7 +27,27 @@ use XML::RSS;
 use POSIX qw(strftime);
 use CGI qw/:standard/;
 
-open REMOVALS, "</srv/backports-web.debian.org/underlay/removals.txt";
+die "usage: $0 <configfile>\n" unless scalar @ARGV;
+
+my $config;
+
+my $cfgfname = $ARGV[0];
+open my $cfgfile, "<", $cfgfname
+       or die "config file $cfgfname not found: $!\n";
+while (<$cfgfile>){
+       chomp;
+       s/#.*//;
+       next if m/^$/;
+       my ($key, $val) = split ": ", $_, 2;
+       warn "$0: warning: redefining config key $key\n" if defined $config->{$key};
+       $config->{$key} = $val;
+}
+close $cfgfile;
+
+for ( qw/input items title link description subject creator publisher rights language/ ) {
+       die "config option '$_' missing in $cfgfname\n" unless $config->{$_};
+}
+open REMOVALS, "<", $config->{input};
 
 my @removals;
 
@@ -37,16 +58,16 @@ my @removals;
 
 my $rss = new XML::RSS (version => '1.0');
 $rss->channel(
-                         title        => "Removals from Debian",
-                         link         => "http://backports-master.debian.org/removals.txt",
-                         description  => "List of all the removals from Debian's archives",
+                         title        => $config->{title},
+                         link         => $config->{link},
+                         description  => $config->{description},
                          dc => {
                                         date       => POSIX::strftime ("%FT%R+00:00",gmtime()),
-                                        subject    => "Removals from Debian",
-                                        creator    => 'tfheen@debian.org',
-                                        publisher  => 'joerg@debian.org',
-                                        rights     => 'Copyright 2005, Tollef Fog Heen',
-                                        language   => 'en-us',
+                                        subject    => $config->{subject},
+                                        creator    => $config->{creator},
+                                        publisher  => $config->{publisher},
+                                        rights     => $config->{rights},
+                                        language   => $config->{language},
                                        },
                          syn => {
                                          updatePeriod     => "hourly",
@@ -55,7 +76,7 @@ $rss->channel(
                                         }
                         );
 
-my $num_to_display = 16;
+my $num_to_display = $config->{items};
 for my $removal (@removals ) {
   my ($null, $date, $ftpmaster, $body, $reason);
   $removal =~ s/=========================================================================//g;
@@ -70,7 +91,7 @@ for my $removal (@removals ) {
   chomp($link);
 
   $rss->add_item(title       => "$reason",
-                                link        => "http://backports-master.debian.org/removals.txt?" . $link,
+                                link        => $config->{link} . "?" . $link,
                                 description => qq[<pre>$body</pre>],
                                 dc => {
                                                creator => "$ftpmaster",