Blob Blame History Raw
From 1197302847e2a97abc7914c37a067241e47bd240 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 21 Apr 2020 10:41:15 +0200
Subject: [PATCH 1/2] FlatpakBuilder: Add xa.metadata as ostree commit metadata
 for runtimes

Newer versions of flatpak (after https://github.com/flatpak/flatpak/commit/116a8b848788c582fb2c8577f1250438b100da25)
verify that the metadata matches ostree commit xa.metadata key. As we
use ostree directly for creating runtimes, we need to add the key
manually here.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1822753
---
 flatpak_module_tools/flatpak_builder.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/flatpak_module_tools/flatpak_builder.py b/flatpak_module_tools/flatpak_builder.py
index cca8ebc..c7c889a 100644
--- a/flatpak_module_tools/flatpak_builder.py
+++ b/flatpak_module_tools/flatpak_builder.py
@@ -678,6 +678,9 @@ class FlatpakBuilder(object):
         # Run flatpak-build-finish to add extra metadata, based on finish-args
         self._build_finish(builddir)
 
+        with open(os.path.join(builddir, 'metadata'), 'r') as f:
+            metadata = f.read()
+
         runtime_ref = 'runtime/{id}/{arch}/{branch}'.format(**args)
 
         subprocess.check_call(['ostree', 'commit',
@@ -685,6 +688,7 @@ class FlatpakBuilder(object):
                                '--owner-gid=0', '--no-xattrs',
                                '--canonical-permissions',
                                '--branch', runtime_ref,
+                               '--add-metadata-string', 'xa.metadata=' + metadata,
                                '-s', 'build of ' + runtime_ref,
                                '--tree=tar=' + tarred_filesystem,
                                '--tree=dir=' + builddir])
-- 
2.26.2