mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-28 19:01:35 +00:00
Partially support versioned provides
With this patch, Britney will correctly parse (and deparse) a versioned Provides. Furthermore, she will allow it to satisfy any unversioned dependency on the provided package. This is the easy half of #786803. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
8d94bbc212
commit
7fcb6e3354
29
britney.py
29
britney.py
@ -691,11 +691,24 @@ class Britney(object):
|
|||||||
|
|
||||||
# register virtual packages and real packages that provide them
|
# register virtual packages and real packages that provide them
|
||||||
if dpkg[PROVIDES]:
|
if dpkg[PROVIDES]:
|
||||||
parts = [p.strip() for p in dpkg[PROVIDES].split(",")]
|
parts = apt_pkg.parse_depends(dpkg[PROVIDES], False)
|
||||||
for p in parts:
|
nprov = []
|
||||||
provides[p].add(pkg)
|
for or_clause in parts:
|
||||||
dpkg[PROVIDES] = parts
|
if len(or_clause) != 1:
|
||||||
else: dpkg[PROVIDES] = []
|
msg = "Ignoring invalid provides in %s: Alternatives [%s]" % (str(pkg_id), str(or_clause))
|
||||||
|
self.__log(msg, type='W')
|
||||||
|
continue
|
||||||
|
for part in or_clause:
|
||||||
|
provided, version, op = part
|
||||||
|
if op != '' and op != '=':
|
||||||
|
msg = "Ignoring invalid provides in %s: %s (%s %s)" % (str(pkg_id), provided, op, version)
|
||||||
|
self.__log(msg, type='W')
|
||||||
|
continue
|
||||||
|
provides[provided].add(pkg)
|
||||||
|
nprov.append(part)
|
||||||
|
dpkg[PROVIDES] = nprov
|
||||||
|
else:
|
||||||
|
dpkg[PROVIDES] = []
|
||||||
|
|
||||||
# add the resulting dictionary to the package list
|
# add the resulting dictionary to the package list
|
||||||
packages[pkg] = dpkg
|
packages[pkg] = dpkg
|
||||||
@ -2086,7 +2099,8 @@ 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 j in pkg_data[PROVIDES]:
|
for prov_rel 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()
|
||||||
@ -2168,7 +2182,8 @@ 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 j in new_pkg_data[PROVIDES]:
|
for prov_rel 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)
|
||||||
|
@ -418,6 +418,19 @@ def write_sources(sources_s, filename):
|
|||||||
f.write(output + "\n\n")
|
f.write(output + "\n\n")
|
||||||
|
|
||||||
|
|
||||||
|
def relation_atom_to_string(atom):
|
||||||
|
"""Take a parsed dependency and turn it into a string
|
||||||
|
"""
|
||||||
|
pkg, version, rel_op = atom
|
||||||
|
if rel_op != '':
|
||||||
|
if rel_op in ('<', '>'):
|
||||||
|
# APT translate "<<" and ">>" into "<" and ">". We have
|
||||||
|
# deparse those into the original form.
|
||||||
|
rel_op += rel_op
|
||||||
|
return "%s (%s %s)" % (pkg, rel_op, version)
|
||||||
|
return pkg
|
||||||
|
|
||||||
|
|
||||||
def write_controlfiles(sources, packages, suite, basedir):
|
def write_controlfiles(sources, packages, suite, basedir):
|
||||||
"""Write the control files
|
"""Write the control files
|
||||||
|
|
||||||
@ -462,7 +475,7 @@ def write_controlfiles(sources, packages, suite, basedir):
|
|||||||
output += (k + ": " + source + "\n")
|
output += (k + ": " + source + "\n")
|
||||||
elif key == PROVIDES:
|
elif key == PROVIDES:
|
||||||
if bin_data[key]:
|
if bin_data[key]:
|
||||||
output += (k + ": " + ", ".join(bin_data[key]) + "\n")
|
output += (k + ": " + ", ".join(relation_atom_to_string(p) for p in bin_data[key]) + "\n")
|
||||||
elif key == ESSENTIAL:
|
elif key == ESSENTIAL:
|
||||||
if bin_data[key]:
|
if bin_data[key]:
|
||||||
output += (k + ": " + " yes\n")
|
output += (k + ": " + " yes\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user