Fix KeyError crash with NBS binaries in testing

Traceback (most recent call last):
   File "/var/lib/britney/britney.py", line 3390, in <module>
     Britney().main()
   File "/var/lib/britney/britney.py", line 295, in __init__
     self.merge_binaries('testing', 'unstable', arch)
   File "/var/lib/britney/britney.py", line 785, in merge_binaries
     target_version = target_sources[value[SOURCE]][VERSION]
 KeyError: 'insighttoolkit4'
bzr-import-20160707
Martin Pitt 9 years ago
parent 6269ca4813
commit 158d79999f

@ -781,7 +781,11 @@ class Britney(object):
# that have built on this architecture.
if value[SOURCE] not in oodsrcs:
source_version = source_sources[value[SOURCE]][VERSION]
target_version = target_sources[value[SOURCE]][VERSION]
try:
target_version = target_sources[value[SOURCE]][VERSION]
except KeyError:
self.__log("merge_binaries: pkg %s has no source, NBS?" % pkg)
continue
if source_version != target_version:
current_arch = value[ARCHITECTURE]
built = False

@ -1216,6 +1216,22 @@ class T(TestBase):
{'lightgreen': [('old-version', '1'), ('new-version', '2')]}
)
def test_nbs(self):
'''source-less binaries do not cause harm'''
# NBS in testing
self.data.add('liboldgreen0', False, add_src=False)
# NBS in unstable
self.data.add('liboldgreen1', True, add_src=False)
self.do_test(
[('libgreen1', {'Version': '2', 'Source': 'green'}, 'autopkgtest')],
{'green': (True, {'green 2': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
'lightgreen 1': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
'darkgreen 1': {'amd64': 'RUNNING-ALWAYSFAIL', 'i386': 'RUNNING-ALWAYSFAIL'},
}),
},
{'green': [('old-version', '1'), ('new-version', '2')]})
################################################################
# Tests for hint processing
################################################################

Loading…
Cancel
Save