~ubuntu-archive/ubuntu-archive-scripts/trunk

« back to all changes in this revision

Viewing changes to find-rcbuggy-problem-packages

  • Committer: Michael Hudson-Doyle
  • Date: 2019-09-12 01:56:55 UTC
  • mto: This revision was merged to the branch mainline in revision 245.
  • Revision ID: michael.hudson@canonical.com-20190912015655-gcqy7zqd6vyem404
try to be more correct about which architecture a package becomes uninstallable on

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    cp = subprocess.run(cmd, **kw)
63
63
    return cp.stdout.decode(encoding).strip()
64
64
 
65
 
def extract_uninstallable_to_src_pkg(output_fp):
66
 
    # Extract a mapping from binary package name to the set of source
67
 
    # packages whose migration from proposed makes that package
68
 
    # uninstallable.
 
65
def extract_bin_pkg_arch_to_blocked_src_pkgs(output_fp):
 
66
    # Extract a mapping from binary package name / architectures to
 
67
    # source package the migration of which would make that package
 
68
    # uninstallable (and for convenience, return all architectures
 
69
    # used as keys -- usually there will only be one or two).
69
70
 
70
71
    # We're looking for sequences of lines like this:
71
72
 
76
77
    # (Britney tries to migrate batches of packages but it always
77
78
    # tries each package on its own as well).
78
79
 
79
 
    r = {}
 
80
    # For each potential migration, britney checks architectures in
 
81
    # sequence and stops when it finds one that regresses (or proceeds
 
82
    # with the migration if it doesn't find one). This means that we
 
83
    # can miss blocking packages here --- for example if migrating $src
 
84
    # would make say $binpkg/amd64 uninstallable, but britney happens
 
85
    # to check arm64 -- where $binpkg does not exist -- and there are
 
86
    # regressions there, we will never find out about the problem
 
87
    # $binpkg causes.  This isn't really too bad because clearly in
 
88
    # this case the migration of $src is blocked by other things that
 
89
    # need to be resolved, but it does mean that packages might appear
 
90
    # and disapper from the report depending on the order that britney
 
91
    # checks architectures in (which is not consistent from run to
 
92
    # run). C'est la vie.
 
93
 
 
94
    regression_arches = set()
 
95
    bin_pkg_arch_to_blocked_src_pkgs = {}
80
96
    srcpkg = None
81
97
    for line in output_fp:
82
98
        parts = line.split()
83
99
        if len(parts) >= 2:
 
100
            if parts[0] in {"Trying", "trying"}:
 
101
                srcpkg = None
84
102
            if parts[0] == 'skipped:':
85
103
                srcpkg = None
86
104
                # If parts[2] is '(' then this line is about trying to
88
106
                # looking for.
89
107
                if parts[2].startswith('('):
90
108
                    srcpkg = parts[1]
91
 
            if srcpkg is not None and parts[0] == '*':
 
109
            if srcpkg is not None and srcpkg[0] != '-' and parts[0] == '*':
92
110
                # parts[1] is "${arch}:"
93
111
                # parts[2:] is a comma+space separated list of binary package names.
 
112
                arch = parts[1][:-1]
 
113
                if arch not in regression_arches:
 
114
                    print(arch, srcpkg, line)
 
115
                regression_arches.add(arch)
94
116
                for binpkg in parts[2:]:
95
 
                    binpkg = binpkg.strip(',')
96
 
                    r.setdefault(binpkg, set()).add(srcpkg)
97
 
    return r
 
117
                    bin_pkg_arch_to_blocked_src_pkgs.setdefault(
 
118
                        (binpkg, arch), set()).add(binpkg.strip(','))
 
119
    return regression_arches, bin_pkg_arch_to_blocked_src_pkgs
98
120
 
99
121
 
100
122
@attr.s
102
124
    source_package_name = attr.ib()
103
125
    bugs = attr.ib()
104
126
    block_by_regression = attr.ib(default=attr.Factory(set))
105
 
    block_by_uninstallability = attr.ib(default=attr.Factory(list))
 
127
    block_by_uninstallability = attr.ib(default=attr.Factory(set))
106
128
    suites = attr.ib(default=attr.Factory(set))
107
129
    _rdeps_lines = attr.ib(default=None)
108
130
 
178
200
    with open(args.ubuntu_excuses) as fp:
179
201
        ubuntu_excuses = yaml.load(fp, Loader=yaml.CSafeLoader)
180
202
    with open(args.ubuntu_update_output) as fp:
181
 
        uninstallable_to_src_pkg = extract_uninstallable_to_src_pkg(fp)
 
203
        regression_arches, bin_pkg_arch_to_blocked_src_pkgs = extract_bin_pkg_arch_to_blocked_src_pkgs(fp)
182
204
    with open(args.debian_excuses) as fp:
183
205
        debian_excuses = yaml.load(fp, Loader=yaml.CSafeLoader)
184
206
 
222
244
    for pkg in rc_gones:
223
245
        if pkg not in in_proposed_by_autopkgtest_or_missing_binaries:
224
246
            continue
225
 
        bin_pkgs = run_output("chdist", "grep-dctrl-packages", series, "-SwnsPackage", pkg, check=False)
226
 
        for bin_pkg in set(bin_pkgs.splitlines()):
227
 
            rc_gones[pkg].block_by_uninstallability.extend(uninstallable_to_src_pkg.get(bin_pkg, []))
 
247
        for arch in regression_arches:
 
248
            bin_pkgs = run_output("chdist", "grep-dctrl-packages", series + '-' + arch, "-SwnsPackage", pkg, check=False)
 
249
            for bin_pkg in set(bin_pkgs.splitlines()):
 
250
                rc_gones[pkg].block_by_uninstallability.update(bin_pkg_arch_to_blocked_src_pkgs.get((bin_pkg, arch), set()))
228
251
    print("finding reverse-deps")
229
252
    packages = []
230
253
    for _, rc_gone in sorted(rc_gones.items()):