#!/usr/bin/perl -w
-# $Id$
# read email with request from stdin and process it
+use Sys::Syslog;
+
+openlog("distfiles-rh", "pid", "user");
+
$spool_dir = "./spool";
$commits_list = "pld-cvs-commit\@lists.pld-linux.org";
sub report_fatal($)
{
my $msg = shift;
+
+ syslog("err","FATAL: $msg");
cleanup();
open(M, "| /usr/sbin/sendmail -t") or die("/usr/sbin/sendmail not found");
#open(M, "| cat") or die;
/^X-Flags: ([a-z0-9_ -]+)/i and $flags = $1;
}
-die "ill-formed request" if (!defined $from);
+if (!defined $from) {
+ syslog("err","FATAL: ill-formed request");
+ die "ill-formed request";
+}
+
+syslog("info","got request from $from for $spec at $branch ($flags)");
report_fatal("bad spec name") if (!defined $spec);
chdir($oldcwd);
+syslog("info","spooling to tmp/$id/to-spool");
open(S, "> tmp/$id/to-spool");
print S "$from\@pld-linux.org\n";
print S "$spec\n";
report_fatal("cannot parse $spec ($branch)")
}
-File::Copy::move("tmp/$id/to-spool", "$spool_dir/$id") or die("move failed: $!");
+if (!File::Copy::move("tmp/$id/to-spool", "$spool_dir/$id")) {
+ syslog("err","FATAL: move failed: $!");
+ die("move failed: $!");
+}
cleanup();