diff options
author | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-22 15:47:16 +0100 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-22 15:47:16 +0100 |
commit | 25335618bf8755ce6b116ee14f47f5a1f2c821e9 (patch) | |
tree | d889d7ab3f9f985d0c54c534cb8052bd2e6d7163 /apport | |
download | bzr-tarball-25335618bf8755ce6b116ee14f47f5a1f2c821e9.tar.gz |
Tarball conversion
Diffstat (limited to 'apport')
-rw-r--r-- | apport/README | 13 | ||||
-rw-r--r-- | apport/bzr-crashdb.conf | 6 | ||||
-rw-r--r-- | apport/source_bzr.py | 53 |
3 files changed, 72 insertions, 0 deletions
diff --git a/apport/README b/apport/README new file mode 100644 index 0000000..3128f64 --- /dev/null +++ b/apport/README @@ -0,0 +1,13 @@ +Bazaar supports semi-automatic bug reporting through Apport +<https://launchpad.net/apport/>. + +If apport is not installed, an exception is printed to stderr in the usual way. + +For this to work properly it's suggested that two files be installed when a +package of bzr is installed: + +``bzr.conf`` + into ``/etc/apport/crashdb.conf.d`` + +``source_bzr.py`` + into ``/usr/share/apport/package-hooks`` diff --git a/apport/bzr-crashdb.conf b/apport/bzr-crashdb.conf new file mode 100644 index 0000000..cd0931b --- /dev/null +++ b/apport/bzr-crashdb.conf @@ -0,0 +1,6 @@ +bzr = { + # most bzr bugs are upstream bugs; file them there + 'impl': 'launchpad', + 'project': 'bzr', + 'bug_pattern_base': 'http://people.canonical.com/~pitti/bugpatterns', +} diff --git a/apport/source_bzr.py b/apport/source_bzr.py new file mode 100644 index 0000000..15e1e63 --- /dev/null +++ b/apport/source_bzr.py @@ -0,0 +1,53 @@ +'''apport package hook for Bazaar''' + +# Copyright (c) 2009, 2010 Canonical Ltd. +# Author: Matt Zimmerman <mdz@canonical.com> +# and others + +from apport.hookutils import * +import os + +bzr_log = os.path.expanduser('~/.bzr.log') +dot_bzr = os.path.expanduser('~/.bazaar') + +def _add_log_tail(report): + # may have already been added in-process + if 'BzrLogTail' in report: + return + + bzr_log_lines = open(bzr_log).readlines() + bzr_log_lines.reverse() + + bzr_log_tail = [] + blanks = 0 + for line in bzr_log_lines: + if line == '\n': + blanks += 1 + bzr_log_tail.append(line) + if blanks >= 2: + break + + bzr_log_tail.reverse() + report['BzrLogTail'] = ''.join(bzr_log_tail) + + +def add_info(report): + _add_log_tail(report) + if 'BzrPlugins' not in report: + # may already be present in-process + report['BzrPlugins'] = command_output(['bzr', 'plugins', '-v']) + + # by default assume bzr crashes are upstream bugs; this relies on + # having a bzr entry under /etc/apport/crashdb.conf.d/ + report['CrashDB'] = 'bzr' + + # these may contain some sensitive info (smtp_passwords) + # TODO: strip that out and attach the rest + + #attach_file_if_exists(report, + # os.path.join(dot_bzr, 'bazaar.conf', 'BzrConfig') + #attach_file_if_exists(report, + # os.path.join(dot_bzr, 'locations.conf', 'BzrLocations') + + +# vim: expandtab shiftwidth=4 |