]> git.pld-linux.org Git - projects/distfiles.git/blobdiff - request-handler.pl
- add alternative passive-ftp; untested
[projects/distfiles.git] / request-handler.pl
index f792337c8f08ed288697e5100723d6e5ba7825d5..b0720e9a5eced5d4c3ab5d796bea71c2e282670e 100644 (file)
@@ -1,21 +1,54 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
 # read email with request from stdin and process it
 
 $spool_dir = "./spool";
-$email_cc = "";
+$commits_list = "pld-cvs-commit\@pld-linux.org";
 
 $spec = undef;
 $branch = "";
 $from = undef;
 $flags = "";
 
+# ---------------------------------------------------------------
+sub cleanup()
+{
+  system("rm -rf tmp/$id");
+}
+
+sub report_fatal($)
+{
+  my $msg = shift;
+  cleanup();
+  open(M, "| /usr/sbin/sendmail -t") or die;
+  #open(M, "| cat") or die;
+  my $version = '$Id$';
+  print M <<EOF
+From: $from <$from\@pld-linux.org>
+To: $commits_list
+Cc: $from\@pld-linux.org
+Message-ID: <$id\@distfiles.pld-linux.org>
+Subject: DISTFILES: ERROR fetching sources for $spec ($branch)
+X-distfiles-program: request-handler.pl
+X-distfiles-version: $version
+
+$msg
+
+-- 
+Virtually Yours: distfiles.
+EOF
+;
+  close(M) or die;
+  exit 0;
+}
+# ---------------------------------------------------------------
+
 $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-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;
@@ -43,7 +76,7 @@ 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) {
+if (system("perl ./specparser.pl \"tmp/$id/SPECS/$spec\" >> tmp/$id/to-spool") != 0) {
   report_fatal("cannot parse $spec ($branch)")
 }
 
@@ -53,33 +86,3 @@ cleanup();
 
 exit(0);
 
-sub report_fatal($)
-{
-  my $msg = shift;
-  cleanup();
-  #open(M, "| /usr/sbin/sendmail -t") or die;
-  open(M, "| cat") or die;
-  my $version = '$Id$';
-  print M <<EOF
-From: distfiles <feedback\@pld-linux.org>
-To: $from\@pld-linux.org
-Cc: $email_cc
-Message-ID: <$id\@distfiles.pld-linux.org>
-Subject: [distfiles] ERROR fetching sources for $spec ($branch)
-X-distfiles-program: request-handler.pl
-X-distfiles-version: $version
-
-$msg
-
--- 
-Virtually yours: distfiles.
-EOF
-;
-  close(M) or die;
-  exit 0;
-}
-
-sub cleanup()
-{
-  system("rm -rf tmp/$id");
-}
This page took 0.049742 seconds and 4 git commands to generate.