[gnome-builder] flatpak: Run build shell commands within the sandbox



commit b241ea503a213b98e60fc05fd9d9a02d6f01bbad
Author: Matthew Leeds <mleeds redhat com>
Date:   Mon Mar 27 14:41:39 2017 -0500

    flatpak: Run build shell commands within the sandbox
    
    This commit affects the way the post-build and post-install commands
    from flatpak manifests are run. Rather than running them on the host we
    now run them within the flatpak environment so they have access to /app
    for example.

 plugins/flatpak/gbp-flatpak-pipeline-addin.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-pipeline-addin.c b/plugins/flatpak/gbp-flatpak-pipeline-addin.c
index 0a8be15..893fb1b 100644
--- a/plugins/flatpak/gbp-flatpak-pipeline-addin.c
+++ b/plugins/flatpak/gbp-flatpak-pipeline-addin.c
@@ -362,7 +362,6 @@ register_build_commands_stage (GbpFlatpakPipelineAddin  *self,
   IdeConfiguration *config;
   guint stage_id;
   const gchar * const *build_commands;
-  const gchar *builddir;
 
   g_assert (GBP_IS_FLATPAK_PIPELINE_ADDIN (self));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
@@ -372,7 +371,8 @@ register_build_commands_stage (GbpFlatpakPipelineAddin  *self,
   if (!GBP_IS_FLATPAK_CONFIGURATION (config))
     return TRUE;
 
-  launcher = create_subprocess_launcher ();
+  if (NULL == (launcher = ide_build_pipeline_create_launcher (pipeline, error)))
+    return FALSE;
 
   ide_subprocess_launcher_push_argv (launcher, "/bin/sh");
   ide_subprocess_launcher_push_argv (launcher, "-c");
@@ -388,10 +388,6 @@ register_build_commands_stage (GbpFlatpakPipelineAddin  *self,
       ide_subprocess_launcher_push_argv (launcher, build_commands_joined);
     }
 
-  builddir = ide_build_pipeline_get_builddir (pipeline);
-  if (builddir != NULL)
-    ide_subprocess_launcher_set_cwd (launcher, builddir);
-
   stage = g_object_new (IDE_TYPE_BUILD_STAGE_LAUNCHER,
                         "context", context,
                         "launcher", launcher,
@@ -417,7 +413,6 @@ register_post_install_commands_stage (GbpFlatpakPipelineAddin  *self,
   IdeConfiguration *config;
   guint stage_id;
   const gchar * const *post_install_commands;
-  const gchar *builddir;
 
   g_assert (GBP_IS_FLATPAK_PIPELINE_ADDIN (self));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
@@ -427,7 +422,8 @@ register_post_install_commands_stage (GbpFlatpakPipelineAddin  *self,
   if (!GBP_IS_FLATPAK_CONFIGURATION (config))
     return TRUE;
 
-  launcher = create_subprocess_launcher ();
+  if (NULL == (launcher = ide_build_pipeline_create_launcher (pipeline, error)))
+    return FALSE;
 
   ide_subprocess_launcher_push_argv (launcher, "/bin/sh");
   ide_subprocess_launcher_push_argv (launcher, "-c");
@@ -443,10 +439,6 @@ register_post_install_commands_stage (GbpFlatpakPipelineAddin  *self,
       ide_subprocess_launcher_push_argv (launcher, post_install_commands_joined);
     }
 
-  builddir = ide_build_pipeline_get_builddir (pipeline);
-  if (builddir != NULL)
-    ide_subprocess_launcher_set_cwd (launcher, builddir);
-
   stage = g_object_new (IDE_TYPE_BUILD_STAGE_LAUNCHER,
                         "context", context,
                         "launcher", launcher,


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