From 69d32a6331a79706973478aef478b45e68556e6b Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 6 Mar 2017 12:10:39 +0100 Subject: [PATCH] extensions: Support multiple versions This means an extension point can include extensions of multiple (specified) versions. This is useful for e.g. the GL extensions, where we want a single extension for all the essentially unversioned GL extensions (like the nvidia one) that is used by all the runtimes. (cherry picked from commit 640a02315b2dfa3020e3ece49e4d6a66a5ad12b8) --- common/flatpak-utils.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 71f3ceec8..96865f90d 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -3666,7 +3666,7 @@ flatpak_list_extensions (GKeyFile *metakey, const char *default_branch) { g_auto(GStrv) groups = NULL; - int i; + int i, j; GList *res; res = NULL; @@ -3683,14 +3683,21 @@ flatpak_list_extensions (GKeyFile *metakey, *(extension = (groups[i] + strlen ("Extension "))) != 0) { g_autofree char *version = g_key_file_get_string (metakey, groups[i], "version", NULL); - const char *branch; + g_auto(GStrv) versions = g_key_file_get_string_list (metakey, groups[i], "versions", NULL, NULL); + const char *default_branches[] = { default_branch, NULL}; + const char **branches; - if (version) - branch = version; + if (versions) + branches = (const char **)versions; else - branch = default_branch; + { + if (version) + default_branches[0] = version; + branches = default_branches; + } - res = add_extension (metakey, groups[i], extension, arch, branch, res); + for (j = 0; branches[j] != NULL; j++) + res = add_extension (metakey, groups[i], extension, arch, branches[j], res); } }