mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-19 22:50:35 +03:00
lib: Add an "is_system" member to OstreeRepo
This is prep for introducing a fd-relative `ostree_repo_new_at()`. Previously, `ostree_repo_is_system()` compared `GFile` paths, but there's a much simpler check we can do first - if this repository was created via `OstreeSysroot`, it must be a system repo. Closes: #886 Approved by: jlebon
This commit is contained in:
parent
2f834968c6
commit
ed430b45de
@ -106,6 +106,7 @@ struct OstreeRepo {
|
||||
|
||||
gboolean inited;
|
||||
gboolean writable;
|
||||
gboolean is_system; /* Was this repo created via ostree_sysroot_get_repo() ? */
|
||||
GError *writable_error;
|
||||
gboolean in_transaction;
|
||||
gboolean disable_fsync;
|
||||
|
@ -710,6 +710,12 @@ ostree_repo_is_system (OstreeRepo *repo)
|
||||
|
||||
g_return_val_if_fail (OSTREE_IS_REPO (repo), FALSE);
|
||||
|
||||
/* If we were created via ostree_sysroot_get_repo(), we know the answer is yes
|
||||
* without having to compare file paths.
|
||||
*/
|
||||
if (repo->is_system)
|
||||
return TRUE;
|
||||
|
||||
default_repo_path = get_default_repo_path (repo->sysroot_dir);
|
||||
|
||||
return g_file_equal (repo->repodir, default_repo_path);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "ostree-core-private.h"
|
||||
#include "ostree-repo-private.h"
|
||||
#include "ostree-sepolicy-private.h"
|
||||
#include "ostree-sysroot-private.h"
|
||||
#include "ostree-deployment-private.h"
|
||||
@ -133,6 +134,7 @@ ostree_sysroot_constructed (GObject *object)
|
||||
|
||||
repo_path = g_file_resolve_relative_path (self->path, "ostree/repo");
|
||||
self->repo = ostree_repo_new_for_sysroot_path (repo_path, self->path);
|
||||
self->repo->is_system = TRUE;
|
||||
|
||||
G_OBJECT_CLASS (ostree_sysroot_parent_class)->constructed (object);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user