[gnome-builder/wip/chergert/flatpak-repo: 16/29] flatpak: provide --sdk-extension for extensions




commit 83efd5d0a1b3b39fda9f8726c7054a4658abb40f
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 24 16:54:46 2021 -0700

    flatpak: provide --sdk-extension for extensions
    
    This helps ensure we have access to the sdk-extensions when configuring
    the build environment.

 src/plugins/flatpak/gbp-flatpak-pipeline-addin.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c 
b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index cdea40130..5bc4fd434 100644
--- a/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -290,7 +290,7 @@ reap_staging_dir (IdePipelineStage      *stage,
 
 static gboolean
 register_build_init_stage (GbpFlatpakPipelineAddin  *self,
-                           IdePipeline         *pipeline,
+                           IdePipeline              *pipeline,
                            IdeContext               *context,
                            GError                  **error)
 {
@@ -299,6 +299,7 @@ register_build_init_stage (GbpFlatpakPipelineAddin  *self,
   g_autofree gchar *staging_dir = NULL;
   g_autofree gchar *sdk = NULL;
   g_autofree gchar *arch = NULL;
+  const char * const *sdk_extensions = NULL;
   IdeConfig *config;
   IdeRuntime *runtime;
   const gchar *app_id;
@@ -331,6 +332,9 @@ register_build_init_stage (GbpFlatpakPipelineAddin  *self,
   sdk = gbp_flatpak_runtime_get_sdk_name (GBP_FLATPAK_RUNTIME (runtime));
   branch = gbp_flatpak_runtime_get_branch (GBP_FLATPAK_RUNTIME (runtime));
 
+  if (GBP_IS_FLATPAK_MANIFEST (config))
+    sdk_extensions = gbp_flatpak_manifest_get_sdk_extensions (GBP_FLATPAK_MANIFEST (config));
+
   /*
    * If we got here by using a non-flatpak configuration, then there is a
    * chance we don't have a valid app-id.
@@ -355,6 +359,7 @@ register_build_init_stage (GbpFlatpakPipelineAddin  *self,
 
   ide_subprocess_launcher_push_argv (launcher, "flatpak");
   ide_subprocess_launcher_push_argv (launcher, "build-init");
+  ide_subprocess_launcher_push_argv (launcher, "--type=app");
   ide_subprocess_launcher_push_argv (launcher, arch);
   ide_subprocess_launcher_push_argv (launcher, staging_dir);
   ide_subprocess_launcher_push_argv (launcher, app_id);
@@ -362,6 +367,17 @@ register_build_init_stage (GbpFlatpakPipelineAddin  *self,
   ide_subprocess_launcher_push_argv (launcher, platform);
   ide_subprocess_launcher_push_argv (launcher, branch);
 
+  if (sdk_extensions != NULL)
+    {
+      for (guint i = 0; sdk_extensions[i]; i++)
+        {
+          g_auto(GStrv) split = g_strsplit (sdk_extensions[i], "/", 2);
+          g_autofree char *arg = g_strdup_printf ("--sdk-extension=%s", split[0]);
+
+          ide_subprocess_launcher_push_argv (launcher, arg);
+        }
+    }
+
   stage = g_object_new (IDE_TYPE_PIPELINE_STAGE_LAUNCHER,
                         "name", _("Preparing build directory"),
                         "launcher", launcher,


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