[gnome-builder] flatpak: include deploy-dir in runtime information
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: include deploy-dir in runtime information
- Date: Mon, 3 May 2021 22:51:38 +0000 (UTC)
commit 337a773e87e4eaa7848395476ca1e0880c5f0090
Author: Christian Hergert <chergert redhat com>
Date: Mon May 3 15:51:10 2021 -0700
flatpak: include deploy-dir in runtime information
src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c | 4 ++++
src/plugins/flatpak/daemon/ipc-flatpak-util.h | 9 ++++++---
.../daemon/org.gnome.Builder.Flatpak.Service.xml | 4 ++--
src/plugins/flatpak/daemon/test-flatpak.c | 18 ++++++++++--------
4 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
index a647cfdc9..46f776ebd 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
@@ -37,6 +37,7 @@ typedef struct
char *branch;
char *sdk_name;
char *sdk_branch;
+ char *deploy_dir;
GBytes *metadata;
gboolean sdk_extension : 1;
} Runtime;
@@ -182,6 +183,7 @@ runtime_to_variant (const Runtime *runtime)
runtime->branch,
runtime->sdk_name,
runtime->sdk_branch,
+ runtime->deploy_dir,
(const char *)g_bytes_get_data (runtime->metadata, NULL),
runtime->sdk_extension);
}
@@ -225,6 +227,7 @@ runtime_free (Runtime *runtime)
g_clear_pointer (&runtime->branch, g_free);
g_clear_pointer (&runtime->sdk_name, g_free);
g_clear_pointer (&runtime->sdk_branch, g_free);
+ g_clear_pointer (&runtime->deploy_dir, g_free);
g_clear_pointer (&runtime->metadata, g_bytes_unref);
g_slice_free (Runtime, runtime);
}
@@ -336,6 +339,7 @@ install_reload (IpcFlatpakServiceImpl *self,
state->branch = g_strdup (flatpak_ref_get_branch (FLATPAK_REF (ref)));
state->sdk_name = g_strdup (flatpak_ref_get_name (sdk_ref));
state->sdk_branch = g_strdup (flatpak_ref_get_branch (sdk_ref));
+ state->deploy_dir = g_strdup (flatpak_installed_ref_get_deploy_dir (ref));
state->sdk_extension = exten_of != NULL;
state->metadata = g_bytes_ref (bytes);
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-util.h b/src/plugins/flatpak/daemon/ipc-flatpak-util.h
index 91a00447a..18c7c3b14 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-util.h
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-util.h
@@ -24,7 +24,7 @@
G_BEGIN_DECLS
-#define RUNTIME_VARIANT_STRING "(ssssssb)"
+#define RUNTIME_VARIANT_STRING "(sssssssb)"
#define RUNTIME_VARIANT_TYPE G_VARIANT_TYPE(RUNTIME_VARIANT_STRING)
#define RUNTIME_ARRAY_VARIANT_TYPE G_VARIANT_TYPE("a" RUNTIME_VARIANT_STRING)
@@ -49,6 +49,7 @@ runtime_variant_new (const char *name,
const char *branch,
const char *sdk_name,
const char *sdk_branch,
+ const char *deploy_dir,
const char *metadata,
gboolean is_extension)
{
@@ -58,6 +59,7 @@ runtime_variant_new (const char *name,
branch,
sdk_name,
sdk_branch,
+ deploy_dir,
metadata,
is_extension));
}
@@ -69,6 +71,7 @@ runtime_variant_parse (GVariant *variant,
const char **branch,
const char **sdk_name,
const char **sdk_branch,
+ const char **deploy_dir,
const char **metadata,
gboolean *is_extension)
{
@@ -78,8 +81,8 @@ runtime_variant_parse (GVariant *variant,
if (!g_variant_is_of_type (variant, RUNTIME_VARIANT_TYPE))
return FALSE;
- g_variant_get (variant, "(&s&s&s&s&s&sb)",
- name, arch, branch, sdk_name, sdk_branch, metadata, is_extension);
+ g_variant_get (variant, "(&s&s&s&s&s&s&sb)",
+ name, arch, branch, sdk_name, sdk_branch, deploy_dir, metadata, is_extension);
return TRUE;
}
diff --git a/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
b/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
index 829852f42..49d3ff505 100644
--- a/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
+++ b/src/plugins/flatpak/daemon/org.gnome.Builder.Flatpak.Service.xml
@@ -29,7 +29,7 @@
<!--
Param is (name, arch, branch, sdk_name, sdk_branch, metadata, is_sdk_extension)
-->
- <arg name="runtime" direction="in" type="(ssssssb)"/>
+ <arg name="runtime" direction="in" type="(sssssssb)"/>
</signal>
<!--
AddInstallation:
@@ -48,7 +48,7 @@
Lists the available runtimes for use as development.
-->
<method name="ListRuntimes">
- <arg name="runtimes" direction="out" type="a(ssssssb)"/>
+ <arg name="runtimes" direction="out" type="a(sssssssb)"/>
</method>
<!--
RuntimeIsKnown:
diff --git a/src/plugins/flatpak/daemon/test-flatpak.c b/src/plugins/flatpak/daemon/test-flatpak.c
index e0cb18081..af3552947 100644
--- a/src/plugins/flatpak/daemon/test-flatpak.c
+++ b/src/plugins/flatpak/daemon/test-flatpak.c
@@ -37,6 +37,7 @@ on_runtime_added_cb (IpcFlatpakService *service,
const gchar *branch;
const gchar *sdk_name;
const gchar *sdk_branch;
+ const gchar *deploy_dir;
const gchar *metadata;
gboolean sdk_extension;
gboolean ret;
@@ -44,7 +45,7 @@ on_runtime_added_cb (IpcFlatpakService *service,
g_assert (IPC_IS_FLATPAK_SERVICE (service));
g_assert (info != NULL);
- ret = runtime_variant_parse (info, &name, &arch, &branch, &sdk_name, &sdk_branch, &metadata,
&sdk_extension);
+ ret = runtime_variant_parse (info, &name, &arch, &branch, &sdk_name, &sdk_branch, &deploy_dir, &metadata,
&sdk_extension);
g_assert_true (ret);
if (!sdk_extension)
@@ -89,15 +90,16 @@ add_install_cb (GObject *object,
const gchar *branch;
const gchar *sdk_name;
const gchar *sdk_branch;
+ const gchar *deploy_dir;
const gchar *metadata;
gboolean sdk_extension;
while ((value = g_variant_iter_next_value (&iter)))
{
- ret = runtime_variant_parse (value, &name, &arch, &branch, &sdk_name, &sdk_branch, &metadata,
&sdk_extension);
+ ret = runtime_variant_parse (value, &name, &arch, &branch, &sdk_name, &sdk_branch, &deploy_dir,
&metadata, &sdk_extension);
g_assert_true (ret);
- g_message (" %s/%s/%s with SDK %s//%s (Extension: %d)",
- name, arch, branch, sdk_name, sdk_branch, sdk_extension);
+ g_message (" %s/%s/%s with SDK %s//%s (Extension: %d) in directory %s",
+ name, arch, branch, sdk_name, sdk_branch, sdk_extension, deploy_dir);
}
}
@@ -108,16 +110,16 @@ add_install_cb (GObject *object,
g_assert_false (is_known);
g_message (" Not found");
- g_message ("Checking if org.gnome.Sdk/x86_64/40 is known");
- ret = ipc_flatpak_service_call_runtime_is_known_sync (service, "org.gnome.Sdk/x86_64/40", &is_known,
&download_size, NULL, &error);
+ g_message ("Checking if org.gnome.Sdk/x86_64/master is known");
+ ret = ipc_flatpak_service_call_runtime_is_known_sync (service, "org.gnome.Sdk/x86_64/master", &is_known,
&download_size, NULL, &error);
g_assert_no_error (error);
g_assert_true (ret);
g_assert_true (is_known);
sizestr = g_format_size (download_size);
g_message (" Found, Download Size: <=%s", sizestr);
- g_message ("Resolving org.freedesktop.Sdk.Extension.rust-stable for org.gnome.Sdk/x86_64/40");
- 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_message ("Resolving org.freedesktop.Sdk.Extension.rust-stable for org.gnome.Sdk/x86_64/master");
+ ret = ipc_flatpak_service_call_resolve_extension_sync (service, "org.gnome.Sdk/x86_64/master",
"org.freedesktop.Sdk.Extension.rust-stable", &resolved, NULL, &error);
g_assert_no_error (error);
g_assert_true (ret);
g_message (" Resolved to %s", resolved);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]