| |
@@ -266,17 +266,27 @@
|
| |
|
| |
self.assert_rpmdefines()
|
| |
|
| |
+ @patch('pyrpkg.Commands.kojisession', new_callable=PropertyMock)
|
| |
@patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock)
|
| |
- def test_load_epel10_dist_tag(self, branch_merge):
|
| |
+ def test_load_epel10_dist_tag(self, branch_merge, kojisession):
|
| |
branch_merge.return_value = 'epel10'
|
| |
|
| |
+ self.cmd._kojisession = Mock()
|
| |
+ koji_session = kojisession.return_value
|
| |
+ koji_session.getBuildConfig.return_value = {
|
| |
+ # minimal subset of the real koji response
|
| |
+ 'extra': {
|
| |
+ 'rpm.macro.distcore': '.el10_3',
|
| |
+ },
|
| |
+ }
|
| |
+
|
| |
self.cmd.load_rpmdefines()
|
| |
|
| |
self.assertEqual('10', self.cmd._distval)
|
| |
self.assertEqual('rhel', self.cmd._distvar)
|
| |
- self.assertEqual('el10', self.cmd._disttag)
|
| |
+ self.assertEqual('el10_3', self.cmd._disttag)
|
| |
self.assertEqual('epel-10-i686', self.cmd.mockconfig)
|
| |
- self.assertEqual('epel10-override', self.cmd.override)
|
| |
+ self.assertEqual('epel10.3-override', self.cmd.override)
|
| |
self.assertTrue(hasattr(self.cmd, '_distunset'))
|
| |
|
| |
self.assert_rpmdefines()
|
| |
@@ -359,6 +369,80 @@
|
| |
self.assert_rpmdefines(extra_rpmdefines)
|
| |
|
| |
|
| |
+ class TestLoadRpmDefinesRuntimes(CommandTestCase):
|
| |
+ """Test Commands.load_rpmdefines"""
|
| |
+
|
| |
+ def setUp(self):
|
| |
+ super(TestLoadRpmDefinesRuntimes, self).setUp()
|
| |
+
|
| |
+ self.localarch = patch(
|
| |
+ 'pyrpkg.Commands.localarch',
|
| |
+ new_callable=PropertyMock,
|
| |
+ return_value='i686')
|
| |
+ self.localarch.start()
|
| |
+
|
| |
+ self.cmd = self.make_commands()
|
| |
+
|
| |
+ def tearDown(self):
|
| |
+ self.localarch.stop()
|
| |
+ super(TestLoadRpmDefinesRuntimes, self).tearDown()
|
| |
+
|
| |
+ def assert_rpmdefines(self, extra_rpmdefines=[]):
|
| |
+ """Assert Commands._rpmdefines after calling load_rpmdefines"""
|
| |
+ expected_rpmdefines = [
|
| |
+ "--define", "_sourcedir %s" % self.cmd.layout.sourcedir,
|
| |
+ "--define", "_specdir %s" % self.cmd.layout.specdir,
|
| |
+ "--define", "_builddir %s" % self.cmd.layout.builddir,
|
| |
+ "--define", "_srcrpmdir %s" % self.cmd.layout.srcrpmdir,
|
| |
+ "--define", "_rpmdir %s" % self.cmd.layout.rpmdir,
|
| |
+ "--define", "_rpmfilename %s" % self.cmd.layout.rpmfilename,
|
| |
+ "--define", "dist %%{?distprefix}.%s" % self.cmd._disttag,
|
| |
+ "--define", "%s %s" % (self.cmd._distvar, self.cmd._distval),
|
| |
+ "--eval", "%%undefine %s" % self.cmd._distunset,
|
| |
+ "--define", "%s 1" % self.cmd._disttag.replace(".", "_")
|
| |
+ ]
|
| |
+ expected_rpmdefines.extend(extra_rpmdefines)
|
| |
+ self.assertEqual(expected_rpmdefines, self.cmd._rpmdefines)
|
| |
+
|
| |
+ @patch('fedpkg.Commands._determine_runtime_env')
|
| |
+ @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock)
|
| |
+ def test_load_fc40_on_el10_8_runtime(self, branch_merge, _determine_runtime_env):
|
| |
+ _determine_runtime_env.return_value = 'fc40'
|
| |
+ branch_merge.return_value = 'epel10.8'
|
| |
+
|
| |
+ self.cmd.load_rpmdefines()
|
| |
+ extra_rpmdefines = [
|
| |
+ "--eval", "%%undefine %s" % self.cmd._runtime_disttag]
|
| |
+ self.assert_rpmdefines(extra_rpmdefines)
|
| |
+
|
| |
+ @patch('fedpkg.Commands._determine_runtime_env')
|
| |
+ @patch('pyrpkg.Commands.kojisession', new_callable=PropertyMock)
|
| |
+ @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock)
|
| |
+ def test_load_epel10_on_el10_runtime(self, branch_merge, kojisession, _determine_runtime_env):
|
| |
+ _determine_runtime_env.return_value = 'el10'
|
| |
+ branch_merge.return_value = 'epel10'
|
| |
+
|
| |
+ self.cmd._kojisession = Mock()
|
| |
+ koji_session = kojisession.return_value
|
| |
+ koji_session.getBuildConfig.return_value = {
|
| |
+ # minimal subset of the real koji response
|
| |
+ 'extra': {
|
| |
+ 'rpm.macro.distcore': '.el10_8',
|
| |
+ },
|
| |
+ }
|
| |
+ self.cmd.load_rpmdefines()
|
| |
+ self.assert_rpmdefines()
|
| |
+
|
| |
+ @patch('fedpkg.Commands._determine_runtime_env')
|
| |
+ @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock)
|
| |
+ def test_load_epel10_4_on_el10_runtime(self, branch_merge, _determine_runtime_env):
|
| |
+ _determine_runtime_env.return_value = 'el10'
|
| |
+ branch_merge.return_value = 'epel10.4'
|
| |
+
|
| |
+ self.cmd.load_rpmdefines()
|
| |
+ self.assert_rpmdefines()
|
| |
+
|
| |
+
|
| |
class TestFindRawhideBranch(CommandTestCase):
|
| |
"""Test Commands._findrawhidebranch"""
|
| |
|
| |
When using the plain epel10 branch, we still need to set the minor version for both the dist_tag and override values.
As sugested by @carlwgeorge in #559 we can get this value from koji like how
eln
gets it'sdistval
.This PR does this by using the
distcore
macro value available from koji for theepel10
build target, which provides that information.These changes should fix #559