#114 Add rpm2flatpak --kde flag
Closed 9 months ago by yselkowitz. Opened a year ago by yselkowitz.
modularity/ yselkowitz/fedmod kde5  into  master

file modified
+5 -3
@@ -127,7 +127,9 @@ 

  @click.option("--flathub", metavar="ID_OR_SEARCH_TERM",

                help="Initialize from a Flathub Flatpak.")

  @click.option("--flatpak-common", "-c", is_flag=True,

-               help="Use dependencies from the flatpak-common module")

+               help="Use dependencies from the common module")

+ @click.option("--kde", "-K", is_flag=True,

+               help="Use dependencies from the KDE runtime")

  @click.option("--output-modulemd", metavar="FILE",

                help="Write modulemd to FILE instead of <pkg>.yaml.")

  @click.option("--output-containerspec", metavar="FILE",
@@ -136,11 +138,11 @@ 

  @click.option("--force", "-f", is_flag=True,

                help="Overwriting existing output files")

  @click.argument("pkg", metavar='PKG', required=True)

- def rpm2flatpak(pkg, output_modulemd, output_containerspec, force, flathub, flatpak_common):

+ def rpm2flatpak(pkg, output_modulemd, output_containerspec, force, flathub, flatpak_common, kde):

      """Generate modulemd from an RPM"""

      fg = flatpak_generator.FlatpakGenerator(pkg)

      fg.run(output_modulemd, output_containerspec, force=force, flathub=flathub,

-            include_flatpak_common=flatpak_common)

+            include_flatpak_common=flatpak_common, kde=kde)

  

  

  @_cli_commands.command('flatpak-report')

file modified
+18 -10
@@ -55,8 +55,8 @@ 

      return release_name

  

  

- def _get_runtime_packages():

-     builds = get_module_builds('flatpak-runtime', dataset_release_branch())

+ def _get_runtime_packages(runtime_module):

+     builds = get_module_builds(runtime_module, dataset_release_branch())

      # Each flatpak-runtime stream should be built against a single context

      assert len(builds) == 1

      build = builds[0]
@@ -67,8 +67,8 @@ 

      return set(mmd.peek_profiles()['runtime'].peek_rpms().get())

  

  

- def _get_common_packages():

-     builds = get_module_builds('flatpak-common', dataset_release_branch(), include_rpms=True)

+ def _get_common_packages(common_module):

+     builds = get_module_builds(common_module, dataset_release_branch(), include_rpms=True)

      # Each flatpak-common stream should be built against a single context

      assert len(builds) == 1

      build = builds[0]
@@ -139,9 +139,16 @@ 

  

          self.api_srpms = {rpm_name_only(_depchase.get_srpm_for_rpm(pool, pkg))}

  

-         hint_packages = _get_runtime_packages()

+         if self.kde:

+             runtime_module = 'flatpak-kde5-runtime'

+             common_module = 'flatpak-kde5-common'

+         else:

+             runtime_module = 'flatpak-runtime'

+             common_module = 'flatpak-common'

+ 

+         hint_packages = _get_runtime_packages(runtime_module)

          if self.include_flatpak_common:

-             hint_packages.update(_get_common_packages())

+             hint_packages.update(_get_common_packages(common_module))

  

          all_needed_packages = _depchase.ensure_installable(

              pool, [pkg], hints=hint_packages)
@@ -152,9 +159,9 @@ 

                       for dep in pkgs}

          self.run_srpms = run_srpms - self.api_srpms

  

-         self.module_run_deps = {'flatpak-runtime': [dataset_release_branch()]}

+         self.module_run_deps = {runtime_module: [dataset_release_branch()]}

          if self.include_flatpak_common:

-             self.module_run_deps['flatpak-common'] = [dataset_release_branch()]

+             self.module_run_deps[common_module] = [dataset_release_branch()]

          self.module_run_deps['platform'] = [dataset_release_branch()]

  

      def _update_module_md(self):
@@ -236,10 +243,11 @@ 

                f" Please edit appropriately.")

  

      def run(self, output_modulemd, output_containerspec,

-             force=False, flathub=None, include_flatpak_common=False):

+             force=False, flathub=None, include_flatpak_common=False, kde=False):

          flathub_manifest = _load_flathub_manifest(flathub) if flathub else None

  

          self.include_flatpak_common = include_flatpak_common

+         self.kde = kde

  

          if output_modulemd is None:

              pkg = self.pkgs[0]
@@ -263,7 +271,7 @@ 

  def do_flatpak_report(pkgs, quiet=False):

      if not quiet:

          print("Initializing", file=sys.stderr)

-     runtime_packages = _get_runtime_packages()

+     runtime_packages = _get_runtime_packages('flatpak-runtime')

      pool = _depchase.make_pool()

  

      packages = {}

This helps simplify the creation of new apps using the KDE 5 runtime. I'm not sure how to make this also handle KDE 6 simultaneously (but I'm open to suggestions!), but that's more manageable because so few applications currently use Qt 6. (The idea being that if not otherwise changed by then, that this would be switched to use kde6 runtime/common when KDE itself switches to Qt 6.)

I haven't tested this broadly yet, but so far it seems to be doing what I want, and shouldn't break non-KDE usage.

rebased onto 1d023af

a year ago

rebased onto f8e82a9

a year ago

This would seem moot with the move away from modularity.

Pull-Request has been closed by yselkowitz

9 months ago