#97 Clean up generated modulemd files - rational and api
Merged 6 months ago by nphilipp. Opened 6 months ago by otaylor.
modularity/ otaylor/fedmod api-and-rationales  into  master

@@ -124,6 +124,11 @@ 

  

  

  class FlatpakGenerator(ModuleGenerator):

+     # The "api" for a Flatpak is that runs - other modules never depend on it

+     include_api_section = False

+     # Rationale for packages from the command line

+     api_component_rationale = "Application package"

+ 

      def __init__(self, pkg):

          super().__init__([pkg])

          self.rpm_branch = dataset_release_branch()

file modified
+10 -3

@@ -31,6 +31,12 @@ 

  

  

  class ModuleGenerator(object):

+     # If True, packages from the command line will be put into api: in the generated modulemd

+     include_api_section = True

+     # Rationale for packages from the command line

+     api_component_rationale = "Package in api"

+     # Rationale for other packages

+     other_component_rationale = "Runtime dependency"

  

      def __init__(self, pkgs):

          self.pkgs = pkgs

@@ -87,10 +93,11 @@ 

  

          # Declare the public API

          for pkg in self.api_srpms:

-             self.mmd.peek_rpm_api().add(pkg)

+             if self.include_api_section:

+                 self.mmd.peek_rpm_api().add(pkg)

  

              component = Modulemd.ComponentRpm(

-                 name=pkg, rationale="Package in api",

+                 name=pkg, rationale=self.api_component_rationale,

                  buildorder=self._get_build_order(pkg))

              if self.rpm_branch is not None:

                  component.props.ref = self.rpm_branch

@@ -105,7 +112,7 @@ 

  

          for pkg in self.run_srpms:

              component = Modulemd.ComponentRpm(

-                 name=pkg, rationale="Runtime dependencies",

+                 name=pkg, rationale=self.other_component_rationale,

                  buildorder=self._get_build_order(pkg))

              if self.rpm_branch is not None:

                  component.props.ref = self.rpm_branch

@@ -141,24 +141,27 @@ 

          with mock_koji():

              modmd, container_yaml = _generate_flatpak('eog')

  

-         # Expected description for 'grep'

+         # Expected description for 'eog'

          assert modmd.props.summary == "Eye of GNOME image viewer"

          assert modmd.props.description.startswith(

              "The Eye of GNOME image viewer (eog) is")

  

-         # Expected licenses for 'grep'

+         # Expected licenses for 'eog'

          assert modmd.props.module_licenses.get() == ['MIT']

          assert modmd.props.content_licenses.get() == []

  

-         # Only given modules are listed in the public API

-         assert sorted(modmd.props.rpm_api.get()) == ['eog']

+         # No API section for Flatpaks

+         assert sorted(modmd.props.rpm_api.get()) == []

  

          # Expected components

          assert set(modmd.props.components_rpm) == set([

              'bubblewrap', 'eog', 'exempi', 'gnome-desktop3', 'libpeas'

          ])

  

-         # Expected module dependencies for grep

+         assert modmd.props.components_rpm['eog'].props.rationale == "Application package"

+         assert modmd.props.components_rpm['exempi'].props.rationale == "Runtime dependency"

+ 

+         # Expected module dependencies for eog

          dependencies = modmd.props.dependencies

          assert len(dependencies) == 1

  

@@ -78,6 +78,8 @@ 

          expected_components = set(input_rpms)

          assert set(modmd.props.components_rpm) == expected_components

  

+         assert modmd.props.components_rpm['grep'].props.rationale == "Package in api"

+ 

          # Expected module dependencies for grep

          dependencies = modmd.props.dependencies

          assert len(dependencies) == 1

This PR cleans up the generated modulemd files a bit:

  • No api: section in the flatpak modulemd
  • Say "Application package" rather than "Package in api" for the rationale for the application package
  • Say "Runtime dependency" rather than "Runtime dependencies"

Metadata Update from @nphilipp:
- Request assigned

6 months ago

rebased onto 5c46dd9

6 months ago

Pull-Request has been merged by nphilipp

6 months ago