3 # read email with request from stdin and process it
5 $spool_dir = "./spool";
6 $commits_list = "pld-cvs-commit\@lists.pld-linux.org";
13 # ---------------------------------------------------------------
16 system("rm -rf tmp/$id");
23 open(M, "| /usr/sbin/sendmail -t") or die;
24 #open(M, "| cat") or die;
27 From: $from <$from\@pld-linux.org>
29 Cc: $from\@pld-linux.org
30 Message-ID: <$id\@distfiles.pld-linux.org>
31 Subject: DISTFILES: ERROR fetching sources for $spec ($branch)
32 X-distfiles-program: request-handler.pl
33 X-distfiles-version: $version
38 Virtually Yours: distfiles.
44 # ---------------------------------------------------------------
48 $id = rand if (!defined $id or $id eq "");
52 /^X-Spec: ([a-z0-9_.+-]+\.spec)/i and $spec = $1;
53 /^X-Branch: ([a-z0-9_-]+)/i and $branch = $1;
54 /^X-Login: ([a-z0-9_.]+)/i and $from = $1;
55 /^X-Flags: ([a-z0-9_ -]+)/i and $flags = $1;
58 die "ill-formed request" if (!defined $from);
60 report_fatal("bad spec name") if (!defined $spec);
62 mkdir("tmp/$id") or die;
65 $branch = "" if ($branch eq "HEAD");
66 $branch = "-r \"$branch\"" if ($branch ne "");
68 if (system("cvs -d :pserver:builder\@cvs.pld-linux.org:/cvsroot get $branch \"SPECS/$spec\" >/dev/null 2>&1") != 0) {
70 report_fatal("cannot cvs get $spec at $branch")
75 open(S, "> tmp/$id/to-spool");
76 print S "$from\@pld-linux.org\n";
80 if (system("perl ./specparser.pl \"tmp/$id/SPECS/$spec\" >> tmp/$id/to-spool") != 0) {
81 report_fatal("cannot parse $spec ($branch)")
84 rename("tmp/$id/to-spool", "$spool_dir/$id");