File: apport-hook.py

package info (click to toggle)
virtualbox 7.2.6-dfsg-3
  • links: PTS, VCS
  • area: contrib
  • in suites: sid
  • size: 684,120 kB
  • sloc: ansic: 2,692,612; cpp: 2,685,536; asm: 402,532; python: 239,820; xml: 89,849; sh: 33,358; perl: 9,380; makefile: 8,889; java: 5,337; cs: 4,872; pascal: 1,785; javascript: 1,692; objc: 1,131; lex: 931; sed: 929; php: 906; yacc: 707
file content (15 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import apport.hookutils

def add_info(report):
    """Add a list of installed packages matching 'virtualbox' or 'linux-headers'"""
    report['VirtualBox.DpkgList'] = apport.hookutils.command_output(["sh", "-c", "dpkg -l | grep -e virtualbox -e linux-headers"])

    """Add information about installed VirtualBox kernel modules"""
    report['VirtualBox.ModInfo'] = apport.hookutils.command_output(["sh", "-c",
        "find /lib/modules/`uname -r` -name \"vbox*\" | xargs -r modinfo"])

    report['LsMod'] = apport.hookutils.command_output(["lsmod"])
    report['DkmsLog'] = apport.hookutils.command_output(["sh", "-c", "cat /var/lib/dkms/virtualbox/$(dpkg-query -f '${source:Upstream-Version}\n' -W 'virtualbox' |cut -f 1 -d '-')/build/make.log"])
    # the following contains a different parsing way, based on "Package" field, constructed in this way:
    # ['virtualbox', '7.2.0-dfsg-3'], so getting the field number 1, splitting the "-" and getting the first field works in the same way as the dpkg-query call above
    #report['DkmsLog'] = apport.hookutils.command_output(["sh", "-c", "cat /var/lib/dkms/virtualbox/" + report['Package'].split()[1].split("-")[0] + "/build/make.log"])