Expand version field during image_build using version_generator

We can specify !VERSION_FROM_VERSION in version field during
image_build to expand it to correct release number without any label
information.

Also implemented !RELEASE_FROM_DATE_RESPIN to provide correct
release number. This helps to keep Atomic Host media files name
produced by image_build during bodhi updates compose run
consistent with nightly run.

Fixes: https://pagure.io/pungi/issue/987
Merges: https://pagure.io/pungi/pull-request/995

Signed-off-by: Sinny Kumari <sinny@redhat.com>
This commit is contained in:
Sinny Kumari 2018-07-04 20:25:16 +05:30 committed by Lubomír Sedlář
parent d29e56c7d8
commit 1759c1ba80
4 changed files with 29 additions and 1 deletions

View file

@ -655,6 +655,18 @@ class TestVersionGenerator(unittest.TestCase):
self.assertEqual(util.version_generator(self.compose, '!VERSION_FROM_VERSION_DATE_RESPIN'),
'8.20160101.0')
def test_release_from_date_respin(self):
self.assertEqual(
util.version_generator(self.compose, "!RELEASE_FROM_DATE_RESPIN"),
"20160101.0",
)
def test_version_from_version(self):
self.assertEqual(
util.version_generator(self.compose, "!VERSION_FROM_VERSION"),
"8",
)
class TestTZOffset(unittest.TestCase):
@mock.patch('time.daylight', new=False)