From a6d13a49a335b9af47598e52822496d920c33c9d Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Sun, 28 Jan 2007 13:29:25 +0100 Subject: [PATCH] add fixbug --- fixbug | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 fixbug 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() -- 2.39.2