# HG changeset patch # User Christophe Lincoln # Date 1246146653 -7200 # Node ID 28ce60b11e25ac4860c6555019c53e5203cdf8b5 # Parent d1675d1771245bd4806a0eb0a2a485a32dfcf468 tazbb: Add tazbbmail (Python mailer for unbuilt pkgs) diff -r d1675d177124 -r 28ce60b11e25 tazbb/receipt --- a/tazbb/receipt Sat Jun 27 22:23:09 2009 +0200 +++ b/tazbb/receipt Sun Jun 28 01:50:53 2009 +0200 @@ -1,11 +1,12 @@ # SliTaz package receipt. PACKAGE="tazbb" -VERSION="1.0" +VERSION="1.1" CATEGORY="development" -SHORT_DESC="SliTaz Build bot." +SHORT_DESC="SliTaz Build Bot." MAINTAINER="pankso@slitaz.org" -DEPENDS="tazpkg tazwok mercurial slitaz-toolchain" +DEPENDS="tazpkg tazwok python mercurial" +SUGGESTED="slitaz-toolchain postfix" WEB_SITE="http://labs.slitaz.org/wiki/distro/Bb" # Rules to gen a SliTaz package suitable for Tazpkg. @@ -17,6 +18,7 @@ $fs/var/lib/tazbb \ $fs/var/log/tazbb cp stuff/tazbb $fs/usr/bin + cp stuff/tazbbmail $fs/usr/bin cp stuff/tazbb.conf $fs/etc/slitaz cp -a stuff/web $fs/var/lib/tazbb chmod 755 $fs/usr/bin/* diff -r d1675d177124 -r 28ce60b11e25 tazbb/stuff/tazbb --- a/tazbb/stuff/tazbb Sat Jun 27 22:23:09 2009 +0200 +++ b/tazbb/stuff/tazbb Sun Jun 28 01:50:53 2009 +0200 @@ -48,6 +48,7 @@ cook-commit Cook all packages affected by a commit in the last update. test-pkgs Execute a test suite on all packages [--verbose]. [un]block Block or unblock a package to skip or enable building. + mail Sent mail to packahe maitainer with tazbbmail. clean-up Remove old packages [--verbose|--dry-run]. clean-log Remove all generated build log files.\n" } @@ -485,6 +486,10 @@ # test_packages $@ script -c "tazwok check" $LOG_DIR/test-suite.log ;; + mail) + # Tazbbmail Pythom script wrapper. + PACKAGE=$2 + tazbbmail $PACKAGE ;; clean-up) # Remove old packages and generate new packages lists. update_wok $@ diff -r d1675d177124 -r 28ce60b11e25 tazbb/stuff/tazbbmail --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tazbb/stuff/tazbbmail Sun Jun 28 01:50:53 2009 +0200 @@ -0,0 +1,50 @@ +#!/usr/bin/python +# +# Part of SliTaz Build Bot - Send mail with cooklog url to a maintainer. +# (C) 2009 SliTaz GNU/Linux project - GNU gpl v3 +# + +import sys +import smtplib + +# We need a package name. +if len(sys.argv) != 2: + print "Usage: tazbbmail package" + sys.exit(1) + +# From, package name, receipt for email and version. +mailer = "tazbb@slitaz.org" +package = (sys.argv[1]) +receipt = "/home/slitaz/wok/%s/receipt" % package + +for line in open(receipt) : + if "VERSION=" in line: + version = line.split('"')[1] + if "MAINTAINER=" in line: + mailto = line.split('"')[1] + +# Format mail. +subject = "[tazbb] Unbuilt %s Cooklog" % package +cooklog = "http://bb.slitaz.org/log/%s.log" % package + +message = """\ +From: %s +To: %s +Subject: %s + +Package : %s +Version : %s +Cooklog : %s + +-- +Tazbb Mailer +""" % (mailer, mailto, subject, package, version, cooklog) + +# Send mail. +try: + server = smtplib.SMTP("localhost") + server.sendmail(mailer, mailto, message) + server.quit() + print "Successfully sent mail to: %s" % mailto +except SMTPException: + print "Unable to send mail"