[pkg-fgfs-crew] Bug#724241: Apport hook for crashes
Saikrishna Arcot
saiarcot895 at gmail.com
Sun Sep 22 21:28:35 UTC 2013
Package: flightgear
Version: 2.10.0-4
Severity: normal
Currently, flightgear doesn't have an apport package hook, which may
prevent the package from getting stack traces of bugs and the options
the user had at the time of the crash (which may have had a hand in the
crash). I've attached a hook that gets the autosave information and the
preferences (if available) at the time of launching FlightGear.
--
Saikrishna Arcot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-fgfs-crew/attachments/20130922/ca77a4a0/attachment.html>
-------------- next part --------------
import os
from stat import *
from apport.hookutils import *
import subprocess
HOME = os.getenv("HOME")
PACKAGE = 'flightgear'
RELATED_PACKAGES = [
PACKAGE,
'libsimgearcore2.10.0',
'libsimgearscene2.10.0',
'flightgear-data-ai',
'flightgear-data-scenery',
'flightgear-data-aircraft',
]
def installed_version(report, pkgs):
report['RelatedPackagesPolicy'] = ''
for pkg in pkgs:
script = subprocess.Popen(['apt-cache', 'policy', pkg], stdout=subprocess.PIPE)
report['RelatedPackagesPolicy'] += str(script.communicate()[0]) + "\n"
def get_envs(envs):
s = ""
for env in envs:
s += env + " = " + str(os.getenv(env)) + "\n"
return s
def add_info(report, ui = None):
attach_related_packages(report, RELATED_PACKAGES)
installed_version(report, RELATED_PACKAGES)
# Autosave and Preferences
attach_file_if_exists(report, HOME + '/.fgfs/autosave.xml', 'Autosave')
# 2.12 and beyond
# version = report.get('Package', '').split()[1].split('.')
# attach_file_if_exists(report, HOME + '/.fgfs/autosave_' + version[0] + '_' + version[1] + '.xml', 'Autosave')
attach_file_if_exists(report, HOME + '/.fgfs/preferences.xml', 'Preferences')
# attach_file_if_exists(report, HOME + '/.fgfs/fgfs.log', 'FlightGearLog')
# DE
report['Desktop-Session'] = get_envs([ 'DESKTOP_SESSION', 'XDG_CONFIG_DIRS', 'XDG_DATA_DIRS' ])
# Env
report['Env'] = get_envs([ 'LD_LIBRARY_PATH' ])
# Disk usage
script = subprocess.Popen([ 'df', '-Th' ], stdout=subprocess.PIPE)
report['DiskUsage'] = str(script.communicate()[0]) + "\n\nInodes:\n"
script = subprocess.Popen([ 'df', '-ih' ], stdout=subprocess.PIPE)
report['DiskUsage'] += str(script.communicate()[0])
## DEBUGING ##
if __name__ == '__main__':
report = {}
add_info(report)
for key in report:
print('[%s]\n%s\n' % (key, report[key]))
More information about the pkg-fgfs-crew
mailing list