/[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 932 - (show annotations) (download) (as text)
Sun Feb 6 01:39:26 2005 UTC (8 years, 4 months ago) by jeroen
File MIME type: text/x-python
File size: 1719 byte(s)
Don't mange existing headers, just add our own
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 if subject[:4] != "Bug#":
36 sys.exit("I cannot parse the subject!")
37 bug = subject.split(":")[0][4:]
38
39 msg["X-PTS-From"] = msg["Sender"]
40
41 # parse what source packages have been removed
42 body = msg.get_payload()
43 re_rmline = re.compile(r"^\s*(\S+)\s*\|\s*(\S+)\s*\|.*source", re.M)
44 source_removals = re_rmline.findall(body)
45 suite = re.search(r"have been removed from (\S+):", body).group(1)
46
47 for removal in source_removals:
48 pkg = removal[0]
49 version = removal[1]
50 msg["X-PTS-Subject"] = "Removed %s from %s" % (version, suite)
51 common.store_news(pkg, msg)
52
53 elif msg.has_key("X-Mailing-List"):
54 sys.exit(0) # silent drop
55 else:
56 sys.exit("This email address only accepts katie's mails.")
57

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5