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 640a02315b)
This commit is contained in:
Alexander Larsson committed 2017-03-06 14:37:53 +01:00
1 parent c68d6a6428
commit 69d32a6331
1 file changed
+13 -6
+13 -6
View File
@@ -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);
}
}