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.
This commit is contained in:
Matthew Barnes 2015-09-02 12:49:31 -04:00
parent 8d2713e0f2
commit 7aed790da5
3 changed files with 20 additions and 9 deletions

View File

@ -31,7 +31,6 @@
#include "libgsystem.h" #include "libgsystem.h"
#include <libglnx.h> #include <libglnx.h>
static char *opt_sysroot = "/";
static char *opt_osname; static char *opt_osname;
static gboolean opt_reboot; static gboolean opt_reboot;
static gboolean opt_skip_purge; static gboolean opt_skip_purge;
@ -103,8 +102,12 @@ rpmostree_builtin_rebase (int argc,
if (!opt_reboot) if (!opt_reboot)
{ {
const char *sysroot_path;
sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
/* By request, doing this without dbus */ /* 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, cancellable,
error)) error))
goto out; goto out;

View File

@ -30,7 +30,6 @@
#include "libgsystem.h" #include "libgsystem.h"
#include <libglnx.h> #include <libglnx.h>
static char *opt_sysroot = "/";
static gboolean opt_reboot; static gboolean opt_reboot;
static GOptionEntry option_entries[] = { static GOptionEntry option_entries[] = {
@ -78,8 +77,12 @@ rpmostree_builtin_rollback (int argc,
if (!opt_reboot) if (!opt_reboot)
{ {
const char *sysroot_path;
sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
/* By request, doing this without dbus */ /* 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, cancellable,
error)) error))
goto out; goto out;

View File

@ -32,7 +32,6 @@
#include "libgsystem.h" #include "libgsystem.h"
#include <libglnx.h> #include <libglnx.h>
static char *opt_sysroot = "/";
static char *opt_osname; static char *opt_osname;
static gboolean opt_reboot; static gboolean opt_reboot;
static gboolean opt_allow_downgrade; static gboolean opt_allow_downgrade;
@ -127,8 +126,9 @@ rpmostree_builtin_upgrade (int argc,
gs_unref_object OstreeSysroot *sysroot = NULL; gs_unref_object OstreeSysroot *sysroot = NULL;
gs_unref_object OstreeRepo *repo = NULL; gs_unref_object OstreeRepo *repo = NULL;
gs_unref_object GFile *rpmdbdir = 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; g_autofree char *origin_description = NULL;
const char *sysroot_path;
_cleanup_rpmrev_ struct RpmRevisionData *rpmrev1 = NULL; _cleanup_rpmrev_ struct RpmRevisionData *rpmrev1 = NULL;
_cleanup_rpmrev_ struct RpmRevisionData *rpmrev2 = 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)) if (!rpmostree_os_get_has_cached_update_rpm_diff (os_proxy))
goto out; goto out;
sysroot_path = g_file_new_for_path (opt_sysroot); sysroot_path = rpmostree_sysroot_get_path (sysroot_proxy);
sysroot = ostree_sysroot_new (sysroot_path); sysroot_file = g_file_new_for_path (sysroot_path);
sysroot = ostree_sysroot_new (sysroot_file);
if (!ostree_sysroot_load (sysroot, cancellable, error)) if (!ostree_sysroot_load (sysroot, cancellable, error))
goto out; goto out;
@ -186,7 +187,11 @@ rpmostree_builtin_upgrade (int argc,
} }
else 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, cancellable,
error)) error))
goto out; goto out;