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

[dak/master] fix removals rss feed when there are fewer than 16 removals



To: joerg@debian.org
Date: Fri, 02 Jan 2009 23:28:02 +0100
X-Spam-Status: No, score=-3.586 tagged_above=-99 required=4.6 tests=[AWL=0.013, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
User-Agent: Mutt/1.5.18 (2008-05-17)

tools/removals.pl was making the assumption that at least 16 removals exist in
removals.txt.  If there are not, it creates and rss feed with with bogus empty
removals to pad the output to 16 entries.  This patch removes this false
assumption.

Signed-off-by: Mike O'Connor <stew@debian.org>
Signed-off-by: Joerg Jaspert <joerg@debian.org>
---
 tools/removals.pl |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/removals.pl b/tools/removals.pl
index ec65f15..b07845b 100755
--- a/tools/removals.pl
+++ b/tools/removals.pl
@@ -55,14 +55,14 @@ $rss->channel(
 					 }
 			 );
 
-for (0..15) {
-  my $i = $_;
+my $num_to_display = 16;
+for my $removal (@removals ) {
   my ($null, $date, $ftpmaster, $body, $reason);
-  $removals[$i] =~ s/=========================================================================//g;
-  $removals[$i] =~ m/\[Date: ([^]]+)\] \[ftpmaster: ([^]]+)\]/;
+  $removal =~ s/=========================================================================//g;
+  $removal =~ m/\[Date: ([^]]+)\] \[ftpmaster: ([^]]+)\]/;
   $date = $1;
   $ftpmaster = $2;
-  ($null, $body) = split /\n/, $removals[$i], 2;
+  ($null, $body) = split /\n/, $removal, 2;
   chomp $body;
   $body =~ m/---- Reason ---.*\n(.*)/;
   $reason = $1;
@@ -77,5 +77,7 @@ for (0..15) {
 					   }
 				);
 
+  $num_to_display -= 1;
+  last unless $num_to_display;
 }
 print $rss->as_string;
-- 
1.5.6.5


Reply to: