[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Patch for removal rss feed



I like the RSS feed for removals but I'm not so happy that the title
doesn't mention the package names.

Ansgar pointed me to the dak git repo, and since the feed is created
with a perl script, I tried my luck and wrote a quick patch that adds
(part of) the package names to the title. -- Attached.

Would it be ok to apply this change or a similar one?

Thanks,
gregor

-- 
 .''`.   Homepage: http://info.comodo.priv.at/ - OpenPGP key ID: 0x8649AA06
 : :' :  Debian GNU/Linux user, admin, & developer - http://www.debian.org/
 `. `'   Member of VIBE!AT & SPI, fellow of Free Software Foundation Europe
   `-    NP: Donovan: Ballad of Geraldine
From a7de87fb65585448a5709b6b729793b0176b8d09 Mon Sep 17 00:00:00 2001
From: gregor herrmann <gregoa@debian.org>
Date: Fri, 11 Nov 2011 01:11:19 +0100
Subject: [PATCH] Add package names to title for items.

---
 config/backports/removalsrss.rc |    1 +
 config/debian/removalsrss.rc    |    1 +
 tools/removals.pl               |   12 ++++++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/config/backports/removalsrss.rc b/config/backports/removalsrss.rc
index 9473b73..92395b2 100644
--- a/config/backports/removalsrss.rc
+++ b/config/backports/removalsrss.rc
@@ -1,5 +1,6 @@
 input: /srv/backports-web.debian.org/underlay/removals.txt
 items: 16
+titlelength: 80
 
 title: Removals from Debian Backports
 link: http://backports-master.debian.org/dak/removals.txt
diff --git a/config/debian/removalsrss.rc b/config/debian/removalsrss.rc
index 446da97..833d331 100755
--- a/config/debian/removalsrss.rc
+++ b/config/debian/removalsrss.rc
@@ -1,5 +1,6 @@
 input: /srv/ftp.debian.org/web/removals.txt
 items: 16
+titlelength: 80
 
 title: Removals from Debian
 link: http://ftp-master.debian.org/removals.txt
diff --git a/tools/removals.pl b/tools/removals.pl
index 0689fff..d4392a4 100755
--- a/tools/removals.pl
+++ b/tools/removals.pl
@@ -78,7 +78,7 @@ $rss->channel(
 
 my $num_to_display = $config->{items};
 for my $removal (@removals ) {
-  my ($null, $date, $ftpmaster, $body, $reason);
+  my ($null, $date, $ftpmaster, $body, $packages, $reason);
   $removal =~ s/=========================================================================//g;
   $removal =~ m/\[Date: ([^]]+)\] \[ftpmaster: ([^]]+)\]/;
   $date = $1;
@@ -87,10 +87,18 @@ for my $removal (@removals ) {
   chomp $body;
   $body =~ m/---- Reason ---.*\n(.*)/;
   $reason = $1;
+  $packages = join( ", ",
+    map { ( my $p = $_ ) =~ s/^\s*(.+?) \|.+/$1/; $p }
+    grep {/.+\|.+\|.+/} split( /\n/, $body ) );
+  $packages
+    = ( substr $packages, 0,
+    ( $config->{titlelength} - length($reason) - 6 ) )
+    . " ..."
+    if length("$packages: $reason") > $config->{titlelength};
   my $link =  encode_base64($date . $ftpmaster);
   chomp($link);
 
-  $rss->add_item(title       => "$reason",
+  $rss->add_item(title       => "$packages: $reason",
 				 link        => $config->{link} . "?" . $link,
 				 description => qq[<pre>$body</pre>],
 				 dc => {
-- 
1.7.7.2

Attachment: signature.asc
Description: Digital signature


Reply to: