pkgset: Set correct nsvc for devel modules
We need to update the source modulemd to match what we want. For most modules the name will be correct already, but in case of devel modules the original name will still be present there. Fixes: COMPOSE-3596 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
f6162b90dd
commit
4e5f74b78d
@ -246,6 +246,9 @@ def _add_module_to_variant(koji_wrapper, variant, build, add_to_variant_modules=
|
||||
return
|
||||
|
||||
source_mmd = mmds["modulemd.txt"]
|
||||
# Set name from build to modulemd. Generally it will match, but for devel
|
||||
# modules the source mmd contains the original name.
|
||||
source_mmd.set_name(build["extra"]["typeinfo"]["module"]["name"])
|
||||
nsvc = source_mmd.dup_nsvc()
|
||||
|
||||
variant.mmds.append(source_mmd)
|
||||
|
@ -671,6 +671,9 @@ class MockModule(object):
|
||||
def dup_nsvc(self):
|
||||
return "module:master:20190318.abcdef"
|
||||
|
||||
def set_name(self, name):
|
||||
pass
|
||||
|
||||
|
||||
@mock.patch("pungi.Modulemd.Module.new_from_file", new=MockModule)
|
||||
@unittest.skipIf(Modulemd is None, "Skipping tests, no module support")
|
||||
@ -685,7 +688,7 @@ class TestAddModuleToVariant(unittest.TestCase):
|
||||
] + [{"btype": "foo"}]
|
||||
|
||||
def test_adding_module(self):
|
||||
build = {"id": 1234}
|
||||
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
|
||||
variant = mock.Mock(
|
||||
arches=["armhfp", "x86_64"], mmds=[], arch_mmds={}, modules=[]
|
||||
)
|
||||
@ -707,7 +710,7 @@ class TestAddModuleToVariant(unittest.TestCase):
|
||||
self.assertEqual(variant.modules, [])
|
||||
|
||||
def test_adding_module_to_existing(self):
|
||||
build = {"id": 1234}
|
||||
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
|
||||
variant = mock.Mock(
|
||||
arches=["armhfp", "x86_64"],
|
||||
mmds=[MockModule("/koji/m1.txt")],
|
||||
@ -737,7 +740,7 @@ class TestAddModuleToVariant(unittest.TestCase):
|
||||
self.assertEqual(variant.modules, ["m1:latest-20190101.cafe"])
|
||||
|
||||
def test_adding_module_with_add_module(self):
|
||||
build = {"id": 1234}
|
||||
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
|
||||
variant = mock.Mock(
|
||||
arches=["armhfp", "x86_64"], mmds=[], arch_mmds={}, modules=[]
|
||||
)
|
||||
@ -761,7 +764,7 @@ class TestAddModuleToVariant(unittest.TestCase):
|
||||
self.assertEqual(variant.modules, ["module:master:20190318.abcdef"])
|
||||
|
||||
def test_adding_module_to_existing_with_add_module(self):
|
||||
build = {"id": 1234}
|
||||
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
|
||||
variant = mock.Mock(
|
||||
arches=["armhfp", "x86_64"],
|
||||
mmds=[MockModule("/koji/m1.txt")],
|
||||
|
Loading…
Reference in New Issue
Block a user