debian/apport/source_xorg.py | 151 +++++++++++++++++++++++++++++-------------- debian/changelog | 8 +- 2 files changed, 112 insertions(+), 47 deletions(-)
New commits: commit 75be134678ff085b471bc803681f066a3ff999f7 Author: Bryce Harrington <br...@canonical.com> Date: Sat Dec 18 01:03:50 2010 -0800 Some apport hook improvements diff --git a/debian/apport/source_xorg.py b/debian/apport/source_xorg.py index ca89d49..e370823 100644 --- a/debian/apport/source_xorg.py +++ b/debian/apport/source_xorg.py @@ -17,6 +17,10 @@ import glob import subprocess from apport.hookutils import * +keyboard_packages = [ + 'xorg', 'xkeyboard-config', 'xserver-xorg-input-keyboard', 'xserver-xorg-input-evdev' + ] + def installed_version(pkg): script = subprocess.Popen(['apt-cache', 'policy', pkg], stdout=subprocess.PIPE) output = script.communicate()[0] @@ -36,17 +40,92 @@ def nonfree_graphics_module(module_list = '/proc/modules'): if m == "nvidia" or m == "fglrx": return m +def command_output_quiet(command_list): + log = command_output(command_list) + if log[:5] == "Error": + return None + return log + +def root_collect_file_contents(path): + '''Returns the contents of given file collected as root user''' + log = root_command_output(['cat', path]) + if log[:5] == "Error": + return "Not present" + return log + +def retval(command_list): + return subprocess.call( + command_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + +def ubuntu_variant_name(): + if (retval(['which', 'kdesudo'] == 0) and + retval(['pgrep', '-x', '-u', str(os.getuid()), 'ksmserver'] == 0)): + return "kubuntu" + else: + return "ubuntu" + +def ubuntu_code_name(): + return command_output(['lsb_release','-sc']) + +def attach_dkms_info(report): + if os.path.lexists('/var/lib/dkms'): + # Gather any dkms make.log files for proprietary drivers + for logfile in glob.glob("/var/lib/dkms/*/*/build/make.log"): + attach_file(report, logfile, "make.log") + report['DkmsStatus'] = command_output_quiet(['dkms', 'status']) + +def attach_dist_upgrade_status(report): + if os.path.lexists('/var/log/dist-upgrade/apt.log'): + report['DistUpgraded'] = command_output_quiet( + ['head', '-n', '1', '/var/log/dist-upgrade/apt.log']) + return True + else: + report['DistUpgraded'] = 'Fresh install' + return False + +def attach_pci_info(report): + info = '' + display_pci = pci_devices(PCI_DISPLAY) + for paragraph in output.split('\n\n'): + for line in paragraph.split('\n'): + key, value = line.split(':',1) + value = value.strip() + key = key.strip() + if "VGA compatible controller" in key: + info += "%s\n" % (value) + elif key == "Subsystem": + info += " %s: %s\n" %(key, value) + report['GraphicsCard'] = info + +def check_is_reportable(report): + '''Checks system to see if there is any reason the configuration is not + valid for filing bug reports''' + + version_signature = report.get('ProcVersionSignature', '') + if not version_signature.startswith('Ubuntu '): + report['UnreportableReason'] = _('The running kernel is not an Ubuntu kernel') + return False + + bios = report.get('dmi.bios.version', '') + if bios.startswith('VirtualBox '): + report['SourcePackage'] = "virtualbox-ose" + return False + + product_name = report.get('dmi.product.name', '') + if product_name.startswith('VMware '): + report['UnreportableReason'] = _('VMware is installed. If you upgraded recently be sure to upgrade vmware to a compatible version.') + return False + + return True + + def add_info(report, ui): tags = [] - # Build System Environment - codename = command_output(['lsb_release','-sc']) - tags.append(codename) - - report['system'] = "distro: Ubuntu\n" - report['system'] += "codename: " + codename + "\n" - report['system'] += "architecture: " + command_output(['uname','-m']) + "\n" - report['system'] += "kernel: " + command_output(['uname','-r']) + "\n" + report['DistroVariant'] = ubuntu_variant_name() + report['DistroCodename'] = ubuntu_code_name() + tags.append(report['DistroCodename']) + tags.append(report['DistroVariant']) attach_related_packages(report, [ "xserver-xorg", @@ -58,19 +137,7 @@ def add_info(report, ui): ]) # Verify the bug is valid to be filed - version_signature = report.get('ProcVersionSignature', '') - if not version_signature.startswith('Ubuntu '): - report['UnreportableReason'] = _('The running kernel is not an Ubuntu kernel') - return - - bios = report.get('dmi.bios.version', '') - if bios.startswith('VirtualBox '): - report['SourcePackage'] = "virtualbox-ose" - return - - product_name = report.get('dmi.product.name', '') - if product_name.startswith('VMware '): - report['UnreportableReason'] = _('VMware is installed. If you upgraded recently be sure to upgrade vmware to a compatible version.') + if check_is_reportable(report) == False: return if os.path.exists('/var/log/nvidia-installer.log'): @@ -97,10 +164,9 @@ Have you uninstalled the drivers from nvidia.com?"""): if os.environ.get('DISPLAY'): # Attach output of nvidia-settings --query if we've got a display # to connect to. - report['nvidia-settings'] = command_output(['nvidia-settings', - '-q', 'all']) + report['nvidia-settings'] = command_output( + ['nvidia-settings', '-q', 'all']) - if report['ProblemType'] == 'Crash' and 'Traceback' not in report: nonfree_driver = nonfree_graphics_module() if (nonfree_driver == "fglrx"): @@ -110,57 +176,50 @@ Have you uninstalled the drivers from nvidia.com?"""): report['SourcePackage'] = "nvidia-graphics-drivers" attach_file_if_exists(report, '/etc/X11/xorg.conf', 'XorgConf') - attach_file(report, '/var/log/Xorg.0.log', 'XorgLog') + attach_file_if_exists(report, '/var/log/Xorg.0.log', 'XorgLog') attach_file_if_exists(report, '/var/log/Xorg.0.log.old', 'XorgLogOld') - # Capture hardware attach_hardware(report) - report['PciDisplay'] = pci_devices(PCI_DISPLAY) - - # Capture KMS info if available attach_drm_info(report) - - if os.path.lexists('/var/lib/dkms'): - # Gather any dkms make.log files for proprietary drivers - for logfile in glob.glob("/var/lib/dkms/*/*/build/make.log"): - attach_file(report, logfile, "make.log") - - # dkms status - report['DkmsStatus'] = command_output(['dkms', 'status']) + attach_dkms_info(report) + attach_dist_upgrade_status(report) + attach_pci_info(report) # Only collect the following data if X11 is available if os.environ.get('DISPLAY'): # For resolution/multi-head bugs - report['Xrandr'] = command_output(['xrandr', '--verbose']) + report['Xrandr'] = command_output_quiet(['xrandr', '--verbose']) attach_file_if_exists(report, os.path.expanduser('~/.config/monitors.xml'), 'monitors.xml') # For font dpi bugs - report['xdpyinfo'] = command_output(['xdpyinfo']) + report['xdpyinfo'] = command_output_quiet(['xdpyinfo']) # For 3D/Compiz/Mesa bugs - report['glxinfo'] = command_output(['glxinfo']) + report['glxinfo'] = command_output_quiet(['glxinfo']) attach_file_if_exists(report, os.path.expanduser('~/.drirc'), 'drirc') # For keyboard bugs - report['setxkbmap'] = command_output(['setxkbmap', '-print']) - report['xkbcomp'] = command_output(['xkbcomp', ':0', '-w0', '-']) + if report['SourcePackage'] in keyboard_packages: + report['setxkbmap'] = command_output_quiet(['setxkbmap', '-print']) + report['xkbcomp'] = command_output_quiet(['xkbcomp', ':0', '-w0', '-']) # For input device bugs - report['peripherals'] = command_output(['gconftool-2', '-R', '/desktop/gnome/peripherals']) + report['peripherals'] = command_output_quiet(['gconftool-2', '-R', '/desktop/gnome/peripherals']) response = ui.yesno("Your gdm log files may help developers diagnose the bug, but may contain sensitive information. Do you want to include these logs in your bug report?") if response == True: - report['GdmLog'] = root_command_output(['cat', '/var/log/gdm/:0.log']) - report['GdmLog1'] = root_command_output(['cat', '/var/log/gdm/:0.log.1']) - report['GdmLog2'] = root_command_output(['cat', '/var/log/gdm/:0.log.2']) + report['GdmLog'] = root_collect_file_contents('/var/log/gdm/:0.log') + report['GdmLog1'] = root_collect_file_contents('/var/log/gdm/:0.log.1') + report['GdmLog2'] = root_collect_file_contents('/var/log/gdm/:0.log.2') report.setdefault('Tags', '') report['Tags'] += ' ' + ' '.join(tags) + ## DEBUGING ## if __name__ == '__main__': report = {} diff --git a/debian/changelog b/debian/changelog index 8dd4974..b766e17 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ -xorg (1:7.5+6ubuntu3) UNRELEASED; urgency=low +xorg (1:7.5+6ubuntu4) UNRELEASED; urgency=low * debian/local/Failsafe/failsafeXinit: + Fix variable escaping so shows file name for debugging tarball (LP: #596819) + * debian/apport/source_xorg.py: + + Extract VGA pci info + + Quell display of errors when glxinfo, gdm logs, etc. aren't present + + Check for dist-upgraded systems + + -- Bryce Harrington <br...@ubuntu.com> Sat, 18 Dec 2010 01:01:12 -0800 xorg (1:7.5+6ubuntu3) maverick; urgency=low -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1ptsjs-0005qc...@alioth.debian.org