Extract a compute_item_name method

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 6 years ago committed by Ivo De Decker
parent 97ed917db4
commit 82fa58df20

@ -209,7 +209,7 @@ from britney2.utils import (log_and_format_old_libraries, get_dependency_solvers
format_and_log_uninst, newly_uninst,
write_excuses, write_heidi_delta,
old_libraries, is_nuninst_asgood_generous,
clone_nuninst,
clone_nuninst, compute_item_name,
invalidate_excuses, compile_nuninst,
find_smooth_updateable_binaries, parse_provides,
MigrationConstraintException,
@ -801,10 +801,8 @@ class Britney(object):
sources_t = target_suite.sources
sources_s = source_suite.sources
for p in packages:
if p in sources_t and sources_t[p].version == sources_s[p].version:
excuse.add_dependency(DependencyType.DEPENDS, "%s/%s" % (p, arch), arch)
else:
excuse.add_dependency(DependencyType.DEPENDS, p, arch)
item_name = compute_item_name(sources_t, sources_s, p, arch)
excuse.add_dependency(DependencyType.DEPENDS, item_name, arch)
else:
for p in packages:
excuse.add_break_dep(p, arch)

@ -13,7 +13,7 @@ from britney2 import SuiteClass
from britney2.hints import Hint, split_into_one_hint_per_package
from britney2.inputs.suiteloader import SuiteContentLoader
from britney2.policies import PolicyVerdict
from britney2.utils import get_dependency_solvers
from britney2.utils import get_dependency_solvers, compute_item_name
from britney2 import DependencyType
@ -821,10 +821,8 @@ class BuildDependsPolicy(BasePolicy):
# for the solving packages, update the excuse to add the dependencies
for p in packages:
if arch not in self.options.break_arches:
if p in sources_t and sources_t[p].version == sources_s[p].version:
excuse.add_dependency(dep_type,"%s/%s" % (p, arch), arch)
else:
excuse.add_dependency(dep_type, p, arch)
item_name = compute_item_name(sources_t, sources_s, p, arch)
excuse.add_dependency(dep_type, item_name, arch)
if arch in results:
if results[arch] == BuildDepResult.FAILED:

@ -869,3 +869,9 @@ def parse_provides(provides_raw, pkg_id=None, logger=None):
part = (provided, provided_version, sys.intern(op))
nprov.append(part)
return nprov
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:
return "%s/%s" % (source_name, parch)
return source_name

Loading…
Cancel
Save