[gnome-builder] flatpak: use pkcon to install flatpak and flatpak-builder
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: use pkcon to install flatpak and flatpak-builder
- Date: Fri, 10 Mar 2017 04:13:23 +0000 (UTC)
commit 95709eb3f23513bcae84ebcf335f9af071b3f2a1
Author: Christian Hergert <chergert redhat com>
Date: Thu Mar 9 20:13:14 2017 -0800
flatpak: use pkcon to install flatpak and flatpak-builder
If we need to install flatpak-builder on the host, we can do so with
pkcon instead of the dbus service which doesn't seem to do what I thought
it did.
We should also be able to make an IdeTransfer around this for progress,
but that is a future exercise.
plugins/flatpak/gbp-flatpak-runtime-provider.c | 45 +++++++++++------------
1 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runtime-provider.c b/plugins/flatpak/gbp-flatpak-runtime-provider.c
index 9eb800e..68bf81d 100644
--- a/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -413,30 +413,29 @@ gbp_flatpak_runtime_provider_install_deps_worker (GTask *task,
if (!retval)
g_ptr_array_add (packages, "flatpak-builder");
- g_ptr_array_add (packages, NULL);
-
- if (packages->len > 1)
+ if (packages->len > 0)
{
- GVariantBuilder builder;
-
- g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
-
- reply = g_dbus_connection_call_sync (bus,
- "org.freedesktop.PackageKit",
- "/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit.Modify2",
- "InstallPackageNames",
- g_variant_new ("(^a&sssa{sv})",
- (const gchar * const *)packages->pdata,
- "",
- "org.gnome.Builder",
- &builder),
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- cancellable,
- &error);
- if (reply == NULL)
+ g_autoptr(IdeSubprocessLauncher) launcher = NULL;
+ g_autoptr(IdeSubprocess) subprocess = NULL;
+
+ /* Launch a process to install flatpak-builder */
+
+ launcher = ide_subprocess_launcher_new (0);
+
+ ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
+
+ ide_subprocess_launcher_push_argv (launcher, "pkexec");
+ ide_subprocess_launcher_push_argv (launcher, "pkcon");
+ ide_subprocess_launcher_push_argv (launcher, "install");
+ ide_subprocess_launcher_push_argv (launcher, "-y");
+ ide_subprocess_launcher_push_argv (launcher, "-p");
+ for (guint i = 0; i < packages->len; i++)
+ ide_subprocess_launcher_push_argv (launcher, g_ptr_array_index (packages, i));
+
+ if (!(subprocess = ide_subprocess_launcher_spawn (launcher, cancellable, &error)))
+ IDE_GOTO (failure);
+
+ if (!ide_subprocess_wait_check (subprocess, cancellable, &error))
IDE_GOTO (failure);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]