From eac1bf30a9615af37f11a13c9863433c8195d4de Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 12 Oct 2016 16:33:47 +0200 Subject: [PATCH] Re-fix merging of source packages We need complete copies of the SourcePackage objects, as we might later find some binaries which are only in unstable. Traceback (most recent call last): File "/home/ubuntu-archive/proposed-migration/code/b2/britney.py", line 3290, in Britney().main() File "/home/ubuntu-archive/proposed-migration/code/b2/britney.py", line 3261, in main self.write_excuses() File "/home/ubuntu-archive/proposed-migration/code/b2/britney.py", line 1963, in write_excuses if should_upgrade_srcarch(pkg, arch, 'unstable'): File "/home/ubuntu-archive/proposed-migration/code/b2/britney.py", line 1534, in should_upgrade_srcarch False) File "/home/ubuntu-archive/proposed-migration/code/b2/britney.py", line 2294, in _compute_groups if binaries_t[parch][0][binary].source != source_name: KeyError: 'kicad' --- britney.py | 5 ++++- tests/test_autopkgtest.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/britney.py b/britney.py index af8af0f..9d42876 100755 --- a/britney.py +++ b/britney.py @@ -188,6 +188,7 @@ import os import sys import time import optparse +import copy import apt_pkg @@ -1040,9 +1041,11 @@ class Britney(object): """Merge sources from `source' into partial suite `target'.""" source_sources = self.sources[source] target_sources = self.sources[target] + # we need complete copies here, as we might later find some binaries + # which are only in unstable for pkg, value in source_sources.items(): if pkg not in target_sources: - target_sources[pkg] = value + target_sources[pkg] = copy.deepcopy(value) def merge_binaries(self, source, target, arch): """Merge `arch' binaries from `source' into partial suite `target'.""" diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index e563689..00af277 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -873,6 +873,21 @@ class T(TestBase): self.assertEqual(self.pending_requests, {}) self.assertEqual(self.amqp_requests, set()) + def test_same_version_binary_in_unstable(self): + '''binary from new architecture in unstable with testing version''' + + # i386 is in testing already, but amd64 just recently built and is in unstable + self.data.add_src('brown', False, {'Testsuite': 'autopkgtest'}) + self.data.add('brown', False, {'Architecture': 'i386'}, add_src=False) + self.data.add('brown', True, {'Architecture': 'amd64'}, add_src=False) + + exc = self.do_test( + # we need some other package to create unstable Sources + [('lightgreen', {'Version': '2'}, 'autopkgtest')], + {'brown': (True, {})} + )[1] + self.assertEqual(exc['brown']['item-name'], 'brown/amd64') + def test_package_pair_running(self): '''Two packages in unstable that need to go in together (running)'''