~brian-murray/ubuntu/oneiric/apport/fix-pkg-dupe-sig

« back to all changes in this revision

Viewing changes to data/general-hooks/ubuntu.py

  • Committer: Steve Langasek
  • Date: 2011-08-10 17:21:07 UTC
  • mfrom: (1810.1.2 package-dupe-sig)
  • Revision ID: steve.langasek@canonical.com-20110810172107-qy5hnjzphnm03p8i
Tags: 1.21.2-0ubuntu11
merge package install duplicate signature handling from Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        if package:
73
73
            attach_upstart_overrides(report, package)
74
74
 
 
75
    # build a duplicate signature tag for package reports
 
76
    if report.get('ProblemType') == 'Package':
 
77
        dupe_sig = ''
 
78
        for line in report['DpkgTerminalLog']:
 
79
            if line.startswith('Setting up') or line.startswith('Unpacking'):
 
80
                dupe_sig = line
 
81
                continue
 
82
            dupe_sig += line
 
83
            if 'dpkg: error' in dupe_sig and line.startswith(' '):
 
84
                if 'trying to overwrite' in line:
 
85
                   report['Tags'] += 'package-conflict'
 
86
                if 'Setting up' in dupe_sig or 'Unpacking' in dupe_sig:
 
87
                    report['DuplicateSignature'] = dupe_sig
 
88
                    # the duplicate signature should be the first failure
 
89
                    break
 
90
 
75
91
    # running Unity?
76
92
    username = pwd.getpwuid(os.geteuid()).pw_name
77
93
    if subprocess.call(['killall', '-s0', '-u', username,