#!/usr/bin/python import sys import os import sys ############## # programs to invoke TLA = "/opt/tla/bin/tla" SENDMAIL = "/usr/lib/sendmail -bm -t -f address@hidden" # where to send TARGETS = {'straw': 'address@hidden'} ############## action = sys.argv[1] revision = os.getenv('ARCH_REVISION') archive = os.getenv('ARCH_ARCHIVE') category, branch, version, rname = revision.split('--') if action == 'commit': target = TARGETS.get(category, None) if target is not None: tlain, tlaout = os.popen2('%s cat-archive-log %s' % (TLA, revision)) changes = tlaout.read() sendmailin = os.popen(SENDMAIL, "w") sendmailin.write("Subject: %s/%s\n" % (archive, revision)) sendmailin.write("To: %s\n" % target) sendmailin.write("\n") sendmailin.write(changes) sendmailin.close()