X-Git-Url: https://git.tld-linux.org/?p=TLD.git;a=blobdiff_plain;f=pld-builder.new%2FPLD_Builder%2Fnotify.py;fp=pld-builder.new%2FPLD_Builder%2Fnotify.py;h=5b0368f8a064a29833c9e0575cde0cdc831a103b;hp=0000000000000000000000000000000000000000;hb=90809c8fec988489786ce00247d9a4150070748b;hpb=ab3934fab858112cd552359b18cb980ea07c310b diff --git a/pld-builder.new/PLD_Builder/notify.py b/pld-builder.new/PLD_Builder/notify.py new file mode 100644 index 0000000..5b0368f --- /dev/null +++ b/pld-builder.new/PLD_Builder/notify.py @@ -0,0 +1,41 @@ +# vi: encoding=utf-8 ts=8 sts=4 sw=4 et + +import StringIO + +import mailer +import gpg +import util +import notifyq +from config import config + +class Notifier: + def __init__(self, g): + self.xml = StringIO.StringIO() + self.xml.write("\n" % \ + (g.id, config.builder)) + + def send(self, r): + sio = StringIO.StringIO() + self.xml.write("\n") + self.xml.seek(0) + sio.write(gpg.sign(self.xml.read())) + self.xml = None + sio.seek(0) + notifyq.init(r) + notifyq.add(sio) + notifyq.flush() + + def add_batch(self, b, s): + self.xml.write(" \n" % (b.b_id, s)) + +n = None + +def begin(group): + global n + n = Notifier(group) + +def add_batch(batch, status): + n.add_batch(batch, status) + +def send(r): + n.send(r)