From a073e359408592c610acdccc204dca218a872b0b Mon Sep 17 00:00:00 2001 From: Ivo De Decker Date: Wed, 2 Jan 2019 23:40:04 +0000 Subject: [PATCH] BuildDependsPolicy: split off checking in separate function Signed-off-by: Ivo De Decker --- britney2/policies/policy.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/britney2/policies/policy.py b/britney2/policies/policy.py index 82a3d67..0cd785d 100644 --- a/britney2/policies/policy.py +++ b/britney2/policies/policy.py @@ -761,16 +761,26 @@ class BuildDependsPolicy(BasePolicy): def apply_src_policy_impl(self, build_deps_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse, get_dependency_solvers=get_dependency_solvers): verdict = PolicyVerdict.PASS + + # analyze the dependency fields (if present) + deps = source_data_srcdist.build_deps_arch + if deps: + v = self._check_build_deps(deps, DependencyType.BUILD_DEPENDS, build_deps_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse, + get_dependency_solvers=get_dependency_solvers) + if verdict.value < v.value: + verdict = v + + return verdict + + def _check_build_deps(self, deps, dep_type, build_deps_info, suite, source_name, source_data_tdist, source_data_srcdist, excuse, + get_dependency_solvers=get_dependency_solvers): + verdict = PolicyVerdict.PASS + britney = self._britney # local copies for better performance parse_src_depends = apt_pkg.parse_src_depends - # analyze the dependency fields (if present) - deps = source_data_srcdist.build_deps_arch - if not deps: - return verdict - sources_s = None sources_t = None source_suite = self.suite_info[suite]