Read Built-Using info for binary packages

Signed-off-by: Ivo De Decker <ivodd@debian.org>
ubuntu/rebased
Ivo De Decker 6 years ago committed by Niels Thykier
parent 35ae8848b4
commit 4fcb90b775
No known key found for this signature in database
GPG Key ID: A65B78DBE67C7AAC

@ -563,6 +563,7 @@ class Britney(object):
provides, provides,
False, False,
pkg_id, pkg_id,
[],
) )
src_data.binaries.add(pkg_id) src_data.binaries.add(pkg_id)
@ -658,6 +659,7 @@ class Britney(object):
[], [],
False, False,
pkg_id, pkg_id,
[],
) )
src_data.binaries.add(pkg_id) src_data.binaries.add(pkg_id)
target_suite.binaries[arch][pkg_name] = bin_data target_suite.binaries[arch][pkg_name] = bin_data

@ -215,4 +215,5 @@ BinaryPackage = namedtuple('BinaryPackage', [
'provides', 'provides',
'is_essential', 'is_essential',
'pkg_id', 'pkg_id',
'builtusing',
]) ])

@ -6,7 +6,7 @@ import sys
from britney2 import SuiteClass, Suite, TargetSuite, Suites, BinaryPackage, BinaryPackageId, SourcePackage from britney2 import SuiteClass, Suite, TargetSuite, Suites, BinaryPackage, BinaryPackageId, SourcePackage
from britney2.utils import ( from britney2.utils import (
read_release_file, possibly_compressed, read_sources_file, create_provides_map, parse_provides read_release_file, possibly_compressed, read_sources_file, create_provides_map, parse_provides, parse_builtusing
) )
@ -258,6 +258,12 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
raise AssertionError("%s has wrong architecture (%s) - should be either %s or all" % ( raise AssertionError("%s has wrong architecture (%s) - should be either %s or all" % (
str(pkg_id), raw_arch, arch)) str(pkg_id), raw_arch, arch))
builtusing_raw = get_field('Built-Using')
if builtusing_raw:
builtusing = parse_builtusing(builtusing_raw, pkg_id=pkg_id, logger=self.logger)
else:
builtusing = []
dpkg = BinaryPackage(version, dpkg = BinaryPackage(version,
intern(get_field('Section')), intern(get_field('Section')),
source, source,
@ -269,6 +275,7 @@ class DebMirrorLikeSuiteContentLoader(SuiteContentLoader):
provides, provides,
ess, ess,
pkg_id, pkg_id,
builtusing,
) )
# if the source package is available in the distribution, then register this binary package # if the source package is available in the distribution, then register this binary package

@ -880,3 +880,26 @@ def compute_item_name(sources_t, sources_s, source_name, parch):
if source_name in sources_t and sources_t[source_name].version == sources_s[source_name].version: if source_name in sources_t and sources_t[source_name].version == sources_s[source_name].version:
return "%s/%s" % (source_name, parch) return "%s/%s" % (source_name, parch)
return source_name return source_name
def parse_builtusing(builtusing_raw, pkg_id=None, logger=None):
parts = apt_pkg.parse_depends(builtusing_raw, False)
nbu = []
for or_clause in parts:
if len(or_clause) != 1: # pragma: no cover
if logger is not None:
msg = "Ignoring invalid builtusing in %s: Alternatives [%s]"
logger.warning(msg, str(pkg_id), str(or_clause))
continue
for part in or_clause:
bu, bu_version, op = part
if op != '=': # pragma: no cover
if logger is not None:
msg = "Ignoring invalid builtusing in %s: %s (%s %s)"
logger.warning(msg, str(pkg_id), bu, op, bu_version)
continue
bu = sys.intern(bu)
bu_version = sys.intern(bu_version)
part = (bu, bu_version)
nbu.append(part)
return nbu

@ -82,6 +82,7 @@ def create_bin_package(pkg_id, source_name=None, depends=None, conflicts=None):
None, None,
False, False,
pkg_id, pkg_id,
[],
) )

Loading…
Cancel
Save