]> git.pld-linux.org Git - projects/distfiles.git/blobdiff - file-fetcher.pl
- added flags support
[projects/distfiles.git] / file-fetcher.pl
index 44150ff3e8b7182ff2489e59581c673ff5f9f697..cbc6ed7c09f7105d4d410b11151df049f894d75c 100644 (file)
@@ -12,6 +12,8 @@ $problems = "";
 $normal_out = "";
 $requester = "";
 $file = "";
+$fetched_count = 0;
+$force_reply = 0;
 
 # try lookup some file in spool, exit if it cannot be done
 sub find_file_in_spool()
@@ -39,6 +41,8 @@ sub read_spool_file()
   chomp $requester;
   $requester =~ /^[a-zA-Z_\-0-9\@\.]+$/ 
        or die "$file: evil requester: $requester";
+  my $flags = <F>;
+  $force_reply++ if ($flags =~ /force-reply/);
        
   while (<F>) {
     if (/^ERROR/) {
@@ -67,7 +71,7 @@ sub file_path($$)
   return "$md5_dir/$basename";
 }
 
-sub install_dir($)
+sub install_dir
 {
   my $dir = shift;
   return if (-e $dir);
@@ -87,6 +91,7 @@ sub move_file($$)
     $problems .= "FATAL: cannot mv file ($url)\n";
   } else {
     $normal_out .= "STORED: $url ($md5, " .  (-s $path) . " bytes)\n";
+    $fetched_count++;
   }
 }
 
@@ -150,6 +155,8 @@ X-distfiles-program: file-fetcher.pl
 X-distfiles-version: " . '$Id$' . "
 
 $problems
+Files fetched: $fetched_count
+
 $normal_out
 
 -- 
@@ -161,4 +168,4 @@ Virtually yours: distfiles.
 find_file_in_spool();
 read_spool_file();
 fetch_files();
-send_email();
+send_email() unless (!$force_reply and $problems eq "" and $fetched_count == 0);
This page took 0.046821 seconds and 4 git commands to generate.