From: martin@piware.de <> Date: Sun, 28 Jan 2007 12:32:11 +0000 (+0100) Subject: merge changes from server branch X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=e630f8d057665e5f0e1e1a48b3030320f28948a2;hp=9094406c4fdc2f83351bd5660b180ba703ee18eb;p=bin.git merge changes from server branch --- diff --git a/fixbug b/fixbug new file mode 100755 index 0000000..1238f90 --- /dev/null +++ b/fixbug @@ -0,0 +1,42 @@ +#!/usr/bin/python + +import os, os.path, sys, urllib, subprocess, smtplib + +if len(sys.argv) != 2: + print '''Usage: fixbug ''' + sys.exit (1) + +bug = int(sys.argv[1]) +desc = sys.stdin.read() + +# generate bug report +report = '' + +report += ''' status fixreleased + +%s +''' % desc + +# sign it +sign_command = 'gpg' +if os.access('/usr/bin/gnome-gpg', os.X_OK): + sign_command = 'gnome-gpg' + +gpg = subprocess.Popen([sign_command, '--clearsign'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) +signed_report = gpg.communicate(report)[0] +assert gpg.returncode == 0 + +# generate email +myemailaddr = os.getenv('DEBEMAIL') +assert myemailaddr +to = '%i@bugs.launchpad.net' % bug + +mail = '''From: %s +To: %s +Subject: Fixed + +%s''' % (myemailaddr, to, signed_report) + +s = smtplib.SMTP('fiordland.ubuntu.com') +s.sendmail(myemailaddr, to, mail) +s.quit()