From a0dece5b7671ffd083db42e3e0df9eb46c66ffb5 Mon Sep 17 00:00:00 2001 From: Tim Andersson Date: Wed, 7 Aug 2024 12:58:30 +0100 Subject: [PATCH] fix traceback in useless i386 tests check The recent change in commit ac6b0c1ba780913a5626b3e08e2c56f0d8454248 is not currently functional - it's hard to test and although similar functionality exists elsewhere in the code, the changes in said commit resulted in the following traceback: ``` 'str' object has no attribute 'architecture' ``` This commit amends the issue by utilising the `binaries_info` variable instead, with its properties defined here: https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu/tree/britney2/__init__.py#n304 Brian had previously made this commit: https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu/commit/?id=663bd2571cc81a9477408c0711aeb6b2452c17a8 to try and amend the issue, though it seems it hasn't helped. This commit also adds a little bit more logging surrounding this new functionality and also adds a break statement for efficiency. --- britney2/policies/autopkgtest.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index 6b56c10..be9db4e 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -705,15 +705,19 @@ class AutopkgtestPolicy(BasePolicy): try: if arch == "i386": all_binaries_arch_all = True - srcinfo = source_suite.sources[src] - for pkg_id in srcinfo.binaries: - if pkg_id.architecture != "all": + for package_name in binaries_info.keys(): + if binaries_info[package_name].architecture != "all": all_binaries_arch_all = False + break if all_binaries_arch_all: self.logger.info('Source package %s has binaries which are all Architecture: all, and tests have been requested on %s, not running any tests for this src package', src, arch) return [] + else: + self.logger.info('Source package %s has binaries which are NOT Architecture: all, and tests have been requested on %s, running tests for this package', + src, + arch) except Exception as e: self.logger.error('i386 useless autopkgtest check failed with: %s', e)