read_pkgs: Parse Provides a bit earlier

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 9 years ago
parent 946d705e2b
commit c4e7596837

@ -678,6 +678,29 @@ class Britney(object):
if "(" in source_raw: if "(" in source_raw:
source_version = intern(source_raw[source_raw.find("(")+1:source_raw.find(")")]) source_version = intern(source_raw[source_raw.find("(")+1:source_raw.find(")")])
provides_raw = get_field('Provides')
if provides_raw:
parts = apt_pkg.parse_depends(provides_raw, False)
nprov = []
for or_clause in parts:
if len(or_clause) != 1:
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, 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
provided = intern(provided)
provided_version = intern(provided_version)
part = (provided, provided_version, intern(op))
nprov.append(part)
provides = nprov
else:
provides = []
dpkg = [version, dpkg = [version,
intern(get_field('Section')), intern(get_field('Section')),
source, source,
@ -686,7 +709,7 @@ class Britney(object):
get_field('Multi-Arch'), get_field('Multi-Arch'),
deps, deps,
', '.join(final_conflicts_list) or None, ', '.join(final_conflicts_list) or None,
get_field('Provides'), provides,
ess, ess,
] ]
@ -704,28 +727,6 @@ class Britney(object):
else: else:
srcdist[source] = [source_version, 'faux', [pkg_id], None, True] srcdist[source] = [source_version, 'faux', [pkg_id], None, True]
if dpkg[PROVIDES]:
parts = apt_pkg.parse_depends(dpkg[PROVIDES], False)
nprov = []
for or_clause in parts:
if len(or_clause) != 1:
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, 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
provided = intern(provided)
provided_version = intern(provided_version)
part = (provided, provided_version, intern(op))
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
if pkg_id in all_binaries: if pkg_id in all_binaries:

Loading…
Cancel
Save