From 07b9c517c82916bddcfbd22a196bc573f802aca8 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Thu, 11 Jun 2020 11:47:06 +0100 Subject: [PATCH] BuildDependsPolicy: handle old python3-apt Very old versions, such as that run on the Ubuntu archive machine, don't have the arch parameter. Handle that by setting APT::Architecture instead --- britney.py | 1 + britney2/policies/policy.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/britney.py b/britney.py index 2f70306..02285b8 100755 --- a/britney.py +++ b/britney.py @@ -298,6 +298,7 @@ class Britney(object): # initialize the apt_pkg back-end apt_pkg.init() + apt_pkg.init_config() # parse the command line arguments self._policy_engine = PolicyEngine() diff --git a/britney2/policies/policy.py b/britney2/policies/policy.py index b5a5dac..da294eb 100644 --- a/britney2/policies/policy.py +++ b/britney2/policies/policy.py @@ -1074,7 +1074,14 @@ class BuildDependsPolicy(BasePolicy): arch_results[arch] = BuildDepResult.OK # for every dependency block (formed as conjunction of disjunction) for block_txt in deps.split(','): - block = parse_src_depends(block_txt, False, arch) + try: + block = parse_src_depends(block_txt, False, arch) + except TypeError: + # old python3-apt didn't have the third argument + native_arch = apt_pkg.config["APT::Architecture"] + apt_pkg.config["APT::Architecture"] = arch + block = parse_src_depends(block_txt, False) + apt_pkg.config["APT::Architecture"] = native_arch # Unlike regular dependencies, some clauses of the Build-Depends(-Arch|-Indep) can be # filtered out by (e.g.) architecture restrictions. We need to cope with this while # keeping block_txt and block aligned.