mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
* massfile: added script to file mass-bugs.
* debian/examples, examples/massfile.{instructions,list}: added example files. * setup.py: install massfile.
This commit is contained in:
parent
704b070293
commit
0f64f93961
9
debian/changelog
vendored
9
debian/changelog
vendored
@ -1,3 +1,12 @@
|
|||||||
|
ubuntu-dev-tools (0.13) gutsy; urgency=low
|
||||||
|
|
||||||
|
* massfile: added script to file mass-bugs.
|
||||||
|
* debian/examples, examples/massfile.{instructions,list}: added example
|
||||||
|
files.
|
||||||
|
* setup.py: install massfile.
|
||||||
|
|
||||||
|
-- Daniel Holbach <daniel.holbach@ubuntu.com> Thu, 27 Sep 2007 11:04:52 +0200
|
||||||
|
|
||||||
ubuntu-dev-tools (0.12) gutsy; urgency=low
|
ubuntu-dev-tools (0.12) gutsy; urgency=low
|
||||||
|
|
||||||
* hugdaylist: apply quick fix to not crash.
|
* hugdaylist: apply quick fix to not crash.
|
||||||
|
1
debian/examples
vendored
Normal file
1
debian/examples
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
examples/*
|
15
examples/massfile.instructions
Normal file
15
examples/massfile.instructions
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
subject: [UNMETDEPS] $pack has unmet dependencies
|
||||||
|
assignee:
|
||||||
|
subscribers: motu
|
||||||
|
tags: unmetdeps
|
||||||
|
text:
|
||||||
|
A run of
|
||||||
|
.
|
||||||
|
LC_ALL=C apt-cache -i unmet | grep ^Package | cut -d' ' -f2 | grep
|
||||||
|
-v dbgsym | sort -u | xargs apt-cache showsrc | grep ^Directory |
|
||||||
|
sed 's/Package\:\ //g' | grep verse | cut -d'/' -f4
|
||||||
|
indicates that the source package $pack has binary packages that are not
|
||||||
|
installable (on AMD64) at the moment.
|
||||||
|
.
|
||||||
|
Please have a look and make sure it's installable again.
|
||||||
|
|
2
examples/massfile.list
Normal file
2
examples/massfile.list
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
z88dk
|
||||||
|
zope-quotafolder
|
169
massfile
169
massfile
@ -1,81 +1,118 @@
|
|||||||
# Used Martin Pitt's excellent requestsync script, to get this started.
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# (C) Canonical, 2007, GPL v3
|
||||||
|
|
||||||
#!/usr/bin/env python
|
import os
|
||||||
|
import sys
|
||||||
|
import email
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import os, os.path, sys, subprocess
|
import launchpadbugs.connector as Connector
|
||||||
|
|
||||||
subject = ""
|
|
||||||
assignee = ""
|
|
||||||
report = ""
|
|
||||||
pack_list = set()
|
|
||||||
|
|
||||||
instructions_file_name = "instructions"
|
example_dir = "/usr/share/doc/ubuntu-dev-tools/examples"
|
||||||
list_file_name = "list"
|
|
||||||
|
|
||||||
def read_config():
|
def read_config():
|
||||||
global subject, assignee, report
|
instructions_file = open("instructions")
|
||||||
for line in open(os.getcwd()+"/"+instructions_file_name).readlines():
|
instructions = email.message_from_file(instructions_file)
|
||||||
if line.startswith("subject:"):
|
instructions_file.close()
|
||||||
subject = line.split("subject: ")[1]
|
instr = dict()
|
||||||
else:
|
|
||||||
if line.startswith("assignee:"):
|
for field in "subject", "assignee", "subscribers", "tags", "text", \
|
||||||
assignee = line.split("assignee: ")[1]
|
"buglist-url":
|
||||||
else:
|
instr[field] = instructions.get(field)
|
||||||
report += line
|
|
||||||
|
return instr
|
||||||
|
|
||||||
def read_list():
|
def read_list():
|
||||||
global pack_list
|
pack_list = set()
|
||||||
for line in open(os.getcwd()+"/"+list_file_name).readlines():
|
|
||||||
if line.strip()!="":
|
|
||||||
pack_list.add(line.strip("\n"))
|
|
||||||
|
|
||||||
#
|
listfile = open("list")
|
||||||
# entry point
|
for line in listfile.readlines():
|
||||||
#
|
if line.strip()!="":
|
||||||
|
pack_list.add(line.strip("\n"))
|
||||||
|
|
||||||
if os.path.exists(os.getcwd()+"/"+instructions_file_name):
|
listfile.close()
|
||||||
read_config()
|
return pack_list
|
||||||
else:
|
|
||||||
print "%s does not exists." % (os.getcwd()+"/"+instructions_file_name)
|
def file_bug():
|
||||||
sys.exit(1)
|
Bug = Connector.ConnectBug()
|
||||||
|
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
||||||
|
|
||||||
|
|
||||||
|
def check_configfiles():
|
||||||
|
result = True
|
||||||
|
|
||||||
|
if not os.path.exists("instructions"):
|
||||||
|
os.system("cp %s/massfile.instructions instructions" % example_dir)
|
||||||
|
print >> sys.stderr, \
|
||||||
|
"No 'instructions' file found. Copied template from %s." % \
|
||||||
|
example_dir
|
||||||
|
result = False
|
||||||
|
|
||||||
|
if not os.path.exists("list"):
|
||||||
|
os.system("cp %s/massfile.list list" % example_dir)
|
||||||
|
print >> sys.stderr, \
|
||||||
|
"No 'list' file found. Copied template from %s." % example_dir
|
||||||
|
result = False
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def file_bug(config):
|
||||||
|
Bug = Connector.ConnectBug()
|
||||||
|
Bug.authentication = os.path.expanduser("~/.lpcookie")
|
||||||
|
|
||||||
|
# try:
|
||||||
|
bug = Bug.New(product={"name": config["sourcepackage"], "target": "ubuntu"},
|
||||||
|
summary=config["subject"],
|
||||||
|
description=config["text"])
|
||||||
|
print "Successfully filed bug %s: http://launchpad.net/bugs/%s" % \
|
||||||
|
(bug.bugnumber, bug.bugnumber)
|
||||||
|
for sub in config["subscribers"].split(","):
|
||||||
|
if sub.strip("\n").strip():
|
||||||
|
bug.subscribers.add(sub.strip("\n").strip())
|
||||||
|
for tag in config["tags"].split(","):
|
||||||
|
if tag.strip("\n").strip():
|
||||||
|
bug.tags.append(tag.strip("\n").strip())
|
||||||
|
bug.assignee = config["assignee"]
|
||||||
|
bug.commit()
|
||||||
|
# except:
|
||||||
|
# "Bug for '%s' was not filed." % config["sourcepackage"]
|
||||||
|
|
||||||
|
def read_buglist(url):
|
||||||
|
BugList = Connector.ConnectBugList()
|
||||||
|
packages = set()
|
||||||
|
|
||||||
|
buglist = BugList(url)
|
||||||
|
for bug in buglist.bugs:
|
||||||
|
packages.add(bug.sourcepackage)
|
||||||
|
|
||||||
|
return packages
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if not check_configfiles():
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.expanduser("~/.lpcookie")):
|
||||||
|
print >> sys.stderr, \
|
||||||
|
"Launchpad cookie not found in ~/.lpcookie."
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
config = read_config()
|
||||||
|
pack_list = read_list()
|
||||||
|
buglist = read_buglist(config["buglist-url"])
|
||||||
|
|
||||||
if os.path.exists(os.getcwd()+"/"+list_file_name):
|
for pack in pack_list:
|
||||||
read_list()
|
if pack not in buglist:
|
||||||
else:
|
config["text"] = config["text"].replace("$pack", pack)
|
||||||
print "%s does not exists." % (os.getcwd()+"/"+list_file_name)
|
config["subject"] = config["subject"].replace("$pack", pack)
|
||||||
sys.exit(1)
|
config["sourcepackage"] = pack
|
||||||
|
|
||||||
for pack in pack_list:
|
file_bug(config)
|
||||||
# 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
|
if __name__ == '__main__':
|
||||||
Subject: %s
|
main()
|
||||||
%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")
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user