public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [flatpaks/flatpak-runtime] f45: Port to flatpak-module-depchase
@ 2026-09-11 14:42 Owen W. Taylor
  0 siblings, 0 replies; only message in thread
From: Owen W. Taylor @ 2026-09-11 14:42 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : flatpaks/flatpak-runtime
            Branch : f45
            Commit : df1629e0a8d4775d56d140d1ea3c7d44ba1182a8
            Author : Owen W. Taylor <otaylor@fishsoup.net>
            Date   : 2026-03-02T20:29:45-05:00
            Stats  : +66/-47 in 5 file(s)
            URL    : https://src.fedoraproject.org/flatpaks/flatpak-runtime/c/df1629e0a8d4775d56d140d1ea3c7d44ba1182a8?branch=f45

            Log:
            Port to flatpak-module-depchase

The relevant code for chasing dependencies has been moved from fedmod
to flatpak-module-tools.

---
diff --git a/Makefile b/Makefile
index 894d638..5ed5149 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ out/flathub-appstream.xml.gz: tools/download-flathub-appstream.sh
 out/ratings.json: tools/download-reviews.sh
 	./tools/download-reviews.sh
 
-reports/applications.json reports/application-packages.json: tools/generate-app-reports.py out/fedora-appstream.xml.gz out/flathub-appstream.xml.gz out/ratings.json
+reports/applications.json reports/application-packages.json: out/runtime.profile tools/generate-app-reports.py out/fedora-appstream.xml.gz out/flathub-appstream.xml.gz out/ratings.json
 	./tools/generate-app-reports.py
 
 flatpak-runtime.new.yaml: $(PROFILE_FILES) flatpak-runtime.in.yaml flatpak-runtime-baseonly.in.yaml tools/generate-modulemd.py tools/util.py

diff --git a/README.md b/README.md
index 379a86a..670e15a 100644
--- a/README.md
+++ b/README.md
@@ -27,23 +27,35 @@ steps are as follows:
  * Exclude and rename files, and otherwise tweak the contents of the
    resulting lists, and find the Fedora packages that contain the
    corresponding packages. (`tools/resolve-files.py`)
- * Find all dependencies of the resolved packages using `fedmod resolve-deps`,
+ * Find all dependencies of the resolved packages using `flatpak-module-depchase resolve-deps`,
    correlate it all together, figure out the install profiles for each runtime,
    and create `report/runtime.html`. (`tools/generate-runtime-report.py`)
  * Create a `flatpak-runtime.new.yaml` using the profiles. (`tools/generate-modulemd.py`)
  * Finds data about applications packaged in Fedora and Flathub
    (`tools/download-fedora-appstream.sh`, `tools/download-flathub-appstream.sh`,
    `tools/download-reviews.py`)
- * Finds out how those applications would build using the *current* build of the
-   runtime (not the one that we're creating here) , and generates more reports
-   in `reports/`. (`tools/generate-app-reports.py`). (Improvement would be to use
-   the candidate next build - requires us to pass the runtime data to fedmod rather
-   than have fedmod download it from Koji.)
+ * Finds out how those applications would build using this runtime, and generates more reports
+   in `reports/`. (`tools/generate-app-reports.py`).
  * Copy `flatpak-runtime.new.yaml` to `flatpak-runtime.yaml`
 
 *Report generation*: if you type `make report` instead then all the above happens
 except the last step.
 
+Viewing the HTML reports
+========================
+
+Because the application reports dynamically load generated JSON files, they can't
+be viewed as local files. You can run a web server to view them like:
+
+``` sh
+podman run it --rm -p 8081:8080 \
+   -v $(pwd)/reports:/usr/share/nginx/html:ro,z \
+   nginxinc/nginx-unprivileged \
+   nginx -g 'daemon off;'
+```
+
+And then go to [https://localhost:8081/applications.html].
+
 Tweaking the result
 ===================
 The main way to tweak the result is to edit and extend the data embedded in
@@ -77,12 +89,6 @@ Once done, please do the following steps in this exact order:
  3. Replace all occurrences of an old Fedora release with the new one in `modules/flatpak-runtime` - i.e. [f34 -> f35](https://src.fedoraproject.org/modules/flatpak-runtime/c/76972d6a76390f21e4e70fd960773e597d810de3) and [f35 -> f36](https://src.fedoraproject.org/modules/flatpak-runtime/c/ff05f48642694c1aaf70df1fdc0a5a6d8fb30939)
  4. Bump the required freedesktop and GNOME Flatpak SDKs versions if required in
     `tools/generate-files.sh`
- 5. Download the metadata for a new Fedora release with `fedmod  --dataset=f36
-    fetch-metadata` (replace f36 with the new release). You might need to update
-    the `/etc/fedmod/fedora.yaml` file and add a new release there. If the new
-    Fedora is already released, then duplicate the f36 part under the `releases:`
-    section [example](https://pagure.io/fork/tpopela/modularity/fedmod/c/0df9ced507b8e9ce76a62cc35015c403073873ca). If the new version isn't released yet, do the same, but replace
-    `fedora-stable` with `fedora-branched`.
  6. Run `make new-runtime`. In case of any problems you will need to update the
     `tools/resolve-files.py` to adapt it for new library versions and so on.
     Once the new runtime files are generated, consult the content of it and again

diff --git a/tools/generate-app-reports.py b/tools/generate-app-reports.py
index 5d682c7..d69de96 100755
--- a/tools/generate-app-reports.py
+++ b/tools/generate-app-reports.py
@@ -13,7 +13,7 @@ import subprocess
 import sys
 
 import util
-from util import DATASET_ARG
+from util import TAG_ARG
 
 id_mappings = {
     '0ad': 'com.play0ad.zeroad',
@@ -299,12 +299,23 @@ top_packaged_apps = sorted(packaged_apps, key=lambda a: a.package)
 top_packaged_apps.sort(key=lambda a: -(a.star_total or 0))
 top_packaged_apps = top_packaged_apps[0:100]
 
-info_json = subprocess.check_output(
-    ['fedmod', DATASET_ARG, 'flatpak-report'] + [a.package for a in packaged_apps]
-)
-info = json.loads(info_json)
+
+def get_flatpak_report(apps):
+    info_json = subprocess.check_output([
+        'flatpak-module-depchase',
+        TAG_ARG,
+        'flatpak-report',
+        '--runtime-profile=out/runtime.profile'
+    ] + [a.package for a in apps])
+
+    return json.loads(info_json)
+
+
+info = get_flatpak_report(packaged_apps)
 for a in packaged_apps:
-    a.extra_packages = info['flatpaks'][a.package]['extra']
+    app_info = info['flatpaks'].get(a.package)
+    if app_info:  # package info from appstream might be stale
+        a.extra_packages = info['flatpaks'][a.package]['extra']
 
 runtime_packages = {}
 extra_packages = {}
@@ -314,10 +325,7 @@ for p, i in info['packages'].items():
     else:
         extra_packages[p] = {'all': i['used_by']}
 
-top_info_json = subprocess.check_output(
-    ['fedmod', DATASET_ARG, 'flatpak-report'] + [a.package for a in top_packaged_apps]
-)
-top_info = json.loads(top_info_json)
+top_info = get_flatpak_report(top_packaged_apps)
 
 for p, i in top_info['packages'].items():
     if i['runtime']:

diff --git a/tools/generate-runtime-report.py b/tools/generate-runtime-report.py
index 7535298..ac8b974 100755
--- a/tools/generate-runtime-report.py
+++ b/tools/generate-runtime-report.py
@@ -8,7 +8,7 @@ import re
 import subprocess
 import sys
 import util
-from util import BASEONLY, DATASET_ARG
+from util import BASEONLY, TAG_ARG
 
 def start(msg):
     print("{}: \033[90m{} ... \033[39m".format(
@@ -22,8 +22,8 @@ def done():
 def warn(msg):
     print("{}: \033[31m{}\033[39m".format(os.path.basename(sys.argv[0]), msg), file=sys.stderr)
 
-def fedmod_output(args):
-    return subprocess.check_output(['fedmod', DATASET_ARG] + args, encoding='utf-8')
+def depchase_output(args):
+    return subprocess.check_output(['flatpak-module-depchase', TAG_ARG] + args, encoding='utf-8')
 
 def nvr_to_name(nvr):
     return nvr.rsplit("-", 2)[0]
@@ -240,28 +240,31 @@ def add_packages(source, which, resolve_deps=False, only_if_exists=False):
             pkgs += ["systemd-standalone-tmpfiles"]
         elif isinstance(pkgs, set):
             pkgs.add("systemd-standalone-tmpfiles")
-        resolved_packages = json.loads(fedmod_output(['resolve-deps', '--json'] + list(pkgs)))
+        resolved_packages = json.loads(depchase_output(['resolve-packages', '--json'] + list(pkgs)))
         for package in resolved_packages:
-            name = nvr_to_name(package['rpm'])
-            srpm_name = nvr_to_name(package['srpm'])
+            name = nvr_to_name(package['nvra'])
+            srpm_name = package['source']
             add_package(name, which, level=(2 if name in pkgs else 1),
                         source_package=srpm_name, only_if_exists=only_if_exists)
 
         for package in resolved_packages:
-            for req, providers in package['requires'].items():
-                # boolean dependency that didn't need to be satisfied
-                if len(providers) == 0:
-                    continue
-                provider = nvr_to_name(providers[0])
-                provider_package = packages.get(provider, None)
-                if provider_package is None:
-                    # filtered out of the resolve-deps output - e.g., fedora-release
-                    continue
-                required_by = getattr(provider_package, which + '_required_by')
+            # Find out what package required it
+            explanation = package.get('explanation')
+            if explanation is None:  # Package was in input
+                continue
+
+            pos = len(explanation) - 3
+            if pos >= 0:  # should always be true
+                name = nvr_to_name(package['nvra'])
+                pkg = packages.get(name, None)
+
+                required_by_package = explanation[pos]
+                req = explanation[pos + 1]
+                required_by = getattr(pkg, which + '_required_by')
                 if required_by is None:
                     required_by = []
-                    setattr(provider_package, which + '_required_by', required_by)
-                required_by.append((nvr_to_name(package['rpm']), req))
+                    setattr(pkg, which + '_required_by', required_by)
+                required_by.append((required_by_package, req))
     else:
         for package in pkgs:
             add_package(package, which, level=2, only_if_exists=only_if_exists)

diff --git a/tools/util.py b/tools/util.py
index 08217c3..c3d0113 100644
--- a/tools/util.py
+++ b/tools/util.py
@@ -3,6 +3,7 @@ import hashlib
 import pickle
 import rpm
 import os
+import subprocess
 import sys
 import xml.etree.ElementTree as ET
 import xml.sax
@@ -11,15 +12,15 @@ STREAM = 'f38'
 ID_PREFIX = 'org.fedoraproject'
 # branch of flatpak-rpm-macros and flatpak-runtime-config
 RPM_BRANCH = 'f38'
-DATASET_ARG = '--dataset=f38'
+TAG = 'f39-flatpak-runtime-packages'
+TAG_ARG = f'--tag={TAG}'
 # If this is True, then we'll use the "base" profiles (freedesktop-based) as the main profiles
 BASEONLY = False
 
 XDG_CACHE_HOME = os.environ.get("XDG_CACHE_HOME") or os.path.expanduser("~/.cache")
 
-# This needs to be in sync with fedmod
 REPOS = [
-    "f38--fedora",
+    TAG,
 ]
 
 # packages that are only available or required on specific architectures
@@ -212,8 +213,10 @@ def foreach_package(repo_info, cb):
         done()
 
 def get_repo_cacheable(name, generate):
+    subprocess.check_call(['flatpak-module-depchase', TAG_ARG, 'fetch-metadata'])
+
     hash_text = ''
-    repos_dir = os.path.join(XDG_CACHE_HOME, "fedmod/repos")
+    repos_dir = os.path.join(XDG_CACHE_HOME, "flatpak-module-tools/repos")
     repo_info = {}
     for repo in REPOS:
         repo_dir = os.path.join(repos_dir, repo, 'x86_64')
@@ -222,8 +225,7 @@ def get_repo_cacheable(name, generate):
             with open(repomd_path, 'rb') as f:
                 repomd_contents = f.read()
         except (OSError, IOError):
-            print(f"Cannot read {repomd_path}, try 'fedmod {DATASET_ARG} fetch-metadata'",
-                  file=sys.stderr)
+            print(f"Cannot read {repomd_path}", file=sys.stderr)
             sys.exit(1)
 
         repo_info[repo] = (repo_dir, repomd_contents)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 14:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 14:42 [flatpaks/flatpak-runtime] f45: Port to flatpak-module-depchase Owen W. Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox