Browse Source

Add related packages support. (#313421)

suites/jessie-proposed-backports
Chris Lawrence 18 years ago
parent
commit
5c20aa8e2b
  1. 14
      README.developers
  2. 9
      debian/changelog
  3. 49
      reportbug
  4. 32
      reportbug.py

14
README.developers

@ -43,10 +43,10 @@ in the template can put the user in any security risk.
Package redirection
===================
The package maintainer can control to which packages are the bug reports
submitted to (i.e. the Package: field of the report). This will be mainly
used to redirect bugs in packages coming from a single source to where the
maintainer likes to have them.
The package maintainer can control to which packages bug reports are
submitted, by setting the Package: field of the bug report. This will
be mainly used to redirect bugs in packages coming from a single
source to where the maintainer likes to have them.
This is done by having this line in /usr/share/bug/$package/control:
@ -87,6 +87,12 @@ control file.
Package information will be added to the bug report for each extra package
listed.
You can also request that the status information for other packages
(that are not dependencies or recommendations) be included with the
report using the "package-status" header.
package-status: bar baz
Addendum: Languages other than SH
=================================

9
debian/changelog

@ -1,12 +1,17 @@
reportbug (3.13) unstable; urgency=low
* Fix redirects in urlutils under Python 2.4. (Closes: #309671)
* Really quit when using 'q' at editor prompt. (Closes: #299425, again)
* Really quit when using 'q' at editor prompt. (Closes: #299425, #313516)
* Skip vi nag if in template mode. (Closes: #309717)
* Fix grammar in "specify bug by number" message in querybts.
(Closes: #310723)
* Fix crash when bug control file contains both submit-as and
report-with lines. (Closes: #313403)
* Include status for recommended packages as well. (Closes: #310856)
* Add support for including status of packages that aren't dependencies.
(Closes: #313421)
--
-- Chris Lawrence <lawrencc@debian.org> Tue, 14 Jun 2005 14:47:22 -0500
reportbug (3.12) unstable; urgency=low

49
reportbug

@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE."""
#
# Version ##VERSION##; see changelog for revision history
# $Id: reportbug,v 1.76 2005-05-20 07:14:07 lawrencc Exp $
# $Id: reportbug,v 1.77 2005-06-14 19:48:36 lawrencc Exp $
# Work around case where Python install might be broken (#290043)
try:
@ -970,7 +970,7 @@ def main():
ewrite("Getting status for %s...\n", package)
status = reportbug.get_package_status(package)
pkgavail, installed = status[1], status[5]
pkgavail, installed = status[1], status[6]
# Packages that only exist to do weird dependency things
deppkgs = sysinfo.get('deppkgs')
if pkgavail and deppkgs:
@ -987,11 +987,11 @@ def main():
'actual package "%s".\n', package, depends[0])
package = depends[0]
else:
opts = [(x, reportbug.get_package_status(x)[10])
opts = [(x, reportbug.get_package_status(x)[11])
for x in depends]
if mode >= MODE_ADVANCED:
opts += [(package,
status[10]+' (dependency package)')]
status[11]+' (dependency package)')]
package = ui.menu('%s is a dependency package. '
'Which of the following '
@ -1000,7 +1000,7 @@ def main():
'Select one of these packages: ')
ewrite("Getting status for %s...\n", package)
status = reportbug.get_package_status(package)
pkgavail, installed = status[1], status[5]
pkgavail, installed = status[1], status[6]
if not pkgavail and not isvirtual:
# Look for a matching source package
@ -1026,7 +1026,7 @@ def main():
if package != src:
ewrite("Getting status for %s...\n", package)
status = reportbug.get_package_status(package)
pkgavail, installed = status[1], status[5]
pkgavail, installed = status[1], status[6]
else:
issource = True
else:
@ -1096,12 +1096,14 @@ def main():
ewrite("Package does not exist; stopping.\n")
sys.exit(1)
(pkgversion, pkgavail, depends, conffiles, maintainer, installed,
origin, vendor, reportinfo, priority, desc, src_name,
(pkgversion, pkgavail, depends, recommends, conffiles, maintainer,
installed, origin, vendor, reportinfo, priority, desc, src_name,
fulldesc, state) = status
buginfo = '/usr/share/bug/' + package
bugexec = submitas = submitto = presubj = reportwith = None
bugexec = submitas = submitto = presubj = None
reportwith = []
supplemental = []
if os.path.isfile(buginfo) and os.access(buginfo, os.X_OK):
bugexec = buginfo
elif os.path.isdir(buginfo):
@ -1112,7 +1114,8 @@ def main():
presubj = buginfo+'/presubj'
if os.path.isfile(buginfo+'/control'):
submitas, submitto, reportwith = reportbug.parse_bug_control_file(buginfo+'/control')
submitas, submitto, reportwith, supplemental = \
reportbug.parse_bug_control_file(buginfo+'/control')
elif os.path.isfile('/usr/share/bug/default/'+package) \
and os.access('/usr/share/bug/default/'+package, os.X_OK):
bugexec = '/usr/share/bug/default/'+package
@ -1126,15 +1129,11 @@ def main():
presubj = buginfo+'/presubj'
if os.path.isfile(buginfo+'/control'):
submitas, submitto, reportwith = reportbug.parse_bug_control_file(
buginfo+'/control')
submitas, submitto, reportwith, supplemental = \
reportbug.parse_bug_control_file(buginfo+'/control')
if submitas:
if reportwith:
if submitas not in reportwith:
reportwith = reportwith + (submitas,)
else:
reportwith = (submitas,)
if submitas and (submitas not in reportwith):
reportwith += [submitas]
if reportwith:
# Remove current package from report-with list
@ -1290,9 +1289,11 @@ def main():
depinfo = ""
# Grab dependency list, removing version conditions.
if depends and not options.kudos:
if (depends or recommends) and not options.kudos:
ewrite("Looking up dependencies of %s...\n", package)
depinfo = reportbug.get_dependency_info(package, depends)
depinfo = (reportbug.get_dependency_info(package, depends) +
reportbug.get_dependency_info(package, recommends,
"recommends"))
if maintainer:
lmaintainer = maintainer.decode('UTF-8', 'ignore').encode(charset,
@ -1320,7 +1321,13 @@ orphaned for a long period of time are often removed from the archive.\n''')
if extrastatus[2]:
extradepends = [x for x in extrastatus[2] if package not in x]
ewrite("Looking up dependencies of related package %s...\n", extrapackage)
depinfo = depinfo + reportbug.get_dependency_info(extrapackage, extradepends)
depinfo += reportbug.get_dependency_info(extrapackage, extradepends)
supplemental = ['reportbug', 'totem-gstreamer']
if supplemental and not options.kudos:
ewrite("Looking up status of additional packages...\n")
depinfo += reportbug.get_dependency_info(
package, [[x] for x in supplemental], rel='is related to')
confinfo = []
conftext = ''

32
reportbug.py

@ -21,7 +21,7 @@
#
# Version ##VERSION##; see changelog for revision history
#
# $Id: reportbug.py,v 1.26 2005-04-30 06:19:49 lawrencc Exp $
# $Id: reportbug.py,v 1.27 2005-06-14 19:48:36 lawrencc Exp $
VERSION = "reportbug ##VERSION##"
VERSION_NUMBER = "##VERSION##"
@ -246,6 +246,7 @@ def get_package_status(package, avail=False):
packagere = re.compile('Package: ')
priorityre = re.compile('Priority: ')
dependsre = re.compile('(Pre-)?Depends: ')
recsre = re.compile('Recommends: ')
conffilesre = re.compile('Conffiles: ')
maintre = re.compile('Maintainer: ')
statusre = re.compile('Status: ')
@ -260,6 +261,7 @@ def get_package_status(package, avail=False):
conffiles = []
fulldesc = []
depends = []
recommends = []
confmode = False
state = ''
@ -306,6 +308,12 @@ def get_package_status(package, avail=False):
thisdepends = [[y.split()[0] for y in x.split('|')]
for x in (thisdepends.split(', '))]
depends.extend(thisdepends)
elif recsre.match(line):
(crud, thisdepends) = line.split(": ", 1)
# Remove versioning crud
thisdepends = [[y.split()[0] for y in x.split('|')]
for x in (thisdepends.split(', '))]
recommends.extend(thisdepends)
elif conffilesre.match(line):
confmode = True
elif maintre.match(line):
@ -334,7 +342,8 @@ def get_package_status(package, avail=False):
else:
vendor = ''
info = (pkgversion, pkgavail, tuple(depends), tuple(conffiles),
info = (pkgversion, pkgavail, tuple(depends), tuple(recommends),
tuple(conffiles),
maintainer, installed, origin, vendor, reportinfo, priority,
desc, src_name, os.linesep.join(fulldesc), state)
@ -467,7 +476,8 @@ def get_package_info(packages):
notfound = [x for x in group if x not in found]
if len(notfound) == len(group):
if group not in found:
ret.append( (' | '.join(group), 'pn', '', 'Not found.', None) )
ret.append( (' | '.join(group), 'pn', '<none>',
'(no description available)', None) )
return ret
@ -480,16 +490,16 @@ def packages_providing(package):
return ret
def get_dependency_info(package, depends):
def get_dependency_info(package, depends, rel="depends on"):
if not depends:
return ('\n%s has no dependencies.\n' % package)
return ('\n%s %s no packages.\n' % (package, rel))
dependencies = []
for dep in depends:
for bit in dep:
dependencies.append( (tuple(dep), bit) )
depinfo = "\nVersions of packages %s depends on:\n" % package
depinfo = "\nVersions of packages %s %s:\n" % (package, rel)
packs = {}
for info in get_package_info(dependencies):
@ -821,7 +831,9 @@ def parse_config_files():
return args
def parse_bug_control_file(filename):
submitas = submitto = reportwith = None
submitas = submitto = None
reportwith = []
supplemental = []
fh = file(filename)
for line in fh:
line = line.strip()
@ -835,9 +847,11 @@ def parse_bug_control_file(filename):
elif header == 'send-to':
submitto = data
elif header == 'report-with':
reportwith = data.split(' ')
reportwith += data.split(' ')
elif header == 'package-status':
supplemental += data.split(' ')
return submitas, submitto, reportwith
return submitas, submitto, reportwith, supplemental
def cleanup_msg(dmessage, headers, type):
pseudoheaders = []

Loading…
Cancel
Save