#1083 Require non-devel module in -devel module. Clear API list and profiles for -devel.
Merged 8 months ago by jkaluza. Opened 8 months ago by jkaluza.
jkaluza/fm-orchestrator cg-devel-req-non-devel  into  master

@@ -618,8 +618,17 @@ 

          """

          mmd = self._sanitize_mmd(self.module.mmd())

          if self.devel:

+             # Depend on the actual module

+             for dep in mmd.get_dependencies():

+                 dep.add_requires_single(mmd.get_name(), mmd.get_stream())

+ 

+             # Set the new name

              mmd.set_name(mmd.get_name() + "-devel")

  

+             # Delete API and profiles

+             mmd.set_rpm_api(Modulemd.SimpleSet())

+             mmd.clear_profiles()

+ 

          # Set the "Arch" field in mmd.

          mmd.set_arch(pungi.arch.tree_arch_to_yum_arch(arch))

          # Fill in the list of built RPMs.

@@ -644,3 +644,19 @@ 

          file_dir = self.cg._prepare_file_directory()

          with open(path.join(file_dir, "modulemd.src.txt")) as mmd:

              assert len(mmd.read()) == 1337

+ 

+     def test_finalize_mmd_devel(self):

+         self.cg.devel = True

+         mmd = self.cg.module.mmd()

+         new_mmd = Modulemd.Module.new_from_string(self.cg._finalize_mmd("x86_64"))

+ 

+         # Check that -devel suffix is set.

+         assert new_mmd.get_name().endswith("-devel")

+ 

+         # Check that -devel requires non-devel.

+         for dep in new_mmd.get_dependencies():

+             requires = []

+             for name, streams in dep.get_requires().items():

+                 for stream in streams.get():

+                     requires.append("%s:%s" % (name, stream))

+             assert "%s:%s" % (mmd.get_name(), mmd.get_stream()) in requires

This is more or less copy-paste of Pungi code: https://pagure.io/pungi/blob/master/f/pungi/phases/gather/sources/source_module.py#_89

We've been missing this piece in MBS and the -devel module build produced by MBS did not require non-devel module build, which is a bug.

rebased onto fe88cff

8 months ago

Rebased against latest master...

Pull-Request has been merged by jkaluza

8 months ago