[gnome-builder] flatpak: ensure deploydir of extensions



commit dd680592db5236fe8ff04e033bcce1fb6456ed85
Author: Günther Wagner <info gunibert de>
Date:   Mon Oct 11 07:15:11 2021 +0200

    flatpak: ensure deploydir of extensions
    
    This ensures that extensions always use their deploy directory instead of the Sdk in order to correctly 
find executables in paths.

 src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c |  2 +-
 src/plugins/flatpak/gbp-flatpak-runtime.c             | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c 
b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
index dcdc16776..2daf9d141 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
@@ -372,7 +372,7 @@ install_reload (IpcFlatpakServiceImpl *self,
        * 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)))
+      if ((installed_sdk = find_sdk (refs, sdk_ref)) && exten_of == NULL)
         deploy_dir = flatpak_installed_ref_get_deploy_dir (installed_sdk);
       else
         deploy_dir = flatpak_installed_ref_get_deploy_dir (ref);
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index f98c02da5..154a18d54 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -124,14 +124,17 @@ gbp_flatpak_runtime_contains_program_in_path (IdeRuntime   *runtime,
       self->sdk != NULL &&
       !ide_str_equal0 (self->platform, self->sdk))
     {
-      g_autoptr(IdeContext) context = ide_object_ref_context (IDE_OBJECT (self));
-      g_autoptr(IdeRuntimeManager) manager = ide_object_ensure_child_typed (IDE_OBJECT (context), 
IDE_TYPE_RUNTIME_MANAGER);
-      g_autofree char *arch = ide_runtime_get_arch (runtime);
-      g_autofree char *sdk_id = g_strdup_printf ("flatpak:%s/%s/%s", self->sdk, arch, self->branch);
-      IdeRuntime *sdk = ide_runtime_manager_get_runtime (manager, sdk_id);
-
-      if (sdk != NULL && sdk != runtime)
-        ret = ide_runtime_contains_program_in_path (sdk, program, cancellable);
+      IdeContext* context = ide_object_get_context (IDE_OBJECT (self));
+      if (context)
+        {
+          g_autoptr(IdeRuntimeManager) manager = ide_object_ensure_child_typed (IDE_OBJECT (context), 
IDE_TYPE_RUNTIME_MANAGER);
+          g_autofree char *arch = ide_runtime_get_arch (runtime);
+          g_autofree char *sdk_id = g_strdup_printf ("flatpak:%s/%s/%s", self->sdk, arch, self->branch);
+          IdeRuntime *sdk = ide_runtime_manager_get_runtime (manager, sdk_id);
+
+          if (sdk != NULL && sdk != runtime)
+            ret = ide_runtime_contains_program_in_path (sdk, program, cancellable);
+        }
     }
 
   /* Cache both positive and negative lookups */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]