mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-17 13:31:29 +00:00
autopkgtest: Handle 'blacklisted' version
The apt version comparison sorts 'blacklisted' greater than most version numbers, which means that we accidentally apply force hints for version 'blacklisted' to all uploads. Since this is the only case of a hacked version number, let's special case it so that 'blacklisted' hints only match packages with 'blacklisted' version.
This commit is contained in:
parent
34c8b05010
commit
af085da46e
@ -1182,7 +1182,9 @@ class AutopkgtestPolicy(BasePolicy):
|
|||||||
self.logger.info('Checking hints for %s/%s/%s: %s', src, ver, arch, [str(h) for h in hints])
|
self.logger.info('Checking hints for %s/%s/%s: %s', src, ver, arch, [str(h) for h in hints])
|
||||||
for hint in hints:
|
for hint in hints:
|
||||||
if [mi for mi in hint.packages if mi.architecture in ['source', arch] and
|
if [mi for mi in hint.packages if mi.architecture in ['source', arch] and
|
||||||
(mi.version == 'all' or apt_pkg.version_compare(ver, mi.version) <= 0)]:
|
(mi.version == 'all' or
|
||||||
|
(mi.version == 'blacklisted' and ver == 'blacklisted') or
|
||||||
|
(mi.version != 'blacklisted' and apt_pkg.version_compare(ver, mi.version) <= 0))]:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -1182,8 +1182,8 @@ class AT(TestAutopkgtestBase):
|
|||||||
'brown': ['i386']}})
|
'brown': ['i386']}})
|
||||||
|
|
||||||
def test_blacklisted_force(self):
|
def test_blacklisted_force(self):
|
||||||
'''blacklisted packages return exit code 99 and version all, check they
|
'''blacklisted packages return exit code 99 and version blacklisted,
|
||||||
are handled correctly'''
|
check they can be forced over'''
|
||||||
|
|
||||||
self.data.add_default_packages(black=False)
|
self.data.add_default_packages(black=False)
|
||||||
|
|
||||||
@ -1205,6 +1205,28 @@ class AT(TestAutopkgtestBase):
|
|||||||
|
|
||||||
self.assertEqual(len(self.amqp_requests), 0)
|
self.assertEqual(len(self.amqp_requests), 0)
|
||||||
|
|
||||||
|
def test_blacklisted_force_mismatch(self):
|
||||||
|
'''forcing a blacklisted package doesn't mean you force other versions'''
|
||||||
|
|
||||||
|
self.data.add_default_packages(black=False)
|
||||||
|
|
||||||
|
self.swift.set_results({'autopkgtest-testing': {
|
||||||
|
'testing/amd64/b/black/20150101_100000@': (0, 'black 1', tr('black/1')),
|
||||||
|
'testing/i386/b/black/20150101_100001@': (0, 'black 1', tr('black/1')),
|
||||||
|
'testing/amd64/b/black/20150102_100000@': (4, 'black 2', tr('black/2')),
|
||||||
|
'testing/i386/b/black/20150102_100001@': (4, 'black 2', tr('black/2'))
|
||||||
|
}})
|
||||||
|
|
||||||
|
self.create_hint('autopkgtest', 'force-badtest black/amd64/blacklisted')
|
||||||
|
|
||||||
|
self.run_it(
|
||||||
|
[('black', {'Version': '2'}, 'autopkgtest')],
|
||||||
|
{'black': (False, {'black/2': {'amd64': 'REGRESSION'}})
|
||||||
|
},
|
||||||
|
{'black': [('old-version', '1'), ('new-version', '2')]})
|
||||||
|
|
||||||
|
self.assertEqual(len(self.amqp_requests), 0)
|
||||||
|
|
||||||
def test_binary_from_new_source_package_pass(self):
|
def test_binary_from_new_source_package_pass(self):
|
||||||
'''building an existing binary for a new source package (pass)'''
|
'''building an existing binary for a new source package (pass)'''
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user