From 7aed790da5a1d872d24545f4c856ac6132f8daff Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 2 Sep 2015 12:49:31 -0400 Subject: [PATCH] app: Fix local operations with non-default sysroot paths Some vestigial option parsing cruft revealed the need for the Sysroot interface to grow a "Path" property. --- src/app/rpmostree-builtin-rebase.c | 7 +++++-- src/app/rpmostree-builtin-rollback.c | 7 +++++-- src/app/rpmostree-builtin-upgrade.c | 15 ++++++++++----- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/app/rpmostree-builtin-rebase.c b/src/app/rpmostree-builtin-rebase.c index 7a6bc96b..dc73c14b 100644 --- a/src/app/rpmostree-builtin-rebase.c +++ b/src/app/rpmostree-builtin-rebase.c @@ -31,7 +31,6 @@ #include "libgsystem.h" #include -static char *opt_sysroot = "/"; static char *opt_osname; static gboolean opt_reboot; static gboolean opt_skip_purge; @@ -103,8 +102,12 @@ rpmostree_builtin_rebase (int argc, if (!opt_reboot) { + const char *sysroot_path; + + sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy); + /* By request, doing this without dbus */ - if (!rpmostree_print_treepkg_diff_from_sysroot_path (opt_sysroot, + if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path, cancellable, error)) goto out; diff --git a/src/app/rpmostree-builtin-rollback.c b/src/app/rpmostree-builtin-rollback.c index 3669897f..60bacfe7 100644 --- a/src/app/rpmostree-builtin-rollback.c +++ b/src/app/rpmostree-builtin-rollback.c @@ -30,7 +30,6 @@ #include "libgsystem.h" #include -static char *opt_sysroot = "/"; static gboolean opt_reboot; static GOptionEntry option_entries[] = { @@ -78,8 +77,12 @@ rpmostree_builtin_rollback (int argc, if (!opt_reboot) { + const char *sysroot_path; + + sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy); + /* By request, doing this without dbus */ - if (!rpmostree_print_treepkg_diff_from_sysroot_path (opt_sysroot, + if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path, cancellable, error)) goto out; diff --git a/src/app/rpmostree-builtin-upgrade.c b/src/app/rpmostree-builtin-upgrade.c index 3317764a..04a6c608 100644 --- a/src/app/rpmostree-builtin-upgrade.c +++ b/src/app/rpmostree-builtin-upgrade.c @@ -32,7 +32,6 @@ #include "libgsystem.h" #include -static char *opt_sysroot = "/"; static char *opt_osname; static gboolean opt_reboot; static gboolean opt_allow_downgrade; @@ -127,8 +126,9 @@ rpmostree_builtin_upgrade (int argc, gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_object OstreeRepo *repo = NULL; gs_unref_object GFile *rpmdbdir = NULL; - gs_unref_object GFile *sysroot_path = NULL; + gs_unref_object GFile *sysroot_file = NULL; g_autofree char *origin_description = NULL; + const char *sysroot_path; _cleanup_rpmrev_ struct RpmRevisionData *rpmrev1 = NULL; _cleanup_rpmrev_ struct RpmRevisionData *rpmrev2 = NULL; @@ -139,8 +139,9 @@ rpmostree_builtin_upgrade (int argc, if (!rpmostree_os_get_has_cached_update_rpm_diff (os_proxy)) goto out; - sysroot_path = g_file_new_for_path (opt_sysroot); - sysroot = ostree_sysroot_new (sysroot_path); + sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy); + sysroot_file = g_file_new_for_path (sysroot_path); + sysroot = ostree_sysroot_new (sysroot_file); if (!ostree_sysroot_load (sysroot, cancellable, error)) goto out; @@ -186,7 +187,11 @@ rpmostree_builtin_upgrade (int argc, } else { - if (!rpmostree_print_treepkg_diff_from_sysroot_path (opt_sysroot, + const char *sysroot_path; + + sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy); + + if (!rpmostree_print_treepkg_diff_from_sysroot_path (sysroot_path, cancellable, error)) goto out;