/* 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);
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" : "");
}
/**
/**
* 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.
*
*/
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;
(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);
&& !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;
/* 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)
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))
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;
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:
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))
* 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;
&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\"",
}
/* 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)
{
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
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:
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);
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))
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))
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