[gnome-builder] flatpak: resolve sdk extensions before displaying
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: resolve sdk extensions before displaying
- Date: Fri, 23 Apr 2021 22:17:24 +0000 (UTC)
commit fe12ce76d098c109b8fc52c5961e0dd85c30a055
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 23 15:17:13 2021 -0700
flatpak: resolve sdk extensions before displaying
This makes it easier to see what the version of SDK extension will be
before installing it. It also ensures that we check for the resolved
version so that an install etensions that doesn't match the desired
branch does not cause us to miss installing the extension.
Fixes #1437
src/plugins/flatpak/gbp-flatpak-runtime-provider.c | 55 +++++++++++++++-------
1 file changed, 38 insertions(+), 17 deletions(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index 5012f7962..845b0b9a6 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -816,38 +816,59 @@ gbp_flatpak_runtime_provider_bootstrap_async (IdeRuntimeProvider *provider,
{
g_auto(GStrv) all = NULL;
g_autofree gchar *sdk_full = NULL;
+ g_autofree gchar *platform_full = NULL;
+ const char * const *sdk_extensions;
const gchar *sdk;
+ const gchar *platform;
/* Tell the dialog about the SDK so it can resolve common ancestors for
* SDK extensions missing a branch name.
*/
+ platform = gbp_flatpak_manifest_get_platform (GBP_FLATPAK_MANIFEST (state->config));
+ platform_full = g_strdup_printf ("%s/%s/%s", platform, state->arch, state->branch);
sdk = gbp_flatpak_manifest_get_sdk (GBP_FLATPAK_MANIFEST (state->config));
sdk_full = g_strdup_printf ("%s/%s/%s", sdk, state->arch, state->branch);
+ sdk_extensions = gbp_flatpak_manifest_get_sdk_extensions (GBP_FLATPAK_MANIFEST (state->config));
+
gbp_flatpak_install_dialog_set_sdk (dialog, sdk_full);
- all = gbp_flatpak_manifest_get_runtimes (GBP_FLATPAK_MANIFEST (state->config),
- state->arch);
+ /* Make sure we have the SDK installed (org.gnome.Sdk) */
+ if (!gbp_flatpak_application_addin_has_runtime (addin, sdk, state->arch, state->branch))
+ gbp_flatpak_install_dialog_add_runtime (dialog, sdk_full);
+
+ /* Make sure we have the platform for running it too (org.gnome.Platform) */
+ if (!gbp_flatpak_application_addin_has_runtime (addin, platform, state->arch, state->branch))
+ gbp_flatpak_install_dialog_add_runtime (dialog, platform);
- if (all != NULL)
+ /* Resolve the extensions ASAP so we can show them in the dialog and also
+ * ensure that we have the right extension for the SDK.
+ */
+ for (guint i = 0; sdk_extensions[i]; i++)
{
- for (guint i = 0; all[i]; i++)
+ g_autofree char *resolved = gbp_flatpak_application_addin_resolve_extension (addin, sdk_full,
sdk_extensions[i]);
+
+ if (resolved == NULL)
{
- g_autofree gchar *item_name = NULL;
- g_autofree gchar *item_arch = NULL;
- g_autofree gchar *item_branch = NULL;
-
- if (gbp_flatpak_split_id (all[i], &item_name, &item_arch, &item_branch))
- {
- if (!gbp_flatpak_application_addin_has_runtime (addin, item_name, item_arch, item_branch))
- gbp_flatpak_install_dialog_add_runtime (dialog, all[i]);
- }
+ gbp_flatpak_install_dialog_add_runtime (dialog, sdk_extensions[i]);
+ }
+ else
+ {
+ g_autofree char *resolved_id = NULL;
+ g_autofree char *resolved_arch = NULL;
+ g_autofree char *resolved_branch = NULL;
+
+ if (gbp_flatpak_split_id (resolved, &resolved_id, &resolved_arch, &resolved_branch) &&
+ !gbp_flatpak_application_addin_has_runtime (addin, resolved_id, resolved_arch,
resolved_branch))
+ gbp_flatpak_install_dialog_add_runtime (dialog, resolved);
}
}
}
-
- /* Add runtime specifically (in case no manifest is set) */
- if (!gbp_flatpak_application_addin_has_runtime (addin, state->name, state->arch, state->branch))
- gbp_flatpak_install_dialog_add_runtime_full (dialog, state->name, state->arch, state->branch);
+ else
+ {
+ /* Add runtime specifically (in case no manifest is set) */
+ if (!gbp_flatpak_application_addin_has_runtime (addin, state->name, state->arch, state->branch))
+ gbp_flatpak_install_dialog_add_runtime_full (dialog, state->name, state->arch, state->branch);
+ }
runtimes = gbp_flatpak_install_dialog_get_runtimes (dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]