Stop storing modulemd without arch

Historically each variant had a list of modules. This is no longer
needed and can be dropped. We can also stop logging the modulemd since
we know it was retrieved from Koji and not modified locally.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-07-01 10:27:44 +02:00
parent a31fe998d5
commit 04baa2a4db
6 changed files with 2 additions and 34 deletions

View File

@ -249,7 +249,6 @@ def _add_module_to_variant(koji_wrapper, variant, build, add_to_variant_modules=
source_mmd.set_name(build["extra"]["typeinfo"]["module"]["name"]) source_mmd.set_name(build["extra"]["typeinfo"]["module"]["name"])
nsvc = source_mmd.dup_nsvc() nsvc = source_mmd.dup_nsvc()
variant.mmds.append(source_mmd)
for arch in variant.arches: for arch in variant.arches:
try: try:
variant.arch_mmds.setdefault(arch, {})[nsvc] = mmds["modulemd.%s.txt" % arch] variant.arch_mmds.setdefault(arch, {})[nsvc] = mmds["modulemd.%s.txt" % arch]
@ -564,9 +563,6 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event):
"modules.") "modules.")
if modular_koji_tags or (compose.conf["pkgset_koji_module_tag"] and variant.modules): if modular_koji_tags or (compose.conf["pkgset_koji_module_tag"] and variant.modules):
included_modules_file = os.path.join(
compose.paths.work.topdir(arch="global"),
"koji-tag-module-%s.yaml" % variant.uid)
_get_modules_from_koji_tags( _get_modules_from_koji_tags(
compose, compose,
koji_wrapper, koji_wrapper,
@ -575,9 +571,6 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event):
variant_tags, variant_tags,
) )
elif variant.modules: elif variant.modules:
included_modules_file = os.path.join(
compose.paths.work.topdir(arch="global"),
"koji-module-%s.yaml" % variant.uid)
_get_modules_from_koji( _get_modules_from_koji(
compose, compose,
koji_wrapper, koji_wrapper,
@ -592,8 +585,6 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event):
if variant_tag not in compose_tags: if variant_tag not in compose_tags:
compose_tags.append(variant_tag) compose_tags.append(variant_tag)
if variant.mmds:
Modulemd.Module.dump_all(variant.mmds, included_modules_file)
if not variant_tags[variant] and variant.modules is None: if not variant_tags[variant] and variant.modules is None:
variant_tags[variant].extend(force_list(compose.conf["pkgset_koji_tag"])) variant_tags[variant].extend(force_list(compose.conf["pkgset_koji_tag"]))

View File

@ -264,7 +264,6 @@ class Variant(object):
self.is_empty = is_empty self.is_empty = is_empty
self.pkgset = None self.pkgset = None
self.mmds = []
self.arch_mmds = {} self.arch_mmds = {}
self.module_uid_to_koji_tag = {} self.module_uid_to_koji_tag = {}
self.nsvc_to_pkgset = {} self.nsvc_to_pkgset = {}

View File

@ -60,7 +60,6 @@ class MockVariant(mock.Mock):
def __init__(self, is_empty=False, name=None, *args, **kwargs): def __init__(self, is_empty=False, name=None, *args, **kwargs):
super(MockVariant, self).__init__(*args, is_empty=is_empty, **kwargs) super(MockVariant, self).__init__(*args, is_empty=is_empty, **kwargs)
self.parent = kwargs.get('parent', None) self.parent = kwargs.get('parent', None)
self.mmds = []
self.arch_mmds = {} self.arch_mmds = {}
self.module_uid_to_koji_tag = {} self.module_uid_to_koji_tag = {}
self.variants = {} self.variants = {}
@ -114,7 +113,6 @@ class MockVariant(mock.Mock):
if self.modules is None: if self.modules is None:
self.modules = [] self.modules = []
self.modules.append(":".join([name, stream, version])) self.modules.append(":".join([name, stream, version]))
self.mmds.append(mmd)
if mmd_arch: if mmd_arch:
self.arch_mmds.setdefault(mmd_arch, {})[mmd.dup_nsvc()] = mmd self.arch_mmds.setdefault(mmd_arch, {})[mmd.dup_nsvc()] = mmd
return mmd return mmd

View File

@ -741,7 +741,6 @@ class TestCreateVariantRepo(PungiTestCase):
"test:f27:1:2017", rpm_nvrs=["pkg-0:1.0.0-1.x86_64"]) "test:f27:1:2017", rpm_nvrs=["pkg-0:1.0.0-1.x86_64"])
variant.arch_mmds["x86_64"]["test:f28:1:2017"] = variant.add_fake_module( variant.arch_mmds["x86_64"]["test:f28:1:2017"] = variant.add_fake_module(
"test:f28:1:2017", rpm_nvrs=["pkg-0:2.0.0-1.x86_64"]) "test:f28:1:2017", rpm_nvrs=["pkg-0:2.0.0-1.x86_64"])
variant.mmds = list(variant.arch_mmds["x86_64"].values())
def mocked_modifyrepo_cmd(repodir, mmd_path, **kwargs): def mocked_modifyrepo_cmd(repodir, mmd_path, **kwargs):
modules = Modulemd.Module.new_all_from_file(mmd_path) modules = Modulemd.Module.new_all_from_file(mmd_path)
@ -792,7 +791,6 @@ class TestCreateVariantRepo(PungiTestCase):
with_artifacts=True, with_artifacts=True,
), ),
} }
variant.mmds = list(variant.arch_mmds["x86_64"].values())
variant.module_uid_to_koji_tag = { variant.module_uid_to_koji_tag = {
"test:f28:2018:beef": "tag-1", "test:f28:2018:beef": "tag-1",
"test:f27:2018:cafe": "tag-2", "test:f27:2018:cafe": "tag-2",

View File

@ -315,14 +315,6 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
peek_context=mock.Mock(return_value="ctx"), peek_context=mock.Mock(return_value="ctx"),
) )
} }
self.compose.variants["Server"].mmds = [
mock.Mock(
peek_name=mock.Mock(return_value="mod"),
peek_stream=mock.Mock(return_value="master"),
peek_version=mock.Mock(return_value="ver"),
peek_context=mock.Mock(return_value="ctx"),
)
]
po.return_value = ([], ["m1"]) po.return_value = ([], ["m1"])
res = self.phase.run_solver( res = self.phase.run_solver(

View File

@ -706,12 +706,11 @@ class TestAddModuleToVariant(unittest.TestCase):
def test_adding_module(self): def test_adding_module(self):
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}} build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
variant = mock.Mock( variant = mock.Mock(
arches=["armhfp", "x86_64"], mmds=[], arch_mmds={}, modules=[] arches=["armhfp", "x86_64"], arch_mmds={}, modules=[]
) )
source_koji._add_module_to_variant(self.koji, variant, build) source_koji._add_module_to_variant(self.koji, variant, build)
self.assertEqual(variant.mmds, [MockModule("/koji/modulemd.txt")])
self.assertEqual( self.assertEqual(
variant.arch_mmds, variant.arch_mmds,
{ {
@ -729,7 +728,6 @@ class TestAddModuleToVariant(unittest.TestCase):
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}} build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
variant = mock.Mock( variant = mock.Mock(
arches=["armhfp", "x86_64"], arches=["armhfp", "x86_64"],
mmds=[MockModule("/koji/m1.txt")],
arch_mmds={ arch_mmds={
"x86_64": {"m1:latest:20190101.cafe": MockModule("/koji/m1.x86_64.txt")} "x86_64": {"m1:latest:20190101.cafe": MockModule("/koji/m1.x86_64.txt")}
}, },
@ -738,9 +736,6 @@ class TestAddModuleToVariant(unittest.TestCase):
source_koji._add_module_to_variant(self.koji, variant, build) source_koji._add_module_to_variant(self.koji, variant, build)
self.assertEqual(
variant.mmds, [MockModule("/koji/m1.txt"), MockModule("/koji/modulemd.txt")]
)
self.assertEqual( self.assertEqual(
variant.arch_mmds, variant.arch_mmds,
{ {
@ -758,14 +753,13 @@ class TestAddModuleToVariant(unittest.TestCase):
def test_adding_module_with_add_module(self): def test_adding_module_with_add_module(self):
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}} build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
variant = mock.Mock( variant = mock.Mock(
arches=["armhfp", "x86_64"], mmds=[], arch_mmds={}, modules=[] arches=["armhfp", "x86_64"], arch_mmds={}, modules=[]
) )
source_koji._add_module_to_variant( source_koji._add_module_to_variant(
self.koji, variant, build, add_to_variant_modules=True self.koji, variant, build, add_to_variant_modules=True
) )
self.assertEqual(variant.mmds, [MockModule("/koji/modulemd.txt")])
self.assertEqual( self.assertEqual(
variant.arch_mmds, variant.arch_mmds,
{ {
@ -783,7 +777,6 @@ class TestAddModuleToVariant(unittest.TestCase):
build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}} build = {"id": 1234, "extra": {"typeinfo": {"module": {"name": "module"}}}}
variant = mock.Mock( variant = mock.Mock(
arches=["armhfp", "x86_64"], arches=["armhfp", "x86_64"],
mmds=[MockModule("/koji/m1.txt")],
arch_mmds={ arch_mmds={
"x86_64": {"m1:latest:20190101.cafe": MockModule("/koji/m1.x86_64.txt")} "x86_64": {"m1:latest:20190101.cafe": MockModule("/koji/m1.x86_64.txt")}
}, },
@ -794,9 +787,6 @@ class TestAddModuleToVariant(unittest.TestCase):
self.koji, variant, build, add_to_variant_modules=True self.koji, variant, build, add_to_variant_modules=True
) )
self.assertEqual(
variant.mmds, [MockModule("/koji/m1.txt"), MockModule("/koji/modulemd.txt")]
)
self.assertEqual( self.assertEqual(
variant.arch_mmds, variant.arch_mmds,
{ {