daemon/upgrader: Return new deployment in deploy()

Enhance `rpmostree_sysroot_upgrader_deploy` to also return the newly
created deployment on success. Prep for more work.

Closes: #1324
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-04-03 13:45:42 -04:00 committed by Atomic Bot
parent 2b7f33ca9d
commit bd2920ad01
3 changed files with 8 additions and 3 deletions

View File

@ -1122,12 +1122,13 @@ rpmostree_sysroot_upgrader_deploy_set_kargs (RpmOstreeSysrootUpgrader *self,
/* Set the attribute kargs directly, not sure whether or not to have a setter */ /* Set the attribute kargs directly, not sure whether or not to have a setter */
/* Because .. currently pretty much here is the only place that we set it */ /* Because .. currently pretty much here is the only place that we set it */
self->kargs_strv = g_strdupv (kernel_args); self->kargs_strv = g_strdupv (kernel_args);
return rpmostree_sysroot_upgrader_deploy (self, cancellable, error); return rpmostree_sysroot_upgrader_deploy (self, NULL, cancellable, error);
} }
/** /**
* rpmostree_sysroot_upgrader_deploy: * rpmostree_sysroot_upgrader_deploy:
* @self: Self * @self: Self
* @out_deployment: (out) (optional): return location for new deployment
* @cancellable: Cancellable * @cancellable: Cancellable
* @error: Error * @error: Error
* *
@ -1136,6 +1137,7 @@ rpmostree_sysroot_upgrader_deploy_set_kargs (RpmOstreeSysrootUpgrader *self,
*/ */
gboolean gboolean
rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self, rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
OstreeDeployment **out_deployment,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
@ -1212,6 +1214,8 @@ rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
if (out_deployment)
*out_deployment = g_steal_pointer (&new_deployment);
return TRUE; return TRUE;
} }

View File

@ -121,6 +121,7 @@ rpmostree_sysroot_upgrader_pull_repos (RpmOstreeSysrootUpgrader *self,
gboolean gboolean
rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self, rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
OstreeDeployment **out_deployment,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);

View File

@ -1130,7 +1130,7 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
return TRUE; return TRUE;
} }
if (!rpmostree_sysroot_upgrader_deploy (upgrader, cancellable, error)) if (!rpmostree_sysroot_upgrader_deploy (upgrader, NULL, cancellable, error))
return FALSE; return FALSE;
/* Are we rebasing? May want to delete the previous ref */ /* Are we rebasing? May want to delete the previous ref */
@ -1304,7 +1304,7 @@ initramfs_state_transaction_execute (RpmostreedTransaction *transaction,
rpmostree_origin_set_regenerate_initramfs (origin, self->regenerate, self->args); rpmostree_origin_set_regenerate_initramfs (origin, self->regenerate, self->args);
rpmostree_sysroot_upgrader_set_origin (upgrader, origin); rpmostree_sysroot_upgrader_set_origin (upgrader, origin);
if (!rpmostree_sysroot_upgrader_deploy (upgrader, cancellable, error)) if (!rpmostree_sysroot_upgrader_deploy (upgrader, NULL, cancellable, error))
return FALSE; return FALSE;
if (self->reboot) if (self->reboot)