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
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]))