2 # read email with request from stdin and process it
4 $spool_dir = "./spool";
5 $commits_list = "pld-cvs-commit\@lists.pld-linux.org";
12 # ---------------------------------------------------------------
15 system("rm -rf tmp/$id");
22 open(M, "| /usr/sbin/sendmail -t") or die;
23 #open(M, "| cat") or die;
26 From: $from <$from\@pld-linux.org>
28 Cc: $from\@pld-linux.org
29 Message-ID: <$id\@distfiles.pld-linux.org>
30 Subject: DISTFILES: ERROR fetching sources for $spec ($branch)
31 X-distfiles-program: request-handler.pl
32 X-distfiles-version: $version
37 Virtually Yours: distfiles.
43 # ---------------------------------------------------------------
47 $id = rand if (!defined $id or $id eq "");
51 /^X-Spec: ([\+a-zA-Z0-9_\-\.]+\.spec)/i and $spec = $1;
52 /^X-Branch: ([a-zA-Z0-9_\-]+)/i and $branch = $1;
53 /^X-Login: ([a-zA-Z0-9_]+)/i and $from = $1;
54 /^X-Flags: ([a-zA-Z0-9\-_ ]+)/i and $flags = $1;
57 die "ill-formed request" if (!defined $from);
59 report_fatal("bad spec name") if (!defined $spec);
61 mkdir("tmp/$id") or die;
64 $branch = "" if ($branch eq "HEAD");
65 $branch = "-r \"$branch\"" if ($branch ne "");
67 if (system("cvs -d :pserver:builder\@cvs.pld-linux.org:/cvsroot get $branch \"SPECS/$spec\" >/dev/null 2>&1") != 0) {
69 report_fatal("cannot cvs get $spec at $branch")
74 open(S, "> tmp/$id/to-spool");
75 print S "$from\@pld-linux.org\n";
79 if (system("perl ./specparser.pl \"tmp/$id/SPECS/$spec\" >> tmp/$id/to-spool") != 0) {
80 report_fatal("cannot parse $spec ($branch)")
83 rename("tmp/$id/to-spool", "$spool_dir/$id");