[ostree] deltas: Support passing filename to ostree_repo_static_delta_execute_offline
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] deltas: Support passing filename to ostree_repo_static_delta_execute_offline
- Date: Tue, 10 Nov 2015 08:53:39 +0000 (UTC)
commit ec56fea82170d2c60406ccd6369dafbdad2a14d7
Author: Alexander Larsson <alexl redhat com>
Date: Fri Oct 16 12:54:01 2015 +0200
deltas: Support passing filename to ostree_repo_static_delta_execute_offline
If you pass a diriectory it will look for the "superblock" child, otherwise
it will use the file as the superblock. I need this in xdg-app to be able
to install any filename as a bundle.
src/libostree/ostree-repo-static-delta-core.c | 21 ++++++++++++++++++---
src/libostree/ostree-repo.h | 2 +-
2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/src/libostree/ostree-repo-static-delta-core.c b/src/libostree/ostree-repo-static-delta-core.c
index c373b60..2e44578 100644
--- a/src/libostree/ostree-repo-static-delta-core.c
+++ b/src/libostree/ostree-repo-static-delta-core.c
@@ -206,7 +206,7 @@ _ostree_repo_static_delta_part_have_all_objects (OstreeRepo *repo,
/**
* ostree_repo_static_delta_execute_offline:
* @self: Repo
- * @dir: Path to a directory containing static delta data
+ * @dir_or_file: Path to a directory containing static delta data, or directly to the superblock
* @skip_validation: If %TRUE, assume data integrity
* @cancellable: Cancellable
* @error: Error
@@ -218,20 +218,35 @@ _ostree_repo_static_delta_part_have_all_objects (OstreeRepo *repo,
*/
gboolean
ostree_repo_static_delta_execute_offline (OstreeRepo *self,
- GFile *dir,
+ GFile *dir_or_file,
gboolean skip_validation,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
guint i, n;
- g_autoptr(GFile) meta_file = g_file_get_child (dir, "superblock");
+ g_autoptr(GFile) meta_file = NULL;
+ g_autoptr(GFile) dir = NULL;
g_autoptr(GVariant) meta = NULL;
g_autoptr(GVariant) headers = NULL;
g_autoptr(GVariant) metadata = NULL;
g_autoptr(GVariant) fallback = NULL;
g_autofree char *to_checksum = NULL;
g_autofree char *from_checksum = NULL;
+ GFileType file_type;
+
+
+ file_type = g_file_query_file_type (dir_or_file, 0, cancellable);
+ if (file_type == G_FILE_TYPE_DIRECTORY)
+ {
+ dir = g_object_ref (dir_or_file);
+ meta_file = g_file_get_child (dir, "superblock");
+ }
+ else
+ {
+ meta_file = g_object_ref (dir_or_file);
+ dir = g_file_get_parent (meta_file);
+ }
if (!ot_util_variant_map (meta_file, G_VARIANT_TYPE (OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT),
FALSE, &meta, error))
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index 38a261f..e67c310 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -594,7 +594,7 @@ gboolean ostree_repo_static_delta_generate (OstreeRepo *self,
GError **error);
gboolean ostree_repo_static_delta_execute_offline (OstreeRepo *self,
- GFile *dir,
+ GFile *dir_or_file,
gboolean skip_validation,
GCancellable *cancellable,
GError **error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]