Support versioned provides (without multi-arch)

Closes: #786803

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 9 years ago
parent 7fcb6e3354
commit 6965dda5f7

@ -699,12 +699,15 @@ class Britney(object):
self.__log(msg, type='W') self.__log(msg, type='W')
continue continue
for part in or_clause: for part in or_clause:
provided, version, op = part provided, provided_version, op = part
if op != '' and op != '=': if op != '' and op != '=':
msg = "Ignoring invalid provides in %s: %s (%s %s)" % (str(pkg_id), provided, op, version) msg = "Ignoring invalid provides in %s: %s (%s %s)" % (str(pkg_id), provided, op, version)
self.__log(msg, type='W') self.__log(msg, type='W')
continue continue
provides[provided].add(pkg) provided = intern(provided)
provided_version = intern(provided_version)
part = (provided, provided_version, intern(op))
provides[provided].add((pkg, provided_version))
nprov.append(part) nprov.append(part)
dpkg[PROVIDES] = nprov dpkg[PROVIDES] = nprov
else: else:
@ -994,13 +997,19 @@ class Britney(object):
packages.append(name) packages.append(name)
# look for the package in the virtual packages list and loop on them # look for the package in the virtual packages list and loop on them
for prov in provides_s_a.get(name, []): for prov, prov_version in provides_s_a.get(name, []):
if prov not in binaries_s_a: continue if prov not in binaries_s_a:
continue
# A provides only satisfies: # A provides only satisfies:
# - an unversioned dependency (per Policy Manual §7.5) # - an unversioned dependency (per Policy Manual §7.5)
# - a dependency without an architecture qualifier # - a dependency without an architecture qualifier
# (per analysis of apt code) # (per analysis of apt code)
if op == '' and version == '' and archqual is None: if archqual is not None:
# Punt on this case - these days, APT and dpkg might actually agree on
# this.
continue
if (op == '' and version == '') or \
(prov_version != '' and apt_pkg.check_dep(prov_version, op, version)):
packages.append(prov) packages.append(prov)
return packages return packages
@ -2099,12 +2108,11 @@ class Britney(object):
affected.update(inst_tester.negative_dependencies_of(rm_pkg_id)) affected.update(inst_tester.negative_dependencies_of(rm_pkg_id))
# remove the provided virtual packages # remove the provided virtual packages
for prov_rel in pkg_data[PROVIDES]: for j, prov_version, _ in pkg_data[PROVIDES]:
j = prov_rel[0]
key = j + "/" + parch key = j + "/" + parch
if key not in undo['virtual']: if key not in undo['virtual']:
undo['virtual'][key] = provides_t_a[j].copy() undo['virtual'][key] = provides_t_a[j].copy()
provides_t_a[j].remove(binary) provides_t_a[j].remove((binary, prov_version))
if not provides_t_a[j]: if not provides_t_a[j]:
del provides_t_a[j] del provides_t_a[j]
# finally, remove the binary package # finally, remove the binary package
@ -2182,15 +2190,14 @@ class Britney(object):
binaries_t_a[binary] = new_pkg_data binaries_t_a[binary] = new_pkg_data
inst_tester.add_testing_binary(updated_pkg_id) inst_tester.add_testing_binary(updated_pkg_id)
# register new provided packages # register new provided packages
for prov_rel in new_pkg_data[PROVIDES]: for j, prov_version, _ in new_pkg_data[PROVIDES]:
j = prov_rel[0]
key = j + "/" + parch key = j + "/" + parch
if j not in provides_t_a: if j not in provides_t_a:
undo['nvirtual'].append(key) undo['nvirtual'].append(key)
provides_t_a[j] = set() provides_t_a[j] = set()
elif key not in undo['virtual']: elif key not in undo['virtual']:
undo['virtual'][key] = provides_t_a[j].copy() undo['virtual'][key] = provides_t_a[j].copy()
provides_t_a[j].add(binary) provides_t_a[j].add((binary, prov_version))
if not equivalent_replacement: if not equivalent_replacement:
# all the reverse dependencies are affected by the change # all the reverse dependencies are affected by the change
affected.add(updated_pkg_id) affected.add(updated_pkg_id)

Loading…
Cancel
Save