2
# Launchpad prevu wrapper
3
# USAGE: lprevu <bugno/bugurl> <package>
5
SOURCE_EMAIL="john.dong@gmail.com" # Change me. Must be a LP registered e-mail account
8
##################################
15
buf=cStringIO.StringIO()
16
for line in l: buf.write(line)
21
if line.startswith('-> Built Package'):
23
return strcat(pkglines)
26
# Turns a Launchpad URL into a bug number
27
for token in url.split('/'):
29
if int(token) > 0: return token
30
except ValueError: pass
31
raise ValueError, "Couldn't detect launchpad bug number from: ".join(url)
35
p=os.popen('sendmail -t', 'w')
36
p.write('To: %s\n' % dst)
37
p.write('From: %s\n' % SOURCE_EMAIL)
43
print "WARNING: sendmail unsuccessful!"
47
def do_build(bugno,pkg):
49
mail("%s@bugs.launchpad.net" % bugno,
51
This is an automated build message from my prevu client.\nBUILD STARTED.\n A build of package '%s' has been started. Upon the build finishing, another notification will be sent out with the results.
53
p=os.popen('TERM=linux prevu %s 2>&1' % pkg,'r')
62
mail("%s@bugs.launchpad.net" % bugno,
64
This is an automated build message from my prevu client.\nBUILD FAILED.\n Unfortunately, the build has failed. Here's the last 20 lines:
69
""" % (lines[0],strcat(lines[-25:-5])) )
71
mail("%s@bugs.launchpad.net" % bugno,
73
This is an automated build message from my prevu client.\nBUILD SUCCESS.\n The build has succeeded. A Backports developer will manually test the package to ensure it runs properly.
76
""" % findbuilt(lines) )
79
bugno=parse_url(sys.argv[1])