[gnome-software] rpm-ostree: Implement distro upgrade downloading
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] rpm-ostree: Implement distro upgrade downloading
- Date: Wed, 4 Jul 2018 13:20:49 +0000 (UTC)
commit 0763e8a42566619a605192ca4ac8469a20c2bbf7
Author: Kalev Lember <klember redhat com>
Date: Wed Jul 4 11:59:38 2018 +0200
rpm-ostree: Implement distro upgrade downloading
This just hardcodes rebasing to ostree://fedora/%s/x86_64/workstation,
where %s is the next available distro version. In the future, we can
hopefully be smarter with contructing the refspec, but this is a start.
plugins/rpm-ostree/gs-plugin-rpm-ostree.c | 62 +++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
---
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index 6d1abaa1..206d967b 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -794,6 +794,68 @@ gs_plugin_refine (GsPlugin *plugin,
return TRUE;
}
+gboolean
+gs_plugin_app_upgrade_download (GsPlugin *plugin,
+ GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ const char *packages[] = { NULL };
+ g_autofree gchar *new_refspec = NULL;
+ g_autofree gchar *transaction_address = NULL;
+ g_autoptr(GVariant) options = NULL;
+
+ /* only process this app if was created by this plugin */
+ if (g_strcmp0 (gs_app_get_management_plugin (app), gs_plugin_get_name (plugin)) != 0)
+ return TRUE;
+
+ /* check is distro-upgrade */
+ if (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE)
+ return TRUE;
+
+ /* construct new refspec based on the distro version we're upgrading to */
+ new_refspec = g_strdup_printf ("ostree://fedora/%s/x86_64/workstation",
+ gs_app_get_version (app));
+
+ options = make_rpmostree_options_variant (FALSE, /* reboot */
+ FALSE, /* allow-downgrade */
+ FALSE, /* cache-only */
+ TRUE, /* download-only */
+ FALSE, /* skip-purge */
+ FALSE, /* no-pull-base */
+ FALSE, /* dry-run */
+ FALSE); /* no-overrides */
+
+ gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+ if (!gs_rpmostree_os_call_rebase_sync (priv->os_proxy,
+ options,
+ new_refspec,
+ packages,
+ NULL /* fd list */,
+ &transaction_address,
+ NULL /* fd list out */,
+ cancellable,
+ error)) {
+ gs_utils_error_convert_gio (error);
+ gs_app_set_state_recover (app);
+ return FALSE;
+ }
+
+ if (!gs_rpmostree_transaction_get_response_sync (priv->sysroot_proxy,
+ transaction_address,
+ cancellable,
+ error)) {
+ gs_utils_error_convert_gio (error);
+ gs_app_set_state_recover (app);
+ return FALSE;
+ }
+
+ /* state is known */
+ gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
+ return TRUE;
+}
+
gboolean
gs_plugin_launch (GsPlugin *plugin,
GsApp *app,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]