lib: Define an alias OSTREE_REPO_MODE_ARCHIVE
For the old `OSTREE_REPO_MODE_ARCHIVE_Z2`. Use it mostly tree wide except for the repo finder tests (to avoid conflicting with some outstanding PRs). Just noted another user coming in some of those tests and wanted to do a cleanup. Closes: #1209 Approved by: jlebon
This commit is contained in:
parent
1797aff6a8
commit
ee5ecf33a5
|
|
@ -35,6 +35,7 @@
|
|||
/* Generic ABI checks */
|
||||
G_STATIC_ASSERT(OSTREE_REPO_MODE_BARE == 0);
|
||||
G_STATIC_ASSERT(OSTREE_REPO_MODE_ARCHIVE_Z2 == 1);
|
||||
G_STATIC_ASSERT(OSTREE_REPO_MODE_ARCHIVE == OSTREE_REPO_MODE_ARCHIVE_Z2);
|
||||
G_STATIC_ASSERT(OSTREE_REPO_MODE_BARE_USER == 2);
|
||||
G_STATIC_ASSERT(OSTREE_REPO_MODE_BARE_USER_ONLY == 3);
|
||||
|
||||
|
|
@ -1530,7 +1531,7 @@ _ostree_loose_path (char *buf,
|
|||
buf++;
|
||||
snprintf (buf, _OSTREE_LOOSE_PATH_MAX - 2, "/%s.%s%s",
|
||||
checksum + 2, ostree_object_type_to_string (objtype),
|
||||
(!OSTREE_OBJECT_TYPE_IS_META (objtype) && mode == OSTREE_REPO_MODE_ARCHIVE_Z2) ? "z" : "");
|
||||
(!OSTREE_OBJECT_TYPE_IS_META (objtype) && mode == OSTREE_REPO_MODE_ARCHIVE) ? "z" : "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ typedef enum {
|
|||
/**
|
||||
* OstreeRepoMode:
|
||||
* @OSTREE_REPO_MODE_BARE: Files are stored as themselves; checkouts are hardlinks; can only be written as root
|
||||
* @OSTREE_REPO_MODE_ARCHIVE_Z2: Files are compressed, should be owned by non-root. Can be served via HTTP
|
||||
* @OSTREE_REPO_MODE_ARCHIVE: Files are compressed, should be owned by non-root. Can be served via HTTP. Since: 2017.12
|
||||
* @OSTREE_REPO_MODE_ARCHIVE_Z2: Legacy alias for `OSTREE_REPO_MODE_ARCHIVE`
|
||||
* @OSTREE_REPO_MODE_BARE_USER: Files are stored as themselves, except ownership; can be written by user. Hardlinks work only in user checkouts.
|
||||
* @OSTREE_REPO_MODE_BARE_USER_ONLY: Same as BARE_USER, but all metadata is not stored, so it can only be used for user checkouts. Does not need xattrs.
|
||||
*
|
||||
|
|
@ -189,7 +190,8 @@ typedef enum {
|
|||
*/
|
||||
typedef enum {
|
||||
OSTREE_REPO_MODE_BARE,
|
||||
OSTREE_REPO_MODE_ARCHIVE_Z2,
|
||||
OSTREE_REPO_MODE_ARCHIVE,
|
||||
OSTREE_REPO_MODE_ARCHIVE_Z2 = OSTREE_REPO_MODE_ARCHIVE,
|
||||
OSTREE_REPO_MODE_BARE_USER,
|
||||
OSTREE_REPO_MODE_BARE_USER_ONLY,
|
||||
} OstreeRepoMode;
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ checkout_one_file_at (OstreeRepo *repo,
|
|||
(repo_is_usermode && options->mode == OSTREE_REPO_CHECKOUT_MODE_USER);
|
||||
gboolean current_can_cache = (options->enable_uncompressed_cache
|
||||
&& current_repo->enable_uncompressed_cache);
|
||||
gboolean is_archive_z2_with_cache = (current_repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
|
||||
gboolean is_archive_z2_with_cache = (current_repo->mode == OSTREE_REPO_MODE_ARCHIVE
|
||||
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_USER
|
||||
&& current_can_cache);
|
||||
|
||||
|
|
@ -608,7 +608,7 @@ checkout_one_file_at (OstreeRepo *repo,
|
|||
&& !is_whiteout
|
||||
&& !is_symlink
|
||||
&& need_copy
|
||||
&& repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
|
||||
&& repo->mode == OSTREE_REPO_MODE_ARCHIVE
|
||||
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_USER)
|
||||
{
|
||||
HardlinkResult hardlink_res = HARDLINK_RESULT_NOT_SUPPORTED;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ commit_loose_regfile_object (OstreeRepo *self,
|
|||
/* We may be writing as root to a non-root-owned repository; if so,
|
||||
* automatically inherit the non-root ownership.
|
||||
*/
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE
|
||||
&& self->target_owner_uid != -1)
|
||||
{
|
||||
if (fchown (tmpf->fd, self->target_owner_uid, self->target_owner_gid) < 0)
|
||||
|
|
@ -603,7 +603,7 @@ write_content_object (OstreeRepo *self,
|
|||
cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
else if (repo_mode != OSTREE_REPO_MODE_ARCHIVE_Z2)
|
||||
else if (repo_mode != OSTREE_REPO_MODE_ARCHIVE)
|
||||
{
|
||||
if (!create_regular_tmpfile_linkable_with_content (self, size, file_input,
|
||||
&tmpf, cancellable, error))
|
||||
|
|
@ -616,7 +616,7 @@ write_content_object (OstreeRepo *self,
|
|||
g_autoptr(GOutputStream) compressed_out_stream = NULL;
|
||||
g_autoptr(GOutputStream) temp_out = NULL;
|
||||
|
||||
g_assert (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2);
|
||||
g_assert (repo_mode == OSTREE_REPO_MODE_ARCHIVE);
|
||||
|
||||
if (self->generate_sizes)
|
||||
indexable = TRUE;
|
||||
|
|
@ -932,7 +932,7 @@ scan_one_loose_devino (OstreeRepo *self,
|
|||
gboolean skip;
|
||||
switch (self->mode)
|
||||
{
|
||||
case OSTREE_REPO_MODE_ARCHIVE_Z2:
|
||||
case OSTREE_REPO_MODE_ARCHIVE:
|
||||
case OSTREE_REPO_MODE_BARE:
|
||||
case OSTREE_REPO_MODE_BARE_USER:
|
||||
case OSTREE_REPO_MODE_BARE_USER_ONLY:
|
||||
|
|
@ -981,7 +981,7 @@ scan_loose_devino (OstreeRepo *self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE)
|
||||
{
|
||||
if (!scan_one_loose_devino (self, self->uncompressed_objects_dir_fd, devino_cache,
|
||||
cancellable, error))
|
||||
|
|
|
|||
|
|
@ -1029,7 +1029,7 @@ content_fetch_on_complete (GObject *object,
|
|||
* the content rather than paying the cost of exploding it, checksumming, and
|
||||
* re-gzip.
|
||||
*/
|
||||
if (pull_data->is_mirror && pull_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
|
||||
if (pull_data->is_mirror && pull_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE
|
||||
&& !pull_data->is_bareuseronly_files)
|
||||
{
|
||||
gboolean have_object;
|
||||
|
|
@ -3529,7 +3529,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
&pull_data->has_tombstone_commits, error))
|
||||
goto out;
|
||||
|
||||
if (pull_data->remote_mode != OSTREE_REPO_MODE_ARCHIVE_Z2)
|
||||
if (pull_data->remote_mode != OSTREE_REPO_MODE_ARCHIVE)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Can't pull from archives with mode \"%s\"",
|
||||
|
|
@ -3550,7 +3550,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
|||
}
|
||||
|
||||
/* We can't use static deltas if pulling into an archive repo. */
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE)
|
||||
{
|
||||
if (pull_data->require_static_deltas)
|
||||
{
|
||||
|
|
@ -4894,7 +4894,7 @@ find_remotes_cb (GObject *obj,
|
|||
if (commit_metadata->timestamp != 0)
|
||||
continue;
|
||||
|
||||
_ostree_loose_path (buf, commit_metadata->checksum, OSTREE_OBJECT_TYPE_COMMIT, OSTREE_REPO_MODE_ARCHIVE_Z2);
|
||||
_ostree_loose_path (buf, commit_metadata->checksum, OSTREE_OBJECT_TYPE_COMMIT, OSTREE_REPO_MODE_ARCHIVE);
|
||||
commit_filename = g_build_filename ("objects", buf, NULL);
|
||||
|
||||
/* For each of the remotes whose summary files contain this ref, try
|
||||
|
|
|
|||
|
|
@ -1749,7 +1749,8 @@ ostree_repo_mode_to_string (OstreeRepoMode mode,
|
|||
case OSTREE_REPO_MODE_BARE_USER_ONLY:
|
||||
ret_mode = "bare-user-only";
|
||||
break;
|
||||
case OSTREE_REPO_MODE_ARCHIVE_Z2:
|
||||
case OSTREE_REPO_MODE_ARCHIVE:
|
||||
/* Legacy alias */
|
||||
ret_mode ="archive-z2";
|
||||
break;
|
||||
default:
|
||||
|
|
@ -1775,7 +1776,7 @@ ostree_repo_mode_from_string (const char *mode,
|
|||
ret_mode = OSTREE_REPO_MODE_BARE_USER_ONLY;
|
||||
else if (strcmp (mode, "archive-z2") == 0 ||
|
||||
strcmp (mode, "archive") == 0)
|
||||
ret_mode = OSTREE_REPO_MODE_ARCHIVE_Z2;
|
||||
ret_mode = OSTREE_REPO_MODE_ARCHIVE;
|
||||
else
|
||||
return glnx_throw (error, "Invalid mode '%s' in repository configuration", mode);
|
||||
|
||||
|
|
@ -2473,7 +2474,7 @@ ostree_repo_open (OstreeRepo *self,
|
|||
return FALSE;
|
||||
|
||||
/* TODO - delete this */
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2 && self->enable_uncompressed_cache)
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE && self->enable_uncompressed_cache)
|
||||
{
|
||||
if (!glnx_shutil_mkdir_p_at (self->repo_dir_fd, "uncompressed-objects-cache", 0755,
|
||||
cancellable, error))
|
||||
|
|
@ -2724,7 +2725,7 @@ list_loose_objects_at (OstreeRepo *self,
|
|||
continue;
|
||||
|
||||
OstreeObjectType objtype;
|
||||
if ((self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
|
||||
if ((self->mode == OSTREE_REPO_MODE_ARCHIVE
|
||||
&& strcmp (dot, ".filez") == 0) ||
|
||||
((_ostree_repo_mode_is_bare (self->mode))
|
||||
&& strcmp (dot, ".file") == 0))
|
||||
|
|
@ -3150,7 +3151,7 @@ ostree_repo_load_file (OstreeRepo *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
|
||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE)
|
||||
return repo_load_file_archive (self, checksum, out_input, out_file_info, out_xattrs,
|
||||
cancellable, error);
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue