create-package-feed.pl: Bump maxlimit to 1000 and die when it's reached
authorFabian Keil <fk@fabiankeil.de>
Sat, 16 Jul 2016 11:41:52 +0000 (11:41 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sat, 16 Jul 2016 11:41:52 +0000 (11:41 +0000)
The goal of maxlimit seemed to be to limit the items in
the feed, but as it triggered before the items were sorted
it resulted in incorrect results.

Once the current limit is reached, the script should probably be
refactored to be more efficient.

utils/create-package-feed.pl

index ef8b6d3..07a7e17 100644 (file)
@@ -10,7 +10,7 @@ my @days   = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
 my $scan_dir   = '/xxxxxxxxxxxxxxxxxxxxxx/sf-download/';
 my $base_dlurl = 'https://www.privoxy.org/sf-download-mirror/';
 my $save_rss_file ='/xxxxxxxxxxxxxxxxxxxxxx/release.xml'; # e.g., release.rss
-my $maxlimit = 10;
+my $maxlimit = 1000;
 
 #< Config END >
 
@@ -35,7 +35,7 @@ my $target_line;
 # 1st & 2nd directory should NOT contain ANY 'FILES'. (expecting only 'Directory')
 #
 opendir(D1, $scan_dir) or die "Can't open 1st directory! /";
-MOUT: while (my $fi1 = readdir(D1)) {
+while (my $fi1 = readdir(D1)) {
     next if ($fi1 =~ m/^\./);
 
     opendir(D2, $scan_dir . $fi1 . '/')
@@ -92,7 +92,7 @@ MOUT: while (my $fi1 = readdir(D1)) {
             # Add it to Array
             $Array[$i] = ([$target_time, $target_line]);
             $i++;
-            if ($i >= $maxlimit) { last MOUT; }
+            die "maxlimit $maxlimit reached!" unless ($i < $maxlimit);
         }
         closedir D3;
 ## end listing /OS/Version/FILE