From 18fd57e3833506c1c9769379763e8543c1ec36b0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 17 Nov 2016 18:39:38 +0100 Subject: [PATCH] policies/sourceppa.py: Cache "no PPA" results as well This accidentally got broken by 11705f4a7. --- policies/sourceppa.py | 2 +- tests/test_autopkgtest.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/policies/sourceppa.py b/policies/sourceppa.py index 7575f35..081dcca 100644 --- a/policies/sourceppa.py +++ b/policies/sourceppa.py @@ -85,11 +85,11 @@ class SourcePPAPolicy(BasePolicy): britney_excuses = self.britney.excuses version = source_data_srcdist.version sourceppa = self.lp_get_source_ppa(source_name, version) + self.source_ppas_by_pkg[source_name][version] = sourceppa if not sourceppa: return PolicyVerdict.PASS shortppa = sourceppa.replace(LAUNCHPAD_URL, '') - self.source_ppas_by_pkg[source_name][version] = sourceppa sourceppa_info[source_name] = shortppa # Check for other packages that might invalidate this one for friend in self.pkgs_by_source_ppa[sourceppa]: diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index f8a9a66..3cf76af 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -2052,14 +2052,23 @@ class T(TestBase): exc = self.do_test( [('green', {'Version': '2'}, 'autopkgtest'), - ('red', {'Version': '2'}, 'autopkgtest')], + ('red', {'Version': '2'}, 'autopkgtest'), + ('gcc-5', {}, 'autopkgtest')], {'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')], 'red': [('reason', 'source-ppa')]} )[1] 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): '''Packages from same source PPA get rejected for failed peer FTBFS'''