public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Owen W. Taylor <otaylor@fishsoup.net>
To: git-commits@fedoraproject.org
Subject: [flatpaks/flatpak-runtime] f45: Add code to generate flatpak-runtime.yaml
Date: Fri, 11 Sep 2026 14:40:12 GMT	[thread overview]
Message-ID: <178913761242.1.12098281108638943627.flatpaks-flatpak-runtime-e0d00860af9b@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : flatpaks/flatpak-runtime
            Branch : f45
            Commit : e0d00860af9b1ea8215d6f26c276c539f9091064
            Author : Owen W. Taylor <otaylor@fishsoup.net>
            Date   : 2018-01-31T11:21:01+01:00
            Stats  : +95/-10 in 5 file(s)
            URL    : https://src.fedoraproject.org/flatpaks/flatpak-runtime/c/e0d00860af9b1ea8215d6f26c276c539f9091064?branch=f45

            Log:
            Add code to generate flatpak-runtime.yaml

When generating the report, generate files for each profile, and then
add an extra step to insert the profiles into a modulemd template.

---
diff --git a/Makefile b/Makefile
index 98400b9..6f25ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -4,14 +4,23 @@ PACKAGE_LISTS =					\
 	out/gnome-Platform.packages		\
 	out/gnome-Sdk.packages
 
+PROFILE_FILES =					\
+	out/runtime.profile			\
+	out/runtime-base.profile		\
+	out/sdk.profile				\
+	out/sdk-base.profile
+
 FILE_LISTS = \
           $(patsubst %.packages,%.files,$(PACKAGE_LISTS))
 
-all: report.html
+all: report.html flatpak-runtime.yaml
 
-report.html: $(PACKAGE_LISTS) package-notes.txt generate-report.py report-template.html
+report.html $(PROFILE_FILES): $(PACKAGE_LISTS) package-notes.txt generate-report.py report-template.html
 	./generate-report.py
 
+flatpak-runtime.yaml: $(PROFILE_FILES) flatpak-runtime.in.yaml generate-modulemd.py
+	./generate-modulemd.py
+
 $(FILE_LISTS): %.files: generate-files.sh list-files.py
 	./generate-files.sh $@
 

diff --git a/flatpak-runtime.in.yaml b/flatpak-runtime.in.yaml
index 473d583..01316a1 100644
--- a/flatpak-runtime.in.yaml
+++ b/flatpak-runtime.in.yaml
@@ -2,23 +2,38 @@ document: modulemd
 version: 1
 data:
     summary: 'Flatpak Runtime'
-    description: 'Libraries and data files shared between applications'
+    description: >-
+        This module defines two runtimes for Flatpaks, the 'runtime' profile that
+        most Flatpaks in Fedora use, and a smaller 'runtime-base' profile that is
+        intended to be more minimal and (slightly) more API stable. There are also
+        corresponding sdk and sdk-base profiles that are used to build SDKs that
+        applications can be built against with flatpak-builder.
     license:
         module: [ MIT ]
     dependencies:
         buildrequires:
-            bootstrap: f26
-#            base-runtime: f26
-            shared-userspace: f26
+            platform: f28
         requires:
-            shared-userspace: f26
-            base-runtime: f26
+            platform: f28
     profiles:
         runtime:
             rpms: []
+        runtime-base:
+            rpms: []
+        sdk:
+            rpms: []
+        sdk-base:
+            rpms: []
         buildroot:
             rpms: [flatpak-rpm-macros, flatpak-runtime-config]
     api:
-        rpms: []
+        rpms:
+            - flatpak-rpm-macros
+            - flatpak-runtime-config
     components:
-        rpms: []
+        flatpak-rpm-macros:
+            rationale: Set up build root for flatpak RPMS
+            ref: master
+        flatpak-runtime-config:
+            rationale: Runtime configuration files
+            ref: master

diff --git a/generate-modulemd.py b/generate-modulemd.py
new file mode 100755
index 0000000..b3bb4ef
--- /dev/null
+++ b/generate-modulemd.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+import sys
+from yaml_utils import ordered_load, ordered_dump
+
+with open('flatpak-runtime.in.yaml') as f:
+    modulemd = ordered_load(f)
+
+def set_profile(profile_name, list_file):
+    with open(list_file) as f:
+        packages = [l.strip() for l in f]
+    print("{}: {} packages".format(profile_name, len(packages)), file=sys.stderr)
+    modulemd['data']['profiles'][profile_name] = packages
+
+set_profile('runtime', 'out/runtime.profile')
+set_profile('runtime-base', 'out/runtime-base.profile')
+set_profile('sdk', 'out/sdk.profile')
+set_profile('sdk-base', 'out/sdk-base.profile')
+
+with open('flatpak-runtime.yaml', 'w') as f:
+    ordered_dump(modulemd, stream=f, default_flow_style=False, encoding="utf-8")

diff --git a/generate-report.py b/generate-report.py
index 682087c..c405d30 100755
--- a/generate-report.py
+++ b/generate-report.py
@@ -369,6 +369,22 @@ unmatched_counts = {
 }
 
 #
+# Generate the profiles
+#
+def generate_profile(outfile, which):
+    with open(outfile, 'w') as f:
+        for letter in letters:
+            for src in letter.packages:
+                for pkg in src.packages:
+                    if getattr(pkg, which) != 0:
+                        print(pkg.name, file=f)
+
+generate_profile('out/runtime-base.profile', 'freedesktop_platform')
+generate_profile('out/sdk-base.profile', 'freedesktop_sdk')
+generate_profile('out/runtime.profile', 'gnome_platform')
+generate_profile('out/sdk.profile', 'gnome_sdk')
+
+#
 # Generate the report
 #
 

diff --git a/yaml_utils.py b/yaml_utils.py
new file mode 100644
index 0000000..1272836
--- /dev/null
+++ b/yaml_utils.py
@@ -0,0 +1,25 @@
+import yaml
+# https://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts
+
+from collections import OrderedDict
+
+def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict):
+    class OrderedLoader(Loader):
+        pass
+    def construct_mapping(loader, node):
+        loader.flatten_mapping(node)
+        return object_pairs_hook(loader.construct_pairs(node))
+    OrderedLoader.add_constructor(
+        yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
+        construct_mapping)
+    return yaml.load(stream, OrderedLoader)
+
+def ordered_dump(data, stream=None, Dumper=yaml.SafeDumper, **kwds):
+    class OrderedDumper(Dumper):
+        pass
+    def _dict_representer(dumper, data):
+        return dumper.represent_mapping(
+            yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
+            data.items())
+    OrderedDumper.add_representer(OrderedDict, _dict_representer)
+    return yaml.dump(data, stream, OrderedDumper, **kwds)

                 reply	other threads:[~2026-09-11 14:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178913761242.1.12098281108638943627.flatpaks-flatpak-runtime-e0d00860af9b@fedoraproject.org \
    --to=otaylor@fishsoup.net \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox