[gnome-builder/wip/chergert/flatpak-repo] flatpak: wire up FLATPAK_CONFIG_DIR



commit 203eea40d22dec1f0f6f22bb1c67764755c01439
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 24 18:18:30 2021 -0700

    flatpak: wire up FLATPAK_CONFIG_DIR

 src/plugins/flatpak/gbp-flatpak-pipeline-addin.c      |  5 ++---
 src/plugins/flatpak/gbp-flatpak-runtime.c             |  4 ++++
 src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c |  1 +
 src/plugins/flatpak/gbp-flatpak-util.c                | 15 +++++++++++++++
 src/plugins/flatpak/gbp-flatpak-util.h                |  1 +
 5 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c 
b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index 5bc4fd434..33834962e 100644
--- a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -146,11 +146,10 @@ always_run_query_handler (IdePipelineStage *stage,
 static IdeSubprocessLauncher *
 create_subprocess_launcher (void)
 {
-  static char *config_dir;
   IdeSubprocessLauncher *launcher;
+  const char *config_dir;
 
-  if (config_dir == NULL)
-    config_dir = g_build_filename (g_get_user_data_dir (), "gnome-builder", "flatpak", "etc", NULL);
+  config_dir = gbp_flatpak_get_config_dir ();
 
   launcher = ide_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
                                           G_SUBPROCESS_FLAGS_STDERR_PIPE);
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime.c b/src/plugins/flatpak/gbp-flatpak-runtime.c
index 8abba86a7..edca4ba4b 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime.c
@@ -176,6 +176,7 @@ gbp_flatpak_runtime_create_launcher (IdeRuntime  *runtime,
       const gchar *builddir = NULL;
       const gchar *project_path = NULL;
       const gchar * const *build_args = NULL;
+      const gchar *config_dir = gbp_flatpak_get_config_dir ();
       g_autoptr(IdeConfigManager) config_manager = NULL;
       IdeConfig *configuration;
       IdeVcs *vcs;
@@ -194,6 +195,9 @@ gbp_flatpak_runtime_create_launcher (IdeRuntime  *runtime,
       ide_subprocess_launcher_push_argv (ret, "flatpak");
       ide_subprocess_launcher_push_argv (ret, "build");
 
+      /* Get access to override installations */
+      ide_subprocess_launcher_setenv (ret, "FLATPAK_CONFIG_DIR", config_dir, TRUE);
+
       if (GBP_IS_FLATPAK_MANIFEST (configuration))
         build_args = gbp_flatpak_manifest_get_build_args (GBP_FLATPAK_MANIFEST (configuration));
 
diff --git a/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c 
b/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
index 74004a088..566a85252 100644
--- a/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
+++ b/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
@@ -21,6 +21,7 @@
 #define G_LOG_DOMAIN "gbp-flatpak-subprocess-launcher"
 
 #include "gbp-flatpak-subprocess-launcher.h"
+#include "gbp-flatpak-util.h"
 
 struct _GbpFlatpakSubprocessLauncher
 {
diff --git a/src/plugins/flatpak/gbp-flatpak-util.c b/src/plugins/flatpak/gbp-flatpak-util.c
index 9a2896a56..2ab10aa73 100644
--- a/src/plugins/flatpak/gbp-flatpak-util.c
+++ b/src/plugins/flatpak/gbp-flatpak-util.c
@@ -178,3 +178,18 @@ gbp_flatpak_get_default_arch (IdeObject *object)
 
   return default_arch;
 }
+
+const char *
+gbp_flatpak_get_config_dir (void)
+{
+  static char *config_dir;
+
+  if (!config_dir)
+    config_dir = g_build_filename (g_get_user_data_dir (),
+                                   "gnome-builder",
+                                   "flatpak",
+                                   "etc",
+                                   NULL);
+
+  return config_dir;
+}
diff --git a/src/plugins/flatpak/gbp-flatpak-util.h b/src/plugins/flatpak/gbp-flatpak-util.h
index 63da8443d..bf7e44602 100644
--- a/src/plugins/flatpak/gbp-flatpak-util.h
+++ b/src/plugins/flatpak/gbp-flatpak-util.h
@@ -24,6 +24,7 @@
 
 G_BEGIN_DECLS
 
+const char *gbp_flatpak_get_config_dir   (void);
 const char *gbp_flatpak_get_default_arch (IdeObject         *object);
 gboolean    gbp_flatpak_is_ignored       (const gchar       *name);
 gchar      *gbp_flatpak_get_repo_dir     (IdeContext        *context);


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