2 # read email with request from stdin and process it
4 $spool_dir = "./spool";
14 $id = rand if (!defined $id or $id eq "");
18 /^X-Spec: ([\+a-zA-Z0-9_\-]+\.spec)/i and $spec = $1;
19 /^X-Branch: ([a-zA-Z0-9_\-]+)/i and $branch = $1;
20 /^X-Login: ([a-zA-Z0-9_]+)/i and $from = $1;
21 /^X-Flags: ([a-zA-Z0-9\-_ ]+)/i and $flags = $1;
24 die "ill-formed request" if (!defined $from);
26 report_fatal("bad spec name") if (!defined $spec);
28 mkdir("tmp/$id") or die;
31 $branch = "" if ($branch eq "HEAD");
32 $branch = "-r \"$branch\"" if ($branch ne "");
34 if (system("cvs get $branch \"SPECS/$spec\" >/dev/null 2>&1") != 0) {
36 report_fatal("cannot cvs get $spec at $branch")
41 open(S, "> tmp/$id/to-spool");
42 print S "$from\@pld-linux.org\n";
46 if (system("perl ./specparser.pl \"tmp/$id/SPECS/$spec\" >> tmp/$id/to-spool") != 0) {
47 report_fatal("cannot parse $spec ($branch)")
50 rename("tmp/$id/to-spool", "$spool_dir/$id");
60 open(M, "| /usr/sbin/sendmail -t") or die;
61 #open(M, "| cat") or die;
64 From: distfiles <feedback\@pld-linux.org>
65 To: $from\@pld-linux.org
67 Message-ID: <$id\@distfiles.pld-linux.org>
68 Subject: [distfiles] ERROR fetching sources for $spec ($branch)
69 X-distfiles-program: request-handler.pl
70 X-distfiles-version: $version
75 Virtually yours: distfiles.
84 system("rm -rf tmp/$id");