mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-10-31 05:54:03 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			82 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
| # Used Martin Pitt's excellent  requestsync  script, to get this started.
 | |
| 
 | |
| #!/usr/bin/env python
 | |
| 
 | |
| import os, os.path, sys, subprocess 
 | |
| 
 | |
| subject = ""
 | |
| assignee = ""
 | |
| report = ""
 | |
| pack_list = set()
 | |
| 
 | |
| instructions_file_name = "instructions"
 | |
| list_file_name = "list"
 | |
| 
 | |
| def read_config():
 | |
| 	global subject, assignee, report
 | |
| 	for line in open(os.getcwd()+"/"+instructions_file_name).readlines():
 | |
| 		if line.startswith("subject:"):
 | |
| 			subject = line.split("subject: ")[1]
 | |
| 		else:
 | |
| 			if line.startswith("assignee:"):
 | |
| 				assignee = line.split("assignee: ")[1]
 | |
| 			else:
 | |
| 				report += line
 | |
| 
 | |
| def read_list():
 | |
| 	global pack_list
 | |
| 	for line in open(os.getcwd()+"/"+list_file_name).readlines():
 | |
| 		if line.strip()!="":
 | |
| 			pack_list.add(line.strip("\n"))
 | |
| 
 | |
| #
 | |
| # entry point
 | |
| #
 | |
| 
 | |
| if os.path.exists(os.getcwd()+"/"+instructions_file_name):
 | |
| 	read_config()
 | |
| else:
 | |
| 	print "%s does not exists." % (os.getcwd()+"/"+instructions_file_name)
 | |
| 	sys.exit(1)
 | |
| 	
 | |
| if os.path.exists(os.getcwd()+"/"+list_file_name):
 | |
| 	read_list()
 | |
| else:
 | |
| 	print "%s does not exists." % (os.getcwd()+"/"+list_file_name)
 | |
| 	sys.exit(1)
 | |
| 
 | |
| for pack in pack_list:
 | |
| 	# generate bug report
 | |
| 	mailtext = """ affects distros/ubuntu/%s
 | |
|  status confirmed
 | |
|  subscribe %s
 | |
| 
 | |
| %s
 | |
| 	""" % (pack, assignee, report)
 | |
| 	mailtext = mailtext.replace("$pack", pack)
 | |
| 	subject = subject.replace("$pack", pack)
 | |
| 
 | |
| 	# 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(mailtext)[0]
 | |
| 	assert gpg.returncode == 0
 | |
| 
 | |
| 	# generate email
 | |
| 	to = "new@bugs.launchpad.net"
 | |
| 	
 | |
| 	print """To: %s
 | |
| Subject: %s
 | |
| %s""" % (to, subject, signed_report)
 | |
| 	print "Press enter to file this bug, Control-C to abort"
 | |
| 	sys.stdin.readline()
 | |
| 
 | |
| 	mail_process = subprocess.Popen(["mail", "-s", subject, to], 
 | |
| 			stdin=subprocess.PIPE, stdout=subprocess.PIPE)
 | |
| 	mail_process.communicate(signed_report)
 | |
| 
 | |
| 	subject = subject.replace(pack, "$pack")
 |