wok diff tazbb/stuff/tazbbmail @ rev 8692

Switch back to mercurial, home sweet home :)
author Antoine Bodin <gokhlayeh@slitaz.org>
date Thu Feb 17 19:06:05 2011 +0100 (2011-02-17)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tazbb/stuff/tazbbmail	Thu Feb 17 19:06:05 2011 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +#!/usr/bin/python
     1.5 +#
     1.6 +# Part of SliTaz Build Bot - Send mail with cooklog url to a maintainer.
     1.7 +# (C) 2009 SliTaz GNU/Linux project -  GNU gpl v3
     1.8 +#
     1.9 +
    1.10 +import sys
    1.11 +import smtplib
    1.12 +
    1.13 +# We need a package name.
    1.14 +if len(sys.argv) != 2:
    1.15 +	print "Usage: tazbbmail package"
    1.16 +	sys.exit(1)
    1.17 +
    1.18 +# From, package name, receipt for email and version.
    1.19 +mailer  = "tazbb@slitaz.org"
    1.20 +package = (sys.argv[1])
    1.21 +receipt = "/home/slitaz/wok/%s/receipt" % package
    1.22 +
    1.23 +for line in open(receipt) :
    1.24 +	if "VERSION=" in line:
    1.25 +		version = line.split('"')[1]
    1.26 +	if "MAINTAINER=" in line:
    1.27 +		mailto = line.split('"')[1]
    1.28 +
    1.29 +# Format mail.
    1.30 +subject = "[tazbb] Unbuilt %s Cooklog" % package
    1.31 +cooklog = "http://bb.slitaz.org/log/%s.log" % package
    1.32 +
    1.33 +message = """\
    1.34 +From: %s
    1.35 +To: %s
    1.36 +Subject: %s
    1.37 +
    1.38 +Package : %s
    1.39 +Version : %s
    1.40 +Cooklog : %s
    1.41 +
    1.42 +--
    1.43 +Tazbb Mailer
    1.44 +""" % (mailer, mailto, subject, package, version, cooklog)
    1.45 +
    1.46 +# Send mail.
    1.47 +try:
    1.48 +	server = smtplib.SMTP("localhost")
    1.49 +	server.sendmail(mailer, mailto, message)
    1.50 +	server.quit()
    1.51 +	print "Successfully sent mail to: %s" % mailto
    1.52 +except SMTPException:
    1.53 +	print "Unable to send mail"