/[qa]/trunk/pts/www/bin/receive_auto.py
ViewVC logotype

Contents of /trunk/pts/www/bin/receive_auto.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 996 - (show annotations) (download) (as text)
Wed May 11 00:44:56 2005 UTC (8 years, 1 month ago) by jeroen
File MIME type: text/x-python
File size: 1605 byte(s)
Don't fall over on unexpected subjects of automated katie mails.
1 #!/usr/bin/python2.2
2
3 # Make sure tabs expand to 8 spaces in vim
4 # vim: expandtab
5
6 # Copyright 2002 Raphaƫl Hertzog
7 # This file is distributed under the terms of the General Public License
8 # version 2 or (at your option) any later version.
9
10 import os, os.path, sys, email, common, re
11
12 from config import dir, odir, root
13
14 os.umask(0002)
15 os.environ["PATH"] = "/bin:/sbin:/usr/bin:/usr/sbin"
16
17 parser = email.Parser.Parser()
18 msg = parser.parse(sys.stdin)
19
20 subject = msg.get("subject")
21 if subject == None:
22 sys.exit(0)
23 words = subject.split()
24
25 if len(words) > 1 and (words[0] == "Accepted" or words[0] == "Installed"):
26 if msg.get("subject").find("source") == -1:
27 sys.exit(0) # I only want source uploads
28 pkg = words[1]
29 common.store_news(pkg, msg)
30 elif msg.has_key("X-Katie"):
31 katie = msg.get("X-Katie").split()[0]
32 if katie != "melanie":
33 sys.exit("I don't understand non-melanie katie mails")
34 subject = msg.get("Subject")
35
36 msg["X-PTS-From"] = msg["Sender"]
37
38 # parse what source packages have been removed
39 body = msg.get_payload()
40 re_rmline = re.compile(r"^\s*(\S+)\s*\|\s*(\S+)\s*\|.*source", re.M)
41 source_removals = re_rmline.findall(body)
42 suite = re.search(r"have been removed from (\S+):", body).group(1)
43
44 for removal in source_removals:
45 pkg = removal[0]
46 version = removal[1]
47 msg["X-PTS-Subject"] = "Removed %s from %s" % (version, suite)
48 common.store_news(pkg, msg)
49
50 elif msg.has_key("X-Mailing-List"):
51 sys.exit(0) # silent drop
52 else:
53 sys.exit("This email address only accepts katie's mails.")
54

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5