From 6360daf8c557681473dba2111e0e5641e5711910 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 13 Nov 2016 08:59:49 +0000 Subject: [PATCH] Assert that binaries have sensible arch values Add a check to ensure we do not create broken test data (as happened recently, where the architecture values were swapped for a single binary). A cold hard failure like this is easier to debug compared to Britney playing "garbage in, garbage out". Signed-off-by: Niels Thykier --- britney.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/britney.py b/britney.py index 28d0292..6d8361a 100755 --- a/britney.py +++ b/britney.py @@ -970,11 +970,16 @@ class Britney(object): else: provides = [] + raw_arch = intern(get_field('Architecture')) + if raw_arch not in {'all', arch}: # pragma: no cover + raise AssertionError("%s has wrong architecture (%s) - should be either %s or all" % ( + str(pkg_id), raw_arch, arch)) + dpkg = BinaryPackage(version, intern(get_field('Section')), source, source_version, - intern(get_field('Architecture')), + raw_arch, get_field('Multi-Arch'), deps, ', '.join(final_conflicts_list) or None,