- 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
$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()
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/) {
return "$md5_dir/$basename";
}
-sub install_dir($)
+sub install_dir
{
my $dir = shift;
return if (-e $dir);
$problems .= "FATAL: cannot mv file ($url)\n";
} else {
$normal_out .= "STORED: $url ($md5, " . (-s $path) . " bytes)\n";
+ $fetched_count++;
}
}
X-distfiles-version: " . '$Id$' . "
$problems
+Files fetched: $fetched_count
+
$normal_out
--
find_file_in_spool();
read_spool_file();
fetch_files();
-send_email();
+send_email() unless (!$force_reply and $problems eq "" and $fetched_count == 0);
$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);
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) {