builder: Use flatpak_spawnv helper in a few more places

This is in preparation for it calling the new host-command.
This commit is contained in:
Alexander Larsson
2016-09-05 13:01:26 +02:00
parent c8df0e6208
commit ddf05ef063
3 changed files with 9 additions and 50 deletions

View File

@@ -1245,18 +1245,7 @@ command (GFile *app_dir,
g_ptr_array_add (args, g_strdup (commandline));
g_ptr_array_add (args, NULL);
g_debug ("Running '%s'", commandline);
launcher = g_subprocess_launcher_new (0);
subp = g_subprocess_launcher_spawnv (launcher, (const gchar * const *) args->pdata, error);
g_ptr_array_free (args, TRUE);
if (subp == NULL ||
!g_subprocess_wait_check (subp, NULL, error))
return FALSE;
return TRUE;
return flatpak_spawnv (NULL, NULL, error, (const char * const *)args->pdata);
}
typedef gboolean (*ForeachFileFunc) (BuilderManifest *self,
@@ -1401,7 +1390,6 @@ appstream_compose (GFile *app_dir,
g_autoptr(GSubprocess) subp = NULL;
g_autoptr(GPtrArray) args = NULL;
const gchar *arg;
g_autofree char *commandline = NULL;
va_list ap;
g_autoptr(GError) local_error = NULL;
@@ -1418,16 +1406,7 @@ appstream_compose (GFile *app_dir,
g_ptr_array_add (args, NULL);
va_end (ap);
commandline = g_strjoinv (" ", (char **) args->pdata);
g_debug ("Running '%s'", commandline);
launcher = g_subprocess_launcher_new (0);
subp = g_subprocess_launcher_spawnv (launcher, (const gchar * const *) args->pdata, &local_error);
g_ptr_array_free (args, TRUE);
if (subp == NULL ||
!g_subprocess_wait_check (subp, NULL, &local_error))
if (!flatpak_spawnv (NULL, NULL, &local_error, (const char * const *)args->pdata))
g_print ("WARNING: appstream-compose failed: %s\n", local_error->message);
return TRUE;

View File

@@ -721,10 +721,10 @@ build (GFile *app_dir,
g_autoptr(GPtrArray) args = NULL;
const gchar *arg;
const gchar **argv;
g_autofree char *commandline = NULL;
g_autofree char *source_dir_path = g_file_get_path (source_dir);
g_autofree char *source_dir_path_canonical = NULL;
g_autofree char *ccache_dir_path = NULL;
g_autoptr(GFile) source_dir_path_canonical_file = NULL;
const char *builddir;
va_list ap;
int i;
@@ -788,18 +788,9 @@ build (GFile *app_dir,
g_ptr_array_add (args, NULL);
va_end (ap);
commandline = g_strjoinv (" ", (char **) args->pdata);
g_debug ("Running '%s'", commandline);
source_dir_path_canonical_file = g_file_new_for_path (source_dir_path_canonical);
launcher = g_subprocess_launcher_new (0);
g_subprocess_launcher_set_cwd (launcher, source_dir_path_canonical);
subp = g_subprocess_launcher_spawnv (launcher, (const gchar * const *) args->pdata, error);
g_ptr_array_free (args, TRUE);
if (subp == NULL ||
!g_subprocess_wait_check (subp, NULL, error))
if (!flatpak_spawnv (source_dir_path_canonical_file, NULL, error, (const char * const *)args->pdata))
{
g_prefix_error (error, "module %s: ", module_name);
return FALSE;

View File

@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <sys/statfs.h>
#include "flatpak-utils.h"
#include "builder-utils.h"
#include "builder-source-shell.h"
@@ -121,9 +122,9 @@ run_script (BuilderContext *context,
g_autoptr(GSubprocessLauncher) launcher = NULL;
g_autoptr(GSubprocess) subp = NULL;
g_autoptr(GPtrArray) args = NULL;
g_autofree char *commandline = NULL;
g_autofree char *source_dir_path = g_file_get_path (source_dir);
g_autofree char *source_dir_path_canonical = NULL;
g_autoptr(GFile) source_dir_path_canonical_file = NULL;
args = g_ptr_array_new_with_free_func (g_free);
g_ptr_array_add (args, g_strdup ("flatpak"));
@@ -140,21 +141,9 @@ run_script (BuilderContext *context,
g_ptr_array_add (args, g_strdup (script));
g_ptr_array_add (args, NULL);
commandline = g_strjoinv (" ", (char **) args->pdata);
g_debug ("Running '%s'", commandline);
source_dir_path_canonical_file = g_file_new_for_path (source_dir_path_canonical);
launcher = g_subprocess_launcher_new (0);
g_subprocess_launcher_set_cwd (launcher, source_dir_path_canonical);
subp = g_subprocess_launcher_spawnv (launcher, (const gchar * const *) args->pdata, error);
g_ptr_array_free (args, TRUE);
if (subp == NULL ||
!g_subprocess_wait_check (subp, NULL, error))
return FALSE;
return TRUE;
return flatpak_spawnv (source_dir_path_canonical_file, NULL, error, (const char * const *)args->pdata);
}