Beispiel #1
0
def apport_crash(type, value, tb):
    logging.debug("running apport_crash()")
    try:
        # we don't depend on python3-apport because of servers
        from apport_python_hook import apport_excepthook
        from apport.report import Report
    except ImportError as e:
        logging.error("failed to import apport python module, can't "
                      "generate crash: %s" % e)
        return False
    from .DistUpgradeVersion import VERSION
    # we pretend we are do-release-upgrade
    sys.argv[0] = "/usr/bin/do-release-upgrade"
    apport_excepthook(type, value, tb)
    # now add the files in /var/log/dist-upgrade/*
    if os.path.exists('/var/crash/_usr_bin_do-release-upgrade.0.crash'):
        report = Report()
        report.setdefault('Tags', 'dist-upgrade')
        # use the version of the release-upgrader tarball, not the installed
        # package
        report.setdefault('Package',
                          'ubuntu-release-upgrader-core 1:%s' % VERSION)
        _apport_append_logfiles(report)
        report.add_to_existing(
            '/var/crash/_usr_bin_do-release-upgrade.0.crash')
    return True
def apport_crash(type, value, tb):
    logging.debug("running apport_crash()")
    if "RELEASE_UPRADER_NO_APPORT" in os.environ:
        logging.debug("RELEASE_UPRADER_NO_APPORT env set")
        return False
    try:
        # we don't depend on python3-apport because of servers
        from apport_python_hook import apport_excepthook
        from apport.report import Report
    except ImportError as e:
        logging.error("failed to import apport python module, can't "
                      "generate crash: %s" % e)
        return False
    from .DistUpgradeVersion import VERSION
    # we pretend we are do-release-upgrade
    sys.argv[0] = "/usr/bin/do-release-upgrade"
    apport_excepthook(type, value, tb)
    # now add the files in /var/log/dist-upgrade/*
    if os.path.exists('/var/crash/_usr_bin_do-release-upgrade.0.crash'):
        report = Report()
        report.setdefault('Tags', 'dist-upgrade')
        release = 'Ubuntu %s' % VERSION[0:5]
        report.setdefault('DistroRelease', release)
        # use the version of the release-upgrader tarball, not the installed
        # package
        report.setdefault('Package', 'ubuntu-release-upgrader-core 1:%s' %
                          VERSION)
        _apport_append_logfiles(report)
        report.add_to_existing(
            '/var/crash/_usr_bin_do-release-upgrade.0.crash')
    return True
        if not os.path.isfile(f) or os.path.getsize(f) == 0:
            continue
        ident = dirname + APPORT_WHITELIST[fname]
        report[ident] = (open(f), )

def apport_crash(type, value, tb):
    logging.debug("running apport_crash()")
    try:
        from apport_python_hook import apport_excepthook
        from apport.report import Report
    except ImportError, e:
        logging.error("failed to import apport python module, can't report bug: %s" % e)
        return False
    # we pretend we are update-manager
    sys.argv[0] = "/usr/bin/update-manager"
    apport_excepthook(type, value, tb)
    # now add the files in /var/log/dist-upgrade/*
    if os.path.exists('/var/crash/_usr_bin_update-manager.0.crash'):
        report = Report()
        report.setdefault('Tags', 'dist-upgrade')
        report['Tags'] += ' dist-upgrade'
        _apport_append_logfiles(report)
        report.add_to_existing('/var/crash/_usr_bin_update-manager.0.crash')
    return True

def apport_pkgfailure(pkg, errormsg):
    logging.debug("running apport_pkgfailure() %s: %s", pkg, errormsg)
    LOGDIR="/var/log/dist-upgrade/"
    s = "/usr/share/apport/package_hook"

    # we do not report followup errors from earlier failures
import subprocess
import sys
import gettext
import errno

def apport_crash(type, value, tb):
    logging.debug("running apport_crash()")
    try:
        from apport_python_hook import apport_excepthook
        from apport.report import Report
    except ImportError, e:
        logging.error("failed to import apport python module, can't report bug: %s" % e)
        return False
    # we pretend we are update-manager
    sys.argv[0] = "/usr/bin/update-manager"
    apport_excepthook(type, value, tb)
    # now add the files in /var/log/dist-upgrade/*
    if os.path.exists('/var/crash/_usr_bin_update-manager.0.crash'):
        report = Report()
        report.setdefault('Tags', 'dist-upgrade')
        report['Tags'] += ' dist-upgrade'
        for fname in os.listdir("/var/log/dist-upgrade/"):
            f = os.path.join("/var/log/dist-upgrade",fname)
            if not os.path.isfile(f) or os.path.getsize(f) == 0:
                continue
            report[f.replace(".","").replace("-","")] = (open(f), )
        report.add_to_existing('/var/crash/_usr_bin_update-manager.0.crash')
    return True

def apport_pkgfailure(pkg, errormsg):
    logging.debug("running apport_pkgfailure() %s: %s", pkg, errormsg)