diff --git a/src/libostree/ostree-chain-input-stream.h b/src/libostree/ostree-chain-input-stream.h index dbfea36d..7ad074ae 100644 --- a/src/libostree/ostree-chain-input-stream.h +++ b/src/libostree/ostree-chain-input-stream.h @@ -21,6 +21,8 @@ #pragma once +#ifndef __GI_SCANNER__ + #include G_BEGIN_DECLS @@ -63,3 +65,4 @@ OstreeChainInputStream * ostree_chain_input_stream_new (GPtrArray *stre G_END_DECLS +#endif diff --git a/src/libostree/ostree-diff.c b/src/libostree/ostree-diff.c index 9cd59942..fd1ad21d 100644 --- a/src/libostree/ostree-diff.c +++ b/src/libostree/ostree-diff.c @@ -77,6 +77,10 @@ ostree_diff_item_unref (OstreeDiffItem *diffitem) g_free (diffitem); } +G_DEFINE_BOXED_TYPE(OstreeDiffItem, ostree_diff_item, + ostree_diff_item_ref, + ostree_diff_item_unref); + static OstreeDiffItem * diff_item_new (GFile *a, GFileInfo *a_info, @@ -180,6 +184,11 @@ diff_add_dir_recurse (GFile *d, /** * ostree_diff_dirs: + * @a: First directory path + * @b: First directory path + * @modified: (element-type OstreeDiffItem): Modified files + * @removed: (element-type Gio.File): Removed files + * @added: (element-type Gio.File): Added files * * Compute the difference between directory @a and @b as 3 separate * sets of #OstreeDiffItem in @modified, @removed, and @added. @@ -382,6 +391,16 @@ print_diff_item (char prefix, } } +/** + * ostree_diff_print: + * @a: First directory path + * @b: First directory path + * @modified: (element-type OstreeDiffItem): Modified files + * @removed: (element-type Gio.File): Removed files + * @added: (element-type Gio.File): Added files + * + * Print the contents of a diff to stdout. + */ void ostree_diff_print (GFile *a, GFile *b, diff --git a/src/libostree/ostree-diff.h b/src/libostree/ostree-diff.h index c193e948..35e99f97 100644 --- a/src/libostree/ostree-diff.h +++ b/src/libostree/ostree-diff.h @@ -45,6 +45,8 @@ struct _OstreeDiffItem OstreeDiffItem *ostree_diff_item_ref (OstreeDiffItem *diffitem); void ostree_diff_item_unref (OstreeDiffItem *diffitem); +GType ostree_diff_item_get_type (void); + gboolean ostree_diff_dirs (GFile *a, GFile *b, GPtrArray *modified, diff --git a/src/libostree/ostree-fetcher.h b/src/libostree/ostree-fetcher.h index 8be7b01f..5359faaf 100644 --- a/src/libostree/ostree-fetcher.h +++ b/src/libostree/ostree-fetcher.h @@ -20,6 +20,8 @@ #pragma once +#ifndef __GI_SCANNER__ + #define LIBSOUP_USE_UNSTABLE_REQUEST_API #include #include @@ -70,3 +72,4 @@ GFile *ostree_fetcher_request_uri_finish (OstreeFetcher *self, G_END_DECLS +#endif diff --git a/src/libostree/ostree-mutable-tree.c b/src/libostree/ostree-mutable-tree.c index edbe4f65..fe9a0d9c 100644 --- a/src/libostree/ostree-mutable-tree.c +++ b/src/libostree/ostree-mutable-tree.c @@ -221,6 +221,17 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self, return ret; } +/** + * ostree_mutable_tree_ensure_parent_dirs: + * @self: + * @split_path: (element-type utf8): File path components + * @metadata_checksum: SHA256 checksum for metadata + * @out_parent: (out) (transfer full): The parent tree + * @error: a #GError + * + * Create all parent trees necessary for the given @split_path to + * exist. + */ gboolean ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self, GPtrArray *split_path, @@ -269,11 +280,22 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self, return ret; } +/** + * ostree_mutable_tree_walk: + * @self: + * @split_path: (element-type utf8): Split pathname + * @start: Descend from this number of elements in @split_path + * @out_subdir: (out) (transfer full): Target parent + * @error: + * + * Traverse @start number of elements starting from @split_path; the + * child will be returned in @out_subdir. + */ gboolean ostree_mutable_tree_walk (OstreeMutableTree *self, GPtrArray *split_path, guint start, - OstreeMutableTree **out_parent, + OstreeMutableTree **out_subdir, GError **error) { if (start >= split_path->len) @@ -282,7 +304,7 @@ ostree_mutable_tree_walk (OstreeMutableTree *self, } else if (start == split_path->len - 1) { - *out_parent = g_object_ref (self); + *out_subdir = g_object_ref (self); return TRUE; } else @@ -293,22 +315,39 @@ ostree_mutable_tree_walk (OstreeMutableTree *self, if (!subdir) return set_error_noent (error, (char*)split_path->pdata[start]); - return ostree_mutable_tree_walk (subdir, split_path, start + 1, out_parent, error); + return ostree_mutable_tree_walk (subdir, split_path, start + 1, out_subdir, error); } } +/** + * ostree_mutable_tree_get_subdirs: + * @self: + * + * Returns: (transfer none) (element-type utf8 OstreeMutableTree): All children directories + */ GHashTable * ostree_mutable_tree_get_subdirs (OstreeMutableTree *self) { return self->subdirs; } +/** + * ostree_mutable_tree_get_files: + * @self: + * + * Returns: (transfer none) (element-type utf8 utf8): All children files (the value is a checksum) + */ GHashTable * ostree_mutable_tree_get_files (OstreeMutableTree *self) { return self->files; } +/** + * ostree_mutable_tree_new: + * + * Returns: (transfer full): A new tree + */ OstreeMutableTree * ostree_mutable_tree_new (void) { diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c index c80b529d..2b8e2438 100644 --- a/src/libostree/ostree-repo-file.c +++ b/src/libostree/ostree-repo-file.c @@ -110,6 +110,13 @@ set_error_noent (GFile *self, GError **error) return FALSE; } +/** + * ostree_repo_file_new_root: + * @repo: Containing repo + * @commit: SHA256 checksum + * + * Returns: (transfer full): A new #OstreeRepoFile corresponding to commit contents + */ GFile * ostree_repo_file_new_root (OstreeRepo *repo, const char *commit) @@ -127,7 +134,13 @@ ostree_repo_file_new_root (OstreeRepo *repo, return G_FILE (self); } - +/** + * ostree_repo_file_new_child: + * @parent: + * @name: Name for new child + * + * Returns: (transfer full): A new child file with the given name + */ GFile * ostree_repo_file_new_child (OstreeRepoFile *parent, const char *name) @@ -344,18 +357,35 @@ ostree_repo_file_tree_get_content_checksum (OstreeRepoFile *self) return self->tree_contents_checksum; } +/** + * ostree_repo_file_nontree_get_local: + * + * Returns: (transfer full): The real loose #GFile backing this object + */ GFile * ostree_repo_file_nontree_get_local (OstreeRepoFile *self) { return ostree_repo_get_file_object_path (self->repo, ostree_repo_file_get_checksum (self)); } +/** + * ostree_repo_file_get_repo: + * @self: + * + * Returns: (transfer none): Repository + */ OstreeRepo * ostree_repo_file_get_repo (OstreeRepoFile *self) { return self->repo; } +/** + * ostree_repo_file_get_root: + * @self: + * + * Returns: (transfer none): The root directory for the commit referenced by this file + */ OstreeRepoFile * ostree_repo_file_get_root (OstreeRepoFile *self) { diff --git a/src/libostree/ostree-repo-traverse.c b/src/libostree/ostree-repo-traverse.c index 7959ae27..996033e9 100644 --- a/src/libostree/ostree-repo-traverse.c +++ b/src/libostree/ostree-repo-traverse.c @@ -26,6 +26,14 @@ #include "otutil.h" #include "libgsystem.h" +/** + * ostree_repo_traverse_new_reachable: + * + * This hash table is a set of #GVariant which can be accessed via + * ostree_object_name_deserialize(). + * + * Returns: (transfer full) (element-type GVariant GVariant): A new hash table + */ GHashTable * ostree_repo_traverse_new_reachable (void) { diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 175e0977..acc3d157 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -375,12 +375,24 @@ ostree_repo_check (OstreeRepo *self, GError **error) return ret; } +/** + * ostree_repo_get_path: + * @self: + * + * Returns: (transfer none): Path to repo + */ GFile * ostree_repo_get_path (OstreeRepo *self) { return self->repodir; } +/** + * ostree_repo_get_tmpdir: + * @self: + * + * Returns: (transfer none): Path to temporary directory + */ GFile * ostree_repo_get_tmpdir (OstreeRepo *self) { @@ -410,6 +422,17 @@ ostree_repo_get_parent (OstreeRepo *self) return self->parent_repo; } +/** + * ostree_repo_get_file_object_path: + * @self: + * @checksum: SHA256 checksum string + * + * This function directly retrieves the path of loose objects; it is a + * low level API as one cannot assume that all objects are loose. Use + * higher level API such as ostree_repo_load_file() if possible. + * + * Returns: (transfer full): A new file containing the direct path to a loose object + */ GFile * ostree_repo_get_file_object_path (OstreeRepo *self, const char *checksum) @@ -417,6 +440,17 @@ ostree_repo_get_file_object_path (OstreeRepo *self, return ostree_repo_get_object_path (self, checksum, OSTREE_OBJECT_TYPE_FILE); } +/** + * ostree_repo_get_archive_content_path: + * @self: + * @checksum: SHA256 checksum string + * + * This function directly retrieves the path of loose objects; it is a + * low level API as one cannot assume that all objects are loose. Use + * higher level API such as ostree_repo_load_file() if possible. + * + * Returns: (transfer full): A new file containing the direct path to a loose object + */ GFile * ostree_repo_get_archive_content_path (OstreeRepo *self, const char *checksum) @@ -1264,6 +1298,18 @@ _ostree_repo_stage_directory_meta (OstreeRepo *self, dirmeta, out_csum, cancellable, error); } +/** + * ostree_repo_get_object_path: + * @self: + * @checksum: SHA256 checksum string + * @type: Object type + * + * This function directly retrieves the path of loose objects; it is a + * low level API as one cannot assume that all objects are loose. Use + * higher level API such as ostree_repo_load_file() if possible. + * + * Returns: (transfer full): A new file containing the direct path to a loose object + */ GFile * ostree_repo_get_object_path (OstreeRepo *self, const char *checksum, @@ -1892,6 +1938,11 @@ ostree_repo_stage_mtree (OstreeRepo *self, return ret; } +/** + * ostree_repo_commit_modifier_new: + * + * Returns: (transfer full): A new commit modifier. + */ OstreeRepoCommitModifier * ostree_repo_commit_modifier_new (void) { @@ -1902,6 +1953,13 @@ ostree_repo_commit_modifier_new (void) return modifier; } +OstreeRepoCommitModifier * +ostree_repo_commit_modifier_ref (OstreeRepoCommitModifier *modifier) +{ + g_atomic_int_inc (&modifier->refcount); + return modifier; +} + void ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier) { @@ -1914,6 +1972,10 @@ ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier) return; } +G_DEFINE_BOXED_TYPE(OstreeRepoCommitModifier, ostree_repo_commit_modifier, + ostree_repo_commit_modifier_ref, + ostree_repo_commit_modifier_unref); + static gboolean list_loose_object_dir (OstreeRepo *self, GFile *dir, diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h index 9b197bec..5ff232c3 100644 --- a/src/libostree/ostree-repo.h +++ b/src/libostree/ostree-repo.h @@ -66,14 +66,14 @@ gboolean ostree_repo_write_config (OstreeRepo *self, GError **error); GFile * ostree_repo_get_object_path (OstreeRepo *self, - const char *object, + const char *checksum, OstreeObjectType type); GFile * ostree_repo_get_archive_content_path (OstreeRepo *self, const char *checksum); GFile * ostree_repo_get_file_object_path (OstreeRepo *self, - const char *object); + const char *checksum); gboolean ostree_repo_prepare_transaction (OstreeRepo *self, gboolean enable_commit_hardlink_scan, @@ -191,7 +191,7 @@ gboolean ostree_repo_load_variant_c (OstreeRepo *self, GError **error); gboolean ostree_repo_load_variant (OstreeRepo *self, - OstreeObjectType expected_type, + OstreeObjectType objtype, const char *sha256, GVariant **out_variant, GError **error); @@ -234,6 +234,9 @@ typedef struct { OstreeRepoCommitModifier *ostree_repo_commit_modifier_new (void); +GType ostree_repo_commit_modifier_get_type (void); + +OstreeRepoCommitModifier *ostree_repo_commit_modifier_ref (OstreeRepoCommitModifier *modifier); void ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier); gboolean ostree_repo_stage_directory_to_mtree (OstreeRepo *self,