wok-stable view tazbb/stuff/tazbbmail @ rev 8842

Up: tazwok 4.2.1
author Antoine Bodin <gokhlayeh@slitaz.org>
date Fri Feb 25 00:21:51 2011 +0100 (2011-02-25)
parents
children
line source
1 #!/usr/bin/python
2 #
3 # Part of SliTaz Build Bot - Send mail with cooklog url to a maintainer.
4 # (C) 2009 SliTaz GNU/Linux project - GNU gpl v3
5 #
7 import sys
8 import smtplib
10 # We need a package name.
11 if len(sys.argv) != 2:
12 print "Usage: tazbbmail package"
13 sys.exit(1)
15 # From, package name, receipt for email and version.
16 mailer = "tazbb@slitaz.org"
17 package = (sys.argv[1])
18 receipt = "/home/slitaz/wok/%s/receipt" % package
20 for line in open(receipt) :
21 if "VERSION=" in line:
22 version = line.split('"')[1]
23 if "MAINTAINER=" in line:
24 mailto = line.split('"')[1]
26 # Format mail.
27 subject = "[tazbb] Unbuilt %s Cooklog" % package
28 cooklog = "http://bb.slitaz.org/log/%s.log" % package
30 message = """\
31 From: %s
32 To: %s
33 Subject: %s
35 Package : %s
36 Version : %s
37 Cooklog : %s
39 --
40 Tazbb Mailer
41 """ % (mailer, mailto, subject, package, version, cooklog)
43 # Send mail.
44 try:
45 server = smtplib.SMTP("localhost")
46 server.sendmail(mailer, mailto, message)
47 server.quit()
48 print "Successfully sent mail to: %s" % mailto
49 except SMTPException:
50 print "Unable to send mail"