Rename libarchive write API to "export", matching command line

I was going to add new API for importing, and it was really confusing
that what I think of now as import and export both had "write" in the
name.  It's just clearer to talk about the direction.

At the same time, include `Export` in the options structure.

This isn't an ABI break as the API isn't in a release.
This commit is contained in:
Colin Walters 2016-02-18 11:25:57 -05:00
parent 707c14aeeb
commit b08b1abccd
3 changed files with 35 additions and 34 deletions

View File

@ -362,7 +362,7 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
static gboolean static gboolean
file_to_archive_entry_common (GFile *root, file_to_archive_entry_common (GFile *root,
OstreeRepoArchiveOptions *opts, OstreeRepoExportArchiveOptions *opts,
GFile *path, GFile *path,
GFileInfo *file_info, GFileInfo *file_info,
struct archive_entry *entry, struct archive_entry *entry,
@ -438,7 +438,7 @@ write_header_free_entry (struct archive *a,
static gboolean static gboolean
write_directory_to_libarchive_recurse (OstreeRepo *self, write_directory_to_libarchive_recurse (OstreeRepo *self,
OstreeRepoArchiveOptions *opts, OstreeRepoExportArchiveOptions *opts,
GFile *root, GFile *root,
GFile *dir, GFile *dir,
struct archive *a, struct archive *a,
@ -569,7 +569,7 @@ write_directory_to_libarchive_recurse (OstreeRepo *self,
#endif #endif
/** /**
* ostree_repo_write_tree_to_archive: * ostree_repo_export_tree_to_archive:
* @self: An #OstreeRepo * @self: An #OstreeRepo
* @opts: Options controlling conversion * @opts: Options controlling conversion
* @root: An #OstreeRepoFile for the base directory * @root: An #OstreeRepoFile for the base directory
@ -581,12 +581,12 @@ write_directory_to_libarchive_recurse (OstreeRepo *self,
* file structure to @mtree. * file structure to @mtree.
*/ */
gboolean gboolean
ostree_repo_write_tree_to_archive (OstreeRepo *self, ostree_repo_export_tree_to_archive (OstreeRepo *self,
OstreeRepoArchiveOptions *opts, OstreeRepoExportArchiveOptions *opts,
OstreeRepoFile *root, OstreeRepoFile *root,
void *archive, void *archive,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
#ifdef HAVE_LIBARCHIVE #ifdef HAVE_LIBARCHIVE
gboolean ret = FALSE; gboolean ret = FALSE;

View File

@ -441,22 +441,6 @@ gboolean ostree_repo_write_dfd_to_mtree (OstreeRepo *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
/**
* OstreeRepoWriteArchiveOptions:
*
* An extensible options structure controlling archive creation. Ensure that
* you have entirely zeroed the structure, then set just the desired
* options. This is used by ostree_repo_write_tree_to_archive().
*/
typedef struct {
guint disable_xattrs : 1;
guint reserved : 31;
guint64 timestamp_secs;
guint unused_uint[8];
gpointer unused_ptrs[8];
} OstreeRepoArchiveOptions;
gboolean ostree_repo_write_archive_to_mtree (OstreeRepo *self, gboolean ostree_repo_write_archive_to_mtree (OstreeRepo *self,
GFile *archive, GFile *archive,
@ -466,12 +450,29 @@ gboolean ostree_repo_write_archive_to_mtree (OstreeRepo *
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
gboolean ostree_repo_write_tree_to_archive (OstreeRepo *self, /**
OstreeRepoArchiveOptions *opts, * OstreeRepoExportArchiveOptions:
OstreeRepoFile *root, *
void *archive, /* Really struct archive * */ * An extensible options structure controlling archive creation. Ensure that
GCancellable *cancellable, * you have entirely zeroed the structure, then set just the desired
GError **error); * options. This is used by ostree_repo_export_tree_to_archive().
*/
typedef struct {
guint disable_xattrs : 1;
guint reserved : 31;
guint64 timestamp_secs;
guint unused_uint[8];
gpointer unused_ptrs[8];
} OstreeRepoExportArchiveOptions;
gboolean ostree_repo_export_tree_to_archive (OstreeRepo *self,
OstreeRepoExportArchiveOptions *opts,
OstreeRepoFile *root,
void *archive, /* Really struct archive * */
GCancellable *cancellable,
GError **error);
gboolean ostree_repo_write_mtree (OstreeRepo *self, gboolean ostree_repo_write_mtree (OstreeRepo *self,
OstreeMutableTree *mtree, OstreeMutableTree *mtree,

View File

@ -63,7 +63,7 @@ ostree_builtin_export (int argc, char **argv, GCancellable *cancellable, GError
g_autofree char *commit = NULL; g_autofree char *commit = NULL;
g_autoptr(GVariant) commit_data = NULL; g_autoptr(GVariant) commit_data = NULL;
struct archive *a; struct archive *a;
OstreeRepoArchiveOptions opts = { 0, }; OstreeRepoExportArchiveOptions opts = { 0, };
context = g_option_context_new ("COMMIT - Stream COMMIT to stdout in tar format"); context = g_option_context_new ("COMMIT - Stream COMMIT to stdout in tar format");
@ -124,8 +124,8 @@ ostree_builtin_export (int argc, char **argv, GCancellable *cancellable, GError
opts.timestamp_secs = ostree_commit_get_timestamp (commit_data); opts.timestamp_secs = ostree_commit_get_timestamp (commit_data);
if (!ostree_repo_write_tree_to_archive (repo, &opts, (OstreeRepoFile*)root, a, if (!ostree_repo_export_tree_to_archive (repo, &opts, (OstreeRepoFile*)root, a,
cancellable, error)) cancellable, error))
goto out; goto out;
if (archive_write_close (a) != ARCHIVE_OK) if (archive_write_close (a) != ARCHIVE_OK)