[gnome-builder] flatpak: fix sdk resolution and test for it
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: fix sdk resolution and test for it
- Date: Sat, 1 May 2021 03:41:21 +0000 (UTC)
commit 850576cf296701f3597de353dd526a7ffc43de31
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 30 20:41:03 2021 -0700
flatpak: fix sdk resolution and test for it
Currently, this only checks for the SDK extension for the given
architecture. We'll have to change that to match the target SDK arch
so that we can get it for cross-builds still.
src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c | 2 +-
src/plugins/flatpak/daemon/test-flatpak.c | 16 ++++++++++++----
src/plugins/flatpak/gbp-flatpak-manifest.c | 15 ++++++++++++++-
3 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
index 61df9d61b..82051b878 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
@@ -400,7 +400,7 @@ ipc_flatpak_service_impl_list_runtimes (IpcFlatpakService *service,
g_assert (IPC_IS_FLATPAK_SERVICE_IMPL (self));
g_assert (G_IS_DBUS_METHOD_INVOCATION (invocation));
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssssb)"));
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ssssssb)"));
for (guint i = 0; i < self->runtimes->len; i++)
{
diff --git a/src/plugins/flatpak/daemon/test-flatpak.c b/src/plugins/flatpak/daemon/test-flatpak.c
index 47dea9123..0f7994275 100644
--- a/src/plugins/flatpak/daemon/test-flatpak.c
+++ b/src/plugins/flatpak/daemon/test-flatpak.c
@@ -36,14 +36,15 @@ on_runtime_added_cb (IpcFlatpakService *service,
const gchar *branch;
const gchar *sdk_name;
const gchar *sdk_branch;
+ const gchar *metadata;
gboolean sdk_extension;
g_assert (IPC_IS_FLATPAK_SERVICE (service));
g_assert (info != NULL);
- g_assert (g_variant_is_of_type (info, G_VARIANT_TYPE ("(sssssb)")));
+ g_assert (g_variant_is_of_type (info, G_VARIANT_TYPE ("(ssssssb)")));
- g_variant_get (info, "(&s&s&s&s&sb)",
- &name, &arch, &branch, &sdk_name, &sdk_branch, &sdk_extension);
+ g_variant_get (info, "(&s&s&s&s&s&sb)",
+ &name, &arch, &branch, &sdk_name, &sdk_branch, &metadata, &sdk_extension);
if (!sdk_extension)
g_message ("Runtime Added: %s/%s/%s with SDK %s//%s",
@@ -60,6 +61,7 @@ add_install_cb (GObject *object,
{
IpcFlatpakService *service = (IpcFlatpakService *)object;
g_autofree gchar *sizestr = NULL;
+ g_autofree gchar *resolved = NULL;
g_autoptr(GMainLoop) main_loop = user_data;
g_autoptr(GVariant) runtimes = NULL;
g_autoptr(GError) error = NULL;
@@ -85,9 +87,10 @@ add_install_cb (GObject *object,
const gchar *branch;
const gchar *sdk_name;
const gchar *sdk_branch;
+ const gchar *metadata;
gboolean sdk_extension;
- while (g_variant_iter_next (&iter, "(&s&s&s&s&sb)", &name, &arch, &branch, &sdk_name, &sdk_branch,
&sdk_extension))
+ while (g_variant_iter_next (&iter, "(&s&s&s&s&s&sb)", &name, &arch, &branch, &sdk_name, &sdk_branch,
&metadata, &sdk_extension))
g_message (" %s/%s/%s with SDK %s//%s (Extension: %d)",
name, arch, branch, sdk_name, sdk_branch, sdk_extension);
}
@@ -107,6 +110,11 @@ add_install_cb (GObject *object,
sizestr = g_format_size (download_size);
g_message (" Found, Download Size: <=%s", sizestr);
+ ret = ipc_flatpak_service_call_resolve_extension_sync (service, "org.gnome.Sdk/x86_64/40",
"org.freedesktop.Sdk.Extension.rust-stable", &resolved, NULL, &error);
+ g_assert_no_error (error);
+ g_assert_true (ret);
+ g_assert_cmpstr (resolved, ==, "org.freedesktop.Sdk.Extension.rust-stable/x86_64/20.08");
+
g_main_loop_quit (main_loop);
}
diff --git a/src/plugins/flatpak/gbp-flatpak-manifest.c b/src/plugins/flatpak/gbp-flatpak-manifest.c
index e3359883e..2da65b5d4 100644
--- a/src/plugins/flatpak/gbp-flatpak-manifest.c
+++ b/src/plugins/flatpak/gbp-flatpak-manifest.c
@@ -1113,18 +1113,31 @@ void
gbp_flatpak_manifest_resolve_extensions (GbpFlatpakManifest *self,
IpcFlatpakService *service)
{
+ g_autofree char *sdk = NULL;
+
g_return_if_fail (GBP_IS_FLATPAK_MANIFEST (self));
g_return_if_fail (!service || IPC_IS_FLATPAK_SERVICE (service));
if (self->sdk_extensions == NULL || service == NULL)
return;
+ /* Technically we could have a situation where the host system
+ * does not have the SDK extension but the development platform
+ * does. We do not currently support that though. Embedded systems
+ * may very well mean we need to do that someday.
+ */
+
+ sdk = g_strdup_printf ("%s/%s/%s",
+ self->sdk,
+ flatpak_get_default_arch (),
+ self->runtime_version);
+
for (guint i = 0; self->sdk_extensions[i]; i++)
{
g_autofree char *resolved = NULL;
ipc_flatpak_service_call_resolve_extension_sync (service,
- self->sdk,
+ sdk,
self->sdk_extensions[i],
&resolved,
NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]