Merge "allow setting tarball-base once in the repository-settings"
This commit is contained in:
commit
9339106a3c
@ -233,6 +233,10 @@ class Repo(object):
|
||||
def base_name(self):
|
||||
return self.name.rsplit('/')[-1]
|
||||
|
||||
@property
|
||||
def tarball_base(self):
|
||||
return self._data.get('tarball-base')
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.name == other.name
|
||||
|
||||
@ -255,7 +259,9 @@ class ReleaseProject(object):
|
||||
|
||||
@property
|
||||
def tarball_base(self):
|
||||
return self._data.get('tarball-base')
|
||||
if 'tarball-base' in self._data:
|
||||
return self._data['tarball-base']
|
||||
return self.repo.tarball_base
|
||||
|
||||
def guess_sdist_name(self):
|
||||
return self.tarball_base or self.repo.base_name
|
||||
|
@ -45,6 +45,8 @@ properties:
|
||||
items:
|
||||
type: "string"
|
||||
enum: [ "no-artifact-build-job", "retired" ]
|
||||
tarball-base:
|
||||
type: "string"
|
||||
release-type:
|
||||
type: "string"
|
||||
enum: [ "python-service", "python-pypi", "xstatic", "fuel",
|
||||
|
@ -171,3 +171,90 @@ class TestEOLTags(base.BaseTestCase):
|
||||
'',
|
||||
deliv.releases[-1].eol_series,
|
||||
)
|
||||
|
||||
|
||||
class TestTarballBase(base.BaseTestCase):
|
||||
|
||||
def test_not_set(self):
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series='newton',
|
||||
name='name',
|
||||
data={
|
||||
'releases': [
|
||||
{'version': '1.5.0',
|
||||
'projects': [
|
||||
{'repo': 'openstack/release-test',
|
||||
'hash': 'a26e6a2e8a5e321b2e3517dbb01a7b9a56a8bfd5'},
|
||||
]}
|
||||
],
|
||||
},
|
||||
)
|
||||
project = deliv.releases[-1].projects[0]
|
||||
self.assertIsNone(project.tarball_base)
|
||||
|
||||
def test_set_project(self):
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series='newton',
|
||||
name='name',
|
||||
data={
|
||||
'releases': [
|
||||
{'version': '1.5.0',
|
||||
'projects': [
|
||||
{'repo': 'openstack/release-test',
|
||||
'hash': 'a26e6a2e8a5e321b2e3517dbb01a7b9a56a8bfd5',
|
||||
'tarball-base': 'foo'},
|
||||
]}
|
||||
],
|
||||
},
|
||||
)
|
||||
project = deliv.releases[-1].projects[0]
|
||||
self.assertEqual('foo', project.tarball_base)
|
||||
|
||||
def test_set_repo(self):
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series='newton',
|
||||
name='name',
|
||||
data={
|
||||
'releases': [
|
||||
{'version': '1.5.0',
|
||||
'projects': [
|
||||
{'repo': 'openstack/release-test',
|
||||
'hash': 'a26e6a2e8a5e321b2e3517dbb01a7b9a56a8bfd5'},
|
||||
]}
|
||||
],
|
||||
'repository-settings': {
|
||||
'openstack/release-test': {
|
||||
'tarball-base': 'bar',
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
project = deliv.releases[-1].projects[0]
|
||||
self.assertEqual('bar', project.tarball_base)
|
||||
|
||||
def test_project_overrides(self):
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series='newton',
|
||||
name='name',
|
||||
data={
|
||||
'releases': [
|
||||
{'version': '1.5.0',
|
||||
'projects': [
|
||||
{'repo': 'openstack/release-test',
|
||||
'hash': 'a26e6a2e8a5e321b2e3517dbb01a7b9a56a8bfd5',
|
||||
'tarball-base': 'foo'},
|
||||
]}
|
||||
],
|
||||
'repository-settings': {
|
||||
'openstack/release-test': {
|
||||
'tarball-base': 'bar',
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
project = deliv.releases[-1].projects[0]
|
||||
self.assertEqual('foo', project.tarball_base)
|
||||
|
Loading…
Reference in New Issue
Block a user