]> piware.de Git - bin.git/blob - fixbug
postinst-setup: do not trash shadow group
[bin.git] / fixbug
1 #!/usr/bin/python
2
3 import os, os.path, sys, urllib, subprocess, smtplib
4
5 if len(sys.argv) != 2:
6     print '''Usage: fixbug <bug number>'''
7     sys.exit (1)
8
9 bug = int(sys.argv[1])
10 desc = sys.stdin.read()
11
12 # generate bug report
13 report = ''
14
15 report += ''' status fixreleased
16
17 %s
18 ''' % desc
19
20 # sign it
21 sign_command = 'gpg'
22 if os.access('/usr/bin/gnome-gpg', os.X_OK):
23     sign_command = 'gnome-gpg'
24
25 gpg = subprocess.Popen([sign_command, '--clearsign'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
26 signed_report = gpg.communicate(report)[0]
27 assert gpg.returncode == 0
28
29 # generate email
30 myemailaddr = os.getenv('DEBEMAIL')
31 assert myemailaddr
32 to = '%i@bugs.launchpad.net' % bug
33
34 mail = '''From: %s
35 To: %s
36 Subject: Fixed
37
38 %s''' % (myemailaddr, to, signed_report)
39
40 s = smtplib.SMTP('fiordland.ubuntu.com')
41 s.sendmail(myemailaddr, to, mail)
42 s.quit()