apport-hackers team mailing list archive
-
apport-hackers team
-
Mailing list archive
-
Message #00088
[Merge] lp:~brian-murray/apport/package-hook-dist-upgrade into lp:apport
Brian Murray has proposed merging lp:~brian-murray/apport/package-hook-dist-upgrade into lp:apport.
Requested reviews:
Apport upstream developers (apport-hackers)
For more details, see:
https://code.launchpad.net/~brian-murray/apport/package-hook-dist-upgrade/+merge/108214
Not every bug that happens during a distribution upgrade are being tagged dist-upgrade. The update-manager apport package hook adds this tag and so does DistUpgradeApport.py in update-manager. However, when package_hook is called by DistUpgradeApport this tag is not added. This branch adds a -t swicht to package_hook so that one can add tags to bug reports.
--
https://code.launchpad.net/~brian-murray/apport/package-hook-dist-upgrade/+merge/108214
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/package-hook-dist-upgrade into lp:apport.
=== modified file 'data/package_hook'
--- data/package_hook 2012-04-30 14:39:00 +0000
+++ data/package_hook 2012-05-31 17:51:19 +0000
@@ -36,6 +36,9 @@
optparser.add_option('-l', '--log',
help='Append given log file, or, if it is a directory, all files in it (can be specified multiple times)',
action='append', type='string', dest='logs')
+optparser.add_option('-t', '--tags',
+ help='Add the following tags to the bug report (comma separated)',
+ action='append', type='string', dest='tags')
options = optparser.parse_args()[0]
if not options.package:
@@ -47,6 +50,11 @@
pr['Package'] = options.package
pr['SourcePackage'] = apport.packaging.get_source(options.package)
pr['ErrorMessage'] = (sys.stdin, False)
+
+if options.tags:
+ tags = options.tags
+ pr['Tags'] = ' '.join(tags)
+
for l in (options.logs or []):
if os.path.isfile(l):
pr[mkattrname(l)] = (l,)
=== modified file 'test/test_hooks.py'
--- test/test_hooks.py 2012-05-04 07:34:16 +0000
+++ test/test_hooks.py 2012-05-31 17:51:19 +0000
@@ -119,6 +119,23 @@
self.assertEqual(r[log1key], 'Log 1\nbla')
self.assertEqual(r[log2key], 'Yet\nanother\nlog')
+ def test_package_hook_log_tags(self):
+ '''package_hook with a log file including dist-upgrade gets tagged.'''
+
+ ph = subprocess.Popen(['%s/package_hook' % datadir, '-p', 'bash',
+ '-t', 'dist-upgrade, verybad'], stdin=subprocess.PIPE)
+ ph.communicate(b'something is wrong')
+ self.assertEqual(ph.returncode, 0, 'package_hook finished successfully')
+
+ reps = apport.fileutils.get_new_reports()
+ self.assertEqual(len(reps), 1, 'package_hook created a report')
+
+ r = apport.Report()
+ with open(reps[0], 'rb') as f:
+ r.load(f)
+
+ self.assertEqual(r['Tags'], 'dist-upgrade, verybad')
+
def test_kernel_crashdump(self):
'''kernel_crashdump.'''