From a3e53cc6e1ffd580ea65a2728743a855edbfc8b8 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Fri, 10 Nov 2023 14:55:26 +0000 Subject: [PATCH] Add human-readable name & summary to Flatpak manifest https://phabricator.endlessm.com/T35013 --- hooks/image/70-flatpak-manifest | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/hooks/image/70-flatpak-manifest b/hooks/image/70-flatpak-manifest index c8d68eee..0560a456 100755 --- a/hooks/image/70-flatpak-manifest +++ b/hooks/image/70-flatpak-manifest @@ -49,7 +49,7 @@ def get_data_for_ref( date = commit_date_string(repo, commit) version = installed_ref.get_appdata_version() - return key, { + data = { 'name': name, 'arch': arch, 'branch': branch, @@ -61,6 +61,23 @@ def get_data_for_ref( 'version': version, } + # TODO: It would be nice to consider EIB_FLATPAK_LOCALES and extract the + # name and summary in those locales too. Unfortunately while there is + # internal API to do this easily, it is not exposed by libflatpak. + # + # TODO: these function calls get the name in the current locale. We assume + # this is the C locale but it probably isn't. + appdata_name = installed_ref.get_appdata_name() + appdata_summary = installed_ref.get_appdata_summary() + if appdata_name or appdata_summary: + data['appdata'] = {'C': {}} + if appdata_name: + data['appdata']['C']['name'] = appdata_name + if appdata_summary: + data['appdata']['C']['summary'] = appdata_summary + + return key, data + def main(): # Build the json data structure