libostree: new function ostree_repo_checkout_at
Provide a gobject introspection safe version for `ostree_repo_checkout_tree_at'. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #417 Approved by: cgwalters
This commit is contained in:
parent
6d310db1e7
commit
30963766c7
|
|
@ -344,6 +344,7 @@ OstreeRepoCheckoutMode
|
||||||
OstreeRepoCheckoutOverwriteMode
|
OstreeRepoCheckoutOverwriteMode
|
||||||
ostree_repo_checkout_tree
|
ostree_repo_checkout_tree
|
||||||
ostree_repo_checkout_tree_at
|
ostree_repo_checkout_tree_at
|
||||||
|
ostree_repo_checkout_at
|
||||||
ostree_repo_checkout_gc
|
ostree_repo_checkout_gc
|
||||||
ostree_repo_read_commit
|
ostree_repo_read_commit
|
||||||
OstreeRepoListObjectsFlags
|
OstreeRepoListObjectsFlags
|
||||||
|
|
|
||||||
|
|
@ -355,4 +355,5 @@ LIBOSTREE_2016.8 {
|
||||||
global:
|
global:
|
||||||
ostree_checksum_b64_to_bytes;
|
ostree_checksum_b64_to_bytes;
|
||||||
ostree_checksum_b64_from_bytes;
|
ostree_checksum_b64_from_bytes;
|
||||||
|
ostree_repo_checkout_at;
|
||||||
} LIBOSTREE_2016.7;
|
} LIBOSTREE_2016.7;
|
||||||
|
|
|
||||||
|
|
@ -104,14 +104,14 @@ checkout_object_for_uncompressed_cache (OstreeRepo *self,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fsync_is_enabled (OstreeRepo *self,
|
fsync_is_enabled (OstreeRepo *self,
|
||||||
OstreeRepoCheckoutOptions *options)
|
OstreeRepoCheckoutAtOptions *options)
|
||||||
{
|
{
|
||||||
return !(self->disable_fsync || options->disable_fsync);
|
return !(self->disable_fsync || options->disable_fsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
write_regular_file_content (OstreeRepo *self,
|
write_regular_file_content (OstreeRepo *self,
|
||||||
OstreeRepoCheckoutOptions *options,
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
GOutputStream *output,
|
GOutputStream *output,
|
||||||
GFileInfo *file_info,
|
GFileInfo *file_info,
|
||||||
GVariant *xattrs,
|
GVariant *xattrs,
|
||||||
|
|
@ -181,7 +181,7 @@ write_regular_file_content (OstreeRepo *self,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
checkout_file_from_input_at (OstreeRepo *self,
|
checkout_file_from_input_at (OstreeRepo *self,
|
||||||
OstreeRepoCheckoutOptions *options,
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
GFileInfo *file_info,
|
GFileInfo *file_info,
|
||||||
GVariant *xattrs,
|
GVariant *xattrs,
|
||||||
GInputStream *input,
|
GInputStream *input,
|
||||||
|
|
@ -264,7 +264,7 @@ checkout_file_from_input_at (OstreeRepo *self,
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
checkout_file_unioning_from_input_at (OstreeRepo *repo,
|
checkout_file_unioning_from_input_at (OstreeRepo *repo,
|
||||||
OstreeRepoCheckoutOptions *options,
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
GFileInfo *file_info,
|
GFileInfo *file_info,
|
||||||
GVariant *xattrs,
|
GVariant *xattrs,
|
||||||
GInputStream *input,
|
GInputStream *input,
|
||||||
|
|
@ -334,7 +334,7 @@ checkout_file_unioning_from_input_at (OstreeRepo *repo,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
checkout_file_hardlink (OstreeRepo *self,
|
checkout_file_hardlink (OstreeRepo *self,
|
||||||
OstreeRepoCheckoutOptions *options,
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
const char *loose_path,
|
const char *loose_path,
|
||||||
int destination_dfd,
|
int destination_dfd,
|
||||||
const char *destination_name,
|
const char *destination_name,
|
||||||
|
|
@ -391,7 +391,7 @@ checkout_file_hardlink (OstreeRepo *self,
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
checkout_one_file_at (OstreeRepo *repo,
|
checkout_one_file_at (OstreeRepo *repo,
|
||||||
OstreeRepoCheckoutOptions *options,
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
GFile *source,
|
GFile *source,
|
||||||
GFileInfo *source_info,
|
GFileInfo *source_info,
|
||||||
int destination_dfd,
|
int destination_dfd,
|
||||||
|
|
@ -627,7 +627,7 @@ checkout_one_file_at (OstreeRepo *repo,
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static gboolean
|
||||||
checkout_tree_at (OstreeRepo *self,
|
checkout_tree_at (OstreeRepo *self,
|
||||||
OstreeRepoCheckoutOptions *options,
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
int destination_parent_fd,
|
int destination_parent_fd,
|
||||||
const char *destination_name,
|
const char *destination_name,
|
||||||
OstreeRepoFile *source,
|
OstreeRepoFile *source,
|
||||||
|
|
@ -813,7 +813,7 @@ ostree_repo_checkout_tree (OstreeRepo *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
OstreeRepoCheckoutOptions options = { 0, };
|
OstreeRepoCheckoutAtOptions options = { 0, };
|
||||||
|
|
||||||
options.mode = mode;
|
options.mode = mode;
|
||||||
options.overwrite_mode = overwrite_mode;
|
options.overwrite_mode = overwrite_mode;
|
||||||
|
|
@ -827,7 +827,7 @@ ostree_repo_checkout_tree (OstreeRepo *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ostree_repo_checkout_tree_at:
|
* ostree_repo_checkout_tree_at: (skip)
|
||||||
* @self: Repo
|
* @self: Repo
|
||||||
* @options: (allow-none): Options
|
* @options: (allow-none): Options
|
||||||
* @destination_dfd: Directory FD for destination
|
* @destination_dfd: Directory FD for destination
|
||||||
|
|
@ -837,7 +837,7 @@ ostree_repo_checkout_tree (OstreeRepo *self,
|
||||||
* @error: Error
|
* @error: Error
|
||||||
*
|
*
|
||||||
* Similar to ostree_repo_checkout_tree(), but uses directory-relative
|
* Similar to ostree_repo_checkout_tree(), but uses directory-relative
|
||||||
* paths for the destination, uses a new `OstreeRepoCheckoutOptions`,
|
* paths for the destination, uses a new `OstreeRepoCheckoutAtOptions`,
|
||||||
* and takes a commit checksum and optional subpath pair, rather than
|
* and takes a commit checksum and optional subpath pair, rather than
|
||||||
* requiring use of `GFile` APIs for the caller.
|
* requiring use of `GFile` APIs for the caller.
|
||||||
*
|
*
|
||||||
|
|
@ -853,12 +853,56 @@ ostree_repo_checkout_tree_at (OstreeRepo *self,
|
||||||
const char *commit,
|
const char *commit,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
|
{
|
||||||
|
OstreeRepoCheckoutAtOptions new_opts = {0, };
|
||||||
|
new_opts.mode = options->mode;
|
||||||
|
new_opts.overwrite_mode = options->overwrite_mode;
|
||||||
|
new_opts.enable_uncompressed_cache = options->enable_uncompressed_cache;
|
||||||
|
new_opts.disable_fsync = options->disable_fsync;
|
||||||
|
new_opts.process_whiteouts = options->process_whiteouts;
|
||||||
|
new_opts.no_copy_fallback = options->no_copy_fallback;
|
||||||
|
new_opts.subpath = options->subpath;
|
||||||
|
new_opts.devino_to_csum_cache = options->devino_to_csum_cache;
|
||||||
|
return ostree_repo_checkout_at (self, &new_opts, destination_dfd,
|
||||||
|
destination_path, commit, cancellable, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ostree_repo_checkout_at:
|
||||||
|
* @self: Repo
|
||||||
|
* @options: (allow-none): Options
|
||||||
|
* @destination_dfd: Directory FD for destination
|
||||||
|
* @destination_path: Directory for destination
|
||||||
|
* @commit: Checksum for commit
|
||||||
|
* @cancellable: Cancellable
|
||||||
|
* @error: Error
|
||||||
|
*
|
||||||
|
* Similar to ostree_repo_checkout_tree(), but uses directory-relative
|
||||||
|
* paths for the destination, uses a new `OstreeRepoCheckoutAtOptions`,
|
||||||
|
* and takes a commit checksum and optional subpath pair, rather than
|
||||||
|
* requiring use of `GFile` APIs for the caller.
|
||||||
|
*
|
||||||
|
* It also replaces ostree_repo_checkout_at() which was not safe to
|
||||||
|
* use with GObject introspection.
|
||||||
|
*
|
||||||
|
* Note in addition that unlike ostree_repo_checkout_tree(), the
|
||||||
|
* default is not to use the repository-internal uncompressed objects
|
||||||
|
* cache.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
ostree_repo_checkout_at (OstreeRepo *self,
|
||||||
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
|
int destination_dfd,
|
||||||
|
const char *destination_path,
|
||||||
|
const char *commit,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
g_autoptr(GFile) commit_root = NULL;
|
g_autoptr(GFile) commit_root = NULL;
|
||||||
g_autoptr(GFile) target_dir = NULL;
|
g_autoptr(GFile) target_dir = NULL;
|
||||||
g_autoptr(GFileInfo) target_info = NULL;
|
g_autoptr(GFileInfo) target_info = NULL;
|
||||||
OstreeRepoCheckoutOptions default_options = { 0, };
|
OstreeRepoCheckoutAtOptions default_options = { 0, };
|
||||||
|
|
||||||
if (!options)
|
if (!options)
|
||||||
{
|
{
|
||||||
|
|
@ -920,7 +964,7 @@ devino_equal (gconstpointer a,
|
||||||
* ostree_repo_write_directory_to_mtree() using a (normally modified)
|
* ostree_repo_write_directory_to_mtree() using a (normally modified)
|
||||||
* directory. In order for OSTree to optimally detect just the new
|
* directory. In order for OSTree to optimally detect just the new
|
||||||
* files, use this function and fill in the `devino_to_csum_cache`
|
* files, use this function and fill in the `devino_to_csum_cache`
|
||||||
* member of `OstreeRepoCheckoutOptions`, then call
|
* member of `OstreeRepoCheckoutAtOptions`, then call
|
||||||
* ostree_repo_commit_set_devino_cache().
|
* ostree_repo_commit_set_devino_cache().
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): Newly allocated cache
|
* Returns: (transfer full): Newly allocated cache
|
||||||
|
|
|
||||||
|
|
@ -631,6 +631,7 @@ gboolean ostree_repo_import_archive_to_mtree (OstreeRepo
|
||||||
OstreeRepoCommitModifier *modifier,
|
OstreeRepoCommitModifier *modifier,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OstreeRepoExportArchiveOptions:
|
* OstreeRepoExportArchiveOptions:
|
||||||
*
|
*
|
||||||
|
|
@ -735,7 +736,7 @@ ostree_repo_checkout_tree (OstreeRepo *self,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OstreeRepoCheckoutOptions:
|
* OstreeRepoCheckoutOptions: (skip)
|
||||||
*
|
*
|
||||||
* An extensible options structure controlling checkout. Ensure that
|
* An extensible options structure controlling checkout. Ensure that
|
||||||
* you have entirely zeroed the structure, then set just the desired
|
* you have entirely zeroed the structure, then set just the desired
|
||||||
|
|
@ -761,6 +762,32 @@ typedef struct {
|
||||||
gpointer unused_ptrs[7];
|
gpointer unused_ptrs[7];
|
||||||
} OstreeRepoCheckoutOptions;
|
} OstreeRepoCheckoutOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OstreeRepoCheckoutAtOptions:
|
||||||
|
*
|
||||||
|
* An extensible options structure controlling checkout. Ensure that
|
||||||
|
* you have entirely zeroed the structure, then set just the desired
|
||||||
|
* options. This is used by ostree_repo_checkout_at() which
|
||||||
|
* supercedes previous separate enumeration usage in
|
||||||
|
* ostree_repo_checkout_tree() and ostree_repo_checkout_tree_at().
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
OstreeRepoCheckoutMode mode;
|
||||||
|
OstreeRepoCheckoutOverwriteMode overwrite_mode;
|
||||||
|
|
||||||
|
gboolean enable_uncompressed_cache;
|
||||||
|
gboolean disable_fsync;
|
||||||
|
gboolean process_whiteouts;
|
||||||
|
gboolean no_copy_fallback;
|
||||||
|
|
||||||
|
const char *subpath;
|
||||||
|
|
||||||
|
OstreeRepoDevInoCache *devino_to_csum_cache;
|
||||||
|
|
||||||
|
int unused_ints[6];
|
||||||
|
gpointer unused_ptrs[7];
|
||||||
|
} OstreeRepoCheckoutAtOptions;
|
||||||
|
|
||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
GType ostree_repo_devino_cache_get_type (void);
|
GType ostree_repo_devino_cache_get_type (void);
|
||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
|
|
@ -779,6 +806,15 @@ gboolean ostree_repo_checkout_tree_at (OstreeRepo *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
_OSTREE_PUBLIC
|
||||||
|
gboolean ostree_repo_checkout_at (OstreeRepo *self,
|
||||||
|
OstreeRepoCheckoutAtOptions *options,
|
||||||
|
int destination_dfd,
|
||||||
|
const char *destination_path,
|
||||||
|
const char *commit,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
_OSTREE_PUBLIC
|
_OSTREE_PUBLIC
|
||||||
gboolean ostree_repo_checkout_gc (OstreeRepo *self,
|
gboolean ostree_repo_checkout_gc (OstreeRepo *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue