From 60a86df7efcc987fdca2860f3d908767a3dace2f Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: May 05 2020 12:42:11 +0000 Subject: FlatpakBuilder: Add end-of-life and end-of-life-rebase end-of-life allows marking apps and runtimes as EOL. This is mostly useful for runtimes where we can then mark older versions that are no longer supported as EOL, so that they can be removed by client software. end-of-life-rebase makes it possible to rename app IDs, so that users get automatically migrated to the new ID. This commit wires it up for runtimes as well, but I expect it won't get used there. --- diff --git a/flatpak_module_tools/flatpak_builder.py b/flatpak_module_tools/flatpak_builder.py index c7c889a..8132ff5 100644 --- a/flatpak_module_tools/flatpak_builder.py +++ b/flatpak_module_tools/flatpak_builder.py @@ -683,15 +683,21 @@ class FlatpakBuilder(object): runtime_ref = 'runtime/{id}/{arch}/{branch}'.format(**args) - subprocess.check_call(['ostree', 'commit', - '--repo', repo, '--owner-uid=0', - '--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]) + commit_args = ['--repo', repo, '--owner-uid=0', + '--owner-gid=0', '--no-xattrs', + '--canonical-permissions', + '--branch', runtime_ref, + '-s', 'build of ' + runtime_ref, + '--tree=tar=' + tarred_filesystem, + '--tree=dir=' + builddir, + '--add-metadata-string', 'xa.metadata=' + metadata] + + if 'end-of-life' in info: + commit_args += ['--add-metadata-string', 'ostree.endoflife=' + info['end-of-life']] + if 'end-of-life-rebase' in info: + commit_args += ['--add-metadata-string', 'ostree.endoflife-rebase=' + info['end-of-life-rebase']] + + subprocess.check_call(['ostree', 'commit'] + commit_args) subprocess.check_call(['ostree', 'summary', '-u', '--repo', repo]) subprocess.check_call(['flatpak', 'build-bundle', repo, @@ -753,6 +759,10 @@ class FlatpakBuilder(object): args = ['flatpak', 'build-export', repo, builddir, app_branch] if disable_sandbox: args += ['--disable-sandbox'] + if 'end-of-life' in info: + args += ['--end-of-life' + info['end-of-life']] + if 'end-of-life-rebase' in info: + args += ['--end-of-life-rebase' + info['end-of-life-rebase']] subprocess.check_call(args) with open(os.devnull) as devnull: