policies/sourceppa.py: Cache "no PPA" results as well

This accidentally got broken by 11705f4a7.
pre-rebase-2016-12-12
Martin Pitt 8 years ago
parent efd8794804
commit 18fd57e383

@ -85,11 +85,11 @@ class SourcePPAPolicy(BasePolicy):
britney_excuses = self.britney.excuses britney_excuses = self.britney.excuses
version = source_data_srcdist.version version = source_data_srcdist.version
sourceppa = self.lp_get_source_ppa(source_name, version) sourceppa = self.lp_get_source_ppa(source_name, version)
self.source_ppas_by_pkg[source_name][version] = sourceppa
if not sourceppa: if not sourceppa:
return PolicyVerdict.PASS return PolicyVerdict.PASS
shortppa = sourceppa.replace(LAUNCHPAD_URL, '') shortppa = sourceppa.replace(LAUNCHPAD_URL, '')
self.source_ppas_by_pkg[source_name][version] = sourceppa
sourceppa_info[source_name] = shortppa sourceppa_info[source_name] = shortppa
# Check for other packages that might invalidate this one # Check for other packages that might invalidate this one
for friend in self.pkgs_by_source_ppa[sourceppa]: for friend in self.pkgs_by_source_ppa[sourceppa]:

@ -2052,14 +2052,23 @@ class T(TestBase):
exc = self.do_test( exc = self.do_test(
[('green', {'Version': '2'}, 'autopkgtest'), [('green', {'Version': '2'}, 'autopkgtest'),
('red', {'Version': '2'}, 'autopkgtest')], ('red', {'Version': '2'}, 'autopkgtest'),
('gcc-5', {}, 'autopkgtest')],
{'green': (False, {'green': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}), {'green': (False, {'green': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}),
'red': (False, {'red': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}})}, 'red': (False, {'red': {'i386': 'RUNNING-ALWAYSFAIL', 'amd64': 'RUNNING-ALWAYSFAIL'}}),
'gcc-5': (True, {}),
},
{'green': [('reason', 'block')], {'green': [('reason', 'block')],
'red': [('reason', 'source-ppa')]} 'red': [('reason', 'source-ppa')]}
)[1] )[1]
self.assertEqual(exc['red']['policy_info']['source-ppa'], {'red': 'team/ubuntu/ppa', 'green': 'team/ubuntu/ppa'}) self.assertEqual(exc['red']['policy_info']['source-ppa'], {'red': 'team/ubuntu/ppa', 'green': 'team/ubuntu/ppa'})
with open(os.path.join(self.data.path, 'data/series-proposed/SourcePPA')) as f:
res = json.load(f)
self.assertEqual(res, {'red': {'2': 'team/ubuntu/ppa'},
'green': {'2': 'team/ubuntu/ppa'},
'gcc-5': {'1': ''}})
def test_sourceppa_missingbuild(self): def test_sourceppa_missingbuild(self):
'''Packages from same source PPA get rejected for failed peer FTBFS''' '''Packages from same source PPA get rejected for failed peer FTBFS'''

Loading…
Cancel
Save