diff options
author | Colin Walters <walters@verbum.org> | 2013-09-16 09:13:58 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-09-16 18:32:13 -0400 |
commit | 8f1ea1b50aad70f671b8a2902f4b68771cce8682 (patch) | |
tree | 8934b8aa6e8a34ddb0ce3ac729e8dda694d41ace /src/ostree/ot-admin-builtin-status.c | |
parent | c07c84cb6f17d2c709897188c2f7e46164636c30 (diff) | |
download | ostree-8f1ea1b50aad70f671b8a2902f4b68771cce8682.tar.gz |
sysroot: Clean up API
Now that we have a real GObject for the sysroot, we have a convenient
place to keep track of 4 pieces of state:
* The current deployment list
* The current bootversion
* The current subbootversion
* The current booted deployment (if any)
Avoid requiring callers to pass all of this around and load it
piecemeal; instead the new thing is ostree_sysroot_load().
Diffstat (limited to 'src/ostree/ot-admin-builtin-status.c')
-rw-r--r-- | src/ostree/ot-admin-builtin-status.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/ostree/ot-admin-builtin-status.c b/src/ostree/ot-admin-builtin-status.c index c561eaf0..1f7801f5 100644 --- a/src/ostree/ot-admin-builtin-status.c +++ b/src/ostree/ot-admin-builtin-status.c @@ -38,8 +38,7 @@ ot_admin_builtin_status (int argc, char **argv, OstreeSysroot *sysroot, GCancell { GOptionContext *context; gboolean ret = FALSE; - int bootversion; - gs_unref_object OstreeDeployment *booted_deployment = NULL; + OstreeDeployment *booted_deployment = NULL; gs_unref_ptrarray GPtrArray *deployments = NULL; guint i; @@ -50,31 +49,18 @@ ot_admin_builtin_status (int argc, char **argv, OstreeSysroot *sysroot, GCancell if (!g_option_context_parse (context, &argc, &argv, error)) goto out; - if (!ostree_sysroot_list_deployments (sysroot, &bootversion, &deployments, - cancellable, error)) - { - g_prefix_error (error, "While listing deployments: "); - goto out; - } - - if (!ostree_sysroot_find_booted_deployment (sysroot, deployments, - &booted_deployment, - cancellable, error)) + if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; + deployments = ostree_sysroot_get_deployments (sysroot); + booted_deployment = ostree_sysroot_get_booted_deployment (sysroot); + if (deployments->len == 0) { g_print ("No deployments.\n"); } else { - int subbootversion; - - if (!ostree_sysroot_read_current_subbootversion (sysroot, bootversion, - &subbootversion, - cancellable, error)) - goto out; - for (i = 0; i < deployments->len; i++) { OstreeDeployment *deployment = deployments->pdata[i]; |