]> git.pld-linux.org Git - projects/distfiles.git/commitdiff
- added flags support
authorMichal Moskal <michal@moskal.me>
Mon, 26 May 2003 23:44:48 +0000 (23:44 +0000)
committercvs2git <feedback@pld-linux.org>
Thu, 29 Nov 2012 22:58:13 +0000 (22:58 +0000)
- reply only if some files were fetched or force-reply flag is set

Changed files:
    file-fetcher.pl -> 1.4
    request-handler.pl -> 1.2

file-fetcher.pl
request-handler.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);
index 3b186fa07f8bdc1387afc756981772610c865e8d..f792337c8f08ed288697e5100723d6e5ba7825d5 100644 (file)
@@ -7,15 +7,18 @@ $email_cc = "";
 $spec = undef;
 $branch = "";
 $from = undef;
+$flags = "";
 
 $id = `uuidgen`;
 chomp $id;
 $id = rand if (!defined $id or $id eq "");
 
 while (<STDIN>) {
+  chomp;
   /^X-Spec: ([\+a-zA-Z0-9_\-]+\.spec)/i and $spec = $1;
   /^X-Branch: ([a-zA-Z0-9_\-]+)/i and $branch = $1;
   /^X-Login: ([a-zA-Z0-9_]+)/i and $from = $1;
+  /^X-Flags: ([a-zA-Z0-9\-_ ]+)/i and $flags = $1;
 }
 
 die "ill-formed request" if (!defined $from);
@@ -37,6 +40,7 @@ chdir("../..");
 
 open(S, "> tmp/$id/to-spool");
 print S "$from\@pld-linux.org\n";
+print S "$flags\n";
 close(S);
 
 if (system("./specparser.pl \"tmp/$id/SPECS/$spec\" >> tmp/$id/to-spool") != 0) {
This page took 0.108088 seconds and 4 git commands to generate.