Backport fix for Accessing ci_base date via compose

https://pagure.io/pungi/pull-request/910
This commit is contained in:
Kevin Fenzi 2018-04-24 13:45:29 -07:00
parent 1a0e311a4d
commit a31678c7a3
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From 527394707d118d36977b17091eb39212a1f1aae0 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Apr 15 2018 00:16:23 +0000
Subject: Access ci_base date via compose
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
diff --git a/pungi/util.py b/pungi/util.py
index 261f3f2..b8cf9ba 100644
--- a/pungi/util.py
+++ b/pungi/util.py
@@ -789,7 +789,7 @@ def version_generator(compose, gen):
return compose.image_release
elif gen == '!VERSION_FROM_VERSION_DATE_RESPIN':
return '%s.%s.%s' % (compose.ci_base.release.version,
- compose.ci_base.date,
+ compose.compose_date,
compose.compose_respin)
elif gen and gen[0] == '!':
raise RuntimeError("Unknown version generator '%s'" % gen)
diff --git a/tests/test_util.py b/tests/test_util.py
index 2b4c2d2..1f22b63 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -626,7 +626,6 @@ class TestVersionGenerator(unittest.TestCase):
ci.respin = 0
ci.id = 'RHEL-8.0-20180101.0'
ci.release.version = '8'
- ci.date = '20160101'
ci.type = 'nightly'
ci.type_suffix = ''
ci.label = 'RC-1.0'
@@ -635,6 +634,7 @@ class TestVersionGenerator(unittest.TestCase):
self.compose = mock.MagicMock()
self.compose.ci_base = ci
self.compose.compose_respin = 0
+ self.compose.compose_date = '20160101'
def test_unknown_generator(self):
compose = mock.Mock()

View File

@ -1,6 +1,6 @@
Name: pungi
Version: 4.1.23
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Distribution compose tool
Group: Development/Tools
@ -17,6 +17,7 @@ Patch6: 0006-Update-configuration-docs-with-module_defaults_dir.patch
Patch7: 0007-Update-the-configuration-JSON-schema-for-module_defa.patch
Patch8: 0008-Clone-module-defaults-into-work-directory.patch
Patch9: 0009-init-Stop-creating-module-defaults-dir-twice.patch
Patch10: 0010-Access-ci_base-date-via-compose.patch
BuildRequires: python3-nose
BuildRequires: python3-mock
@ -183,6 +184,10 @@ nosetests-3 --exe
%{_bindir}/%{name}-wait-for-signed-ostree-handler
%changelog
* Tue Apr 24 2018 Kevin Fenzi <kevin@scrye.com> - 4.1.23-5
- Backport fix for Accessing ci_base date via compose
- https://pagure.io/pungi/pull-request/910
* Thu Apr 12 2018 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.23-4
- Stop creating module defaults dir twice