#!/usr/bin/python import sys import os import sys ############## # programs to invoke TLA = "/opt/tla/bin/tla" SENDMAIL = "/usr/lib/sendmail -bm -t" # where to send TARGETS = {'straw': 'straw-commits@nongnu.org'} ############## action = sys.argv[1] archive = os.getenv('ARCH_ARCHIVE') if action == 'commit': revision = os.getenv('ARCH_REVISION') category, branch, version, rname = revision.split('--') 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()