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-diff.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-diff.c')
-rw-r--r-- | src/ostree/ot-admin-builtin-diff.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/ostree/ot-admin-builtin-diff.c b/src/ostree/ot-admin-builtin-diff.c index 8c543928..7497e1a5 100644 --- a/src/ostree/ot-admin-builtin-diff.c +++ b/src/ostree/ot-admin-builtin-diff.c @@ -46,10 +46,8 @@ ot_admin_builtin_diff (int argc, char **argv, OstreeSysroot *sysroot, GCancellab gs_unref_ptrarray GPtrArray *modified = NULL; gs_unref_ptrarray GPtrArray *removed = NULL; gs_unref_ptrarray GPtrArray *added = NULL; - gs_unref_ptrarray GPtrArray *deployments = NULL; gs_unref_object GFile *orig_etc_path = NULL; gs_unref_object GFile *new_etc_path = NULL; - int bootversion; context = g_option_context_new ("Diff current /etc configuration versus default"); @@ -58,27 +56,24 @@ ot_admin_builtin_diff (int argc, char **argv, OstreeSysroot *sysroot, GCancellab 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_load (sysroot, cancellable, error)) + goto out; - if (!ostree_sysroot_require_deployment_or_osname (sysroot, deployments, - opt_osname, &deployment, - cancellable, error)) + if (!ot_admin_require_booted_deployment_or_osname (sysroot, opt_osname, + cancellable, error)) goto out; - if (deployment != NULL) - opt_osname = (char*)ostree_deployment_get_osname (deployment); - if (deployment == NULL) - deployment = ostree_sysroot_get_merge_deployment (deployments, opt_osname, deployment); - if (deployment == NULL) + if (opt_osname != NULL) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, - "No deployment for OS '%s'", opt_osname); - goto out; + deployment = ostree_sysroot_get_merge_deployment (sysroot, opt_osname); + if (deployment == NULL) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, + "No deployment for OS '%s'", opt_osname); + goto out; + } } + else + deployment = g_object_ref (ostree_sysroot_get_booted_deployment (sysroot)); deployment_dir = ostree_sysroot_get_deployment_directory (sysroot, deployment); |