/[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 1350 - (show annotations) (download) (as text)
Sun Jun 11 17:47:37 2006 UTC (7 years ago) by hertzog
File MIME type: text/x-python
File size: 1860 byte(s)
Use X-DAK new header. Only check on X-Testing-Watch-Package for henning's mails until it's integrated in dak.
1 #!/usr/bin/python
2 # -*- coding: utf8 -*-
3
4 # Make sure tabs expand to 8 spaces in vim
5 # vim: expandtab
6
7 # Copyright 2002 Raphaƫl Hertzog
8 # This file is distributed under the terms of the General Public License
9 # version 2 or (at your option) any later version.
10
11 import os, os.path, sys, email, common, re
12
13 from config import dir, odir, root
14
15 os.nice(19)
16 os.umask(0002)
17 os.environ["PATH"] = "/bin:/sbin:/usr/bin:/usr/sbin"
18
19 #parser = email.Parser.Parser()
20 msg = email.message_from_file(sys.stdin)
21
22 subject = msg.get("subject")
23 if subject == None:
24 sys.exit(0)
25 words = subject.split()
26
27 if len(words) > 1 and (words[0] == "Accepted" or words[0] == "Installed"):
28 if msg.get("subject").find("source") == -1:
29 sys.exit(0) # I only want source uploads
30 pkg = words[1]
31 common.store_news(pkg, msg)
32 elif msg.has_key("X-DAK"):
33 katie = msg.get("X-DAK").split()[1]
34 if katie == "rm":
35 subject = msg.get("Subject")
36
37 msg["X-PTS-From"] = msg["Sender"]
38
39 # parse what source packages have been removed
40 body = msg.get_payload()
41 re_rmline = re.compile(r"^\s*(\S+)\s*\|\s*(\S+)\s*\|.*source", re.M)
42 source_removals = re_rmline.findall(body)
43 suite = re.search(r"have been removed from (\S+):", body).group(1)
44
45 for removal in source_removals:
46 pkg = removal[0]
47 version = removal[1]
48 msg["X-PTS-Subject"] = "Removed %s from %s" % (version, suite)
49 common.store_news(pkg, msg)
50 else:
51 sys.exit("I only understand 'dak rm' mails at this address")
52 elif msg.has_key("X-Testing-Watch-Package"):
53 msg["X-PTS-From"] = "Britney"
54 pkg = msg.get("X-Testing-Watch-Package")
55 common.store_news(pkg, msg)
56 elif msg.has_key("X-Mailing-List"):
57 sys.exit(0) # silent drop
58 else:
59 sys.exit("This email address only accepts katie's mails.")
60

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5