Commit 95709eb3 authored by Christian Hergert's avatar Christian Hergert
Browse files

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.
parent 6417004d
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment