[gnome-builder] flatpak: use SDK deploy-dir for runtime
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: use SDK deploy-dir for runtime
- Date: Wed, 7 Jul 2021 19:20:19 +0000 (UTC)
commit 710c3767b733ff30f8b04814af63f77b9853cb92
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 7 12:19:49 2021 -0700
flatpak: use SDK deploy-dir for runtime
This fixes an issue where autocompletion broke because we had the wrong
include paths for libclang.
.../flatpak/daemon/ipc-flatpak-service-impl.c | 33 +++++++++++++++++++++-
src/plugins/flatpak/gbp-flatpak-runtime.c | 7 -----
2 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
index 8ba253d4c..0b204bee4 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
@@ -293,6 +293,26 @@ install_free (Install *install)
g_slice_free (Install, install);
}
+static FlatpakInstalledRef *
+find_sdk (GPtrArray *runtimes,
+ FlatpakRef *match)
+{
+ for (guint i = 0; i < runtimes->len; i++)
+ {
+ FlatpakInstalledRef *ref = g_ptr_array_index (runtimes, i);
+
+ if (g_strcmp0 (flatpak_ref_get_name (FLATPAK_REF (ref)),
+ flatpak_ref_get_name (match)) == 0 &&
+ g_strcmp0 (flatpak_ref_get_arch (FLATPAK_REF (ref)),
+ flatpak_ref_get_arch (match)) == 0 &&
+ g_strcmp0 (flatpak_ref_get_branch (FLATPAK_REF (ref)),
+ flatpak_ref_get_branch (match)) == 0)
+ return ref;
+ }
+
+ return NULL;
+}
+
static void
install_reload (IpcFlatpakServiceImpl *self,
Install *install)
@@ -314,9 +334,11 @@ install_reload (IpcFlatpakServiceImpl *self,
for (guint i = 0; i < refs->len; i++)
{
FlatpakInstalledRef *ref = g_ptr_array_index (refs, i);
+ FlatpakInstalledRef *installed_sdk;
g_autoptr(FlatpakRef) sdk_ref = NULL;
g_autoptr(GBytes) bytes = NULL;
g_autoptr(GKeyFile) keyfile = g_key_file_new ();
+ const char *deploy_dir = NULL;
g_autofree char *sdk_full_ref = NULL;
g_autofree char *name = NULL;
g_autofree char *runtime = NULL;
@@ -352,6 +374,15 @@ install_reload (IpcFlatpakServiceImpl *self,
if (!(sdk_ref = flatpak_ref_parse (sdk_full_ref, NULL)))
continue;
+ /* Try to locate the installed SDK so that we can get its deploy
+ * directory instead of the runtime (or the application will not
+ * be able to locate includes/pkg-config/etc when building).
+ */
+ if ((installed_sdk = find_sdk (refs, sdk_ref)))
+ deploy_dir = flatpak_installed_ref_get_deploy_dir (installed_sdk);
+ else
+ deploy_dir = flatpak_installed_ref_get_deploy_dir (ref);
+
state = g_slice_new0 (Runtime);
state->installation = g_object_ref (install->installation);
state->name = g_strdup (flatpak_ref_get_name (FLATPAK_REF (ref)));
@@ -359,7 +390,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->deploy_dir = g_strdup (deploy_dir);
state->sdk_extension = exten_of != NULL;
state->metadata = g_bytes_ref (bytes);
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index 6c31d7f7a..15f352724 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -782,13 +782,6 @@ gbp_flatpak_runtime_new (const char *name,
runtime_name = g_strdup_printf ("%s %s", _("Flatpak"), triplet);
- /*
- * TODO:
- *
- * If we have an SDK that is different from this runtime, we need to locate
- * the SDK deploy-dir instead (for things like includes, pkg-config, etc).
- */
-
return g_object_new (GBP_TYPE_FLATPAK_RUNTIME,
"id", id,
"triplet", triplet_object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]