#112 Fix fedmod breakages when building Flatpaks and update it to Fedora 36
Merged 2 years ago by kalev. Opened 2 years ago by tpopela.
modularity/ tpopela/fedmod flatpak-fixes  into  master

file modified
+15 -5
@@ -6,6 +6,7 @@ 

  import functools

  import logging

  import os

+ import re

  

  import smartcols

  import solv
@@ -95,6 +96,12 @@ 

          yield dep

  

  

+ _BOOLEAN_KEYWORDS = re.compile(r" (?:and|or|if|with|without|unless) ")

+ 

+ def _dependency_is_conditional(dependency):

+     return _BOOLEAN_KEYWORDS.search(str(dependency)) is not None

+ 

+ 

  def _get_dependency_details(pool, transaction):

      cache = {}

  
@@ -122,7 +129,11 @@ 

                          if s in candq

                      }

                  # It was possible to resolve set, so something is wrong here

-                 assert matches

+                 if not matches:

+                     if _dependency_is_conditional(dep):

+                         log.debug("Conditional dependency {} doesn't need to be satisfied".format(dep))

+                     else:

+                         raise RuntimeError("Dependency {} isn't satisfied in resolved packages!".format(dep))

                  cache[dep] = matches

  

              # While multiple packages providing the same thing is rare, it's
@@ -183,11 +194,10 @@ 

      jobs = []

      # Initial jobs, no conflicting packages

      for n in pkgnames:

+         search_criteria = (solv.Selection.SELECTION_NAME

+                         | solv.Selection.SELECTION_DOTARCH)

          if "." in n:

-             search_criteria = solv.Selection.SELECTION_CANON

-         else:

-             search_criteria = (solv.Selection.SELECTION_NAME

-                                | solv.Selection.SELECTION_DOTARCH)

+             search_criteria |= solv.Selection.SELECTION_CANON

          sel = pool.select(n, search_criteria)

          if sel.isempty():

              log.warn("Could not find package for {}".format(n))

file modified
+8 -4
@@ -2,7 +2,7 @@ 

  version: 1

  data:

      options:

-         dataset: f34

+         dataset: f36

      datasets:

          templates:

              fedora-base:
@@ -35,7 +35,7 @@ 

                          arch:

                              baseurl: https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/$basearch/

                          source:

-                             baseurl: https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/SRPMS/

+                             baseurl: https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/source/

                      fedora-modular:

                          arch:

                              baseurl: https://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Modular/$basearch/os/
@@ -45,7 +45,7 @@ 

                          arch:

                              baseurl: https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Modular/$basearch/

                          source:

-                             baseurl: https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Modular/SRPMS/

+                             baseurl: https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Modular/source/

              fedora-branched:

                  extends: fedora-base

                  repositories:
@@ -70,11 +70,15 @@ 

                  template: fedora-stable

              f34:

                  template: fedora-stable

+             f35:

+                 template: fedora-stable

+             f36:

+                 template: fedora-stable

              rawhide:

                  dataset-regex: rawhide

                  platform-module:

                      # nothing to match -> hardcode

-                     stream-template: f35

+                     stream-template: f37

                  template: fedora-base

                  repositories:

                      fedora:

I'm putting here all the required changes that one needs to apply locally to have a working environment for building the Fedora Flatpaks. As I have doubts whether the changes will be merged and the fedmod in Fedora is orphaned anyway I suggest patching the sources locally for those who wants to work on Flatpaks.

I've made a scratch build with these changes and uploaded it to https://tpopela.fedorapeople.org/fedmod/ . I had to disable the build of shell completion because it's a cause of FTBFS (and hence the reason why it was removed from Fedora 36+). If anyone can fix that, it would be nice. Here is the diff of the SPEC file:

diff --git a/fedmod.spec b/fedmod.spec
index 68368aa..f8aa4e1 100644
--- a/fedmod.spec
+++ b/fedmod.spec
@@ -2,13 +2,19 @@

 Name:           fedmod
 Version:        0.6.4
-Release:        3%{?dist}
+Release:        3%{?dist}.1
 Summary:        Utilities for generating & maintaining modulemd files

 License:        GPLv2+ and GPLv3+ and MIT
 URL:            https://pagure.io/modularity/fedmod
 Source0:        %{name}-%{version}.tar.gz

+# https://pagure.io/modularity/fedmod/pull-request/112
+Patch0:         0001-Change-the-URL-for-source-packages-in-updates.patch
+Patch1:         0002-Update-to-F36.patch
+Patch2:         0003-Don-t-panic-on-rich-dependencies.patch
+Patch3:         0004-Dependency-resolution-fails-on-packages-with-dot-in-.patch
+
 BuildArch:      noarch

 BuildRequires:  python3-aiohttp
@@ -65,20 +71,20 @@ install -d -m 755 %{buildroot}%{_sysconfdir}/fedmod
 install -m 644 config/*.yaml %{buildroot}%{_sysconfdir}/fedmod/

 # shell completion
-for shell_path in \
-        bash:%{_datadir}/bash-completion/completions/fedmod \
-        zsh:%{_datadir}/zsh/vendor-completions/_fedmod \
-        fish:%{_datadir}/fish/vendor_completions.d/fedmod.fish; do
-    shell="${shell_path%%:*}"
-    path="${shell_path#*:}"
-    dir="${path%/*}"
-
-    install -d "%{buildroot}${dir}"
-
-    _FEDMOD_COMPLETE=source-"$shell" %{__python3} \
-        -c "import sys; sys.argv[0] = 'fedmod'; from _fedmod import cli; cli.run()" \
-        > "%{buildroot}${path}"
-done
+# for shell_path in \
+#        bash:%{_datadir}/bash-completion/completions/fedmod \
+#        zsh:%{_datadir}/zsh/vendor-completions/_fedmod \
+#        fish:%{_datadir}/fish/vendor_completions.d/fedmod.fish; do
+#    shell="${shell_path%%:*}"
+#    path="${shell_path#*:}"
+#    dir="${path%/*}"
+#
+#    install -d "%{buildroot}${dir}"
+#
+#    _FEDMOD_COMPLETE=source-"$shell" %{__python3} \
+#        -c "import sys; sys.argv[0] = 'fedmod'; from _fedmod import cli; cli.run()" \
+#        > "%{buildroot}${path}"
+#done

 %check
 if ! %{__python3} -m pytest -v -m "not needs_metadata"; then
@@ -99,17 +105,21 @@ fi
 %config(noreplace) %{_sysconfdir}/fedmod/*.yaml
 %{python3_sitelib}/_fedmod
 %{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info
-%dir %{_datadir}/bash-completion
-%dir %{_datadir}/bash-completion/completions
-%{_datadir}/bash-completion/completions/fedmod
-%dir %{_datadir}/zsh
-%dir %{_datadir}/zsh/vendor-completions
-%{_datadir}/zsh/vendor-completions/_fedmod
-%dir %{_datadir}/fish
-%dir %{_datadir}/fish/vendor_completions.d
-%{_datadir}/fish/vendor_completions.d/fedmod.fish
+#%dir %{_datadir}/bash-completion
+#%dir %{_datadir}/bash-completion/completions
+#%{_datadir}/bash-completion/completions/fedmod
+#%dir %{_datadir}/zsh
+#%dir %{_datadir}/zsh/vendor-completions
+#%{_datadir}/zsh/vendor-completions/_fedmod
+#%dir %{_datadir}/fish
+#%dir %{_datadir}/fish/vendor_completions.d
+#%{_datadir}/fish/vendor_completions.d/fedmod.fish

 %changelog
+* Mon Jun 13 2022 Tomas Popela <tpopela@redhat.com> - 0.6.4-3.1
+- Backport fixes from https://pagure.io/modularity/fedmod/pull-request/112
+  and disable the shell completion because it's the cause of FTBFS
+
 * Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.4-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

All of these changes look good to me. Thanks, Tomas!

Pull-Request has been merged by kalev

2 years ago