Add an archive-z repository mode
This is where loose content objects are stored as one compressed file, instead of the two separate ones for regular archive mode. This mode would be suitable for HTTP servers, beause only one HTTP request is necessary, and the result would be compressed.
This commit is contained in:
parent
35a1ff51d0
commit
40ce43036f
|
|
@ -471,6 +471,34 @@ ostree_content_stream_parse (GInputStream *input,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
ostree_zlib_content_stream_open (GInputStream *input,
|
||||||
|
guint64 *out_len,
|
||||||
|
GInputStream **out_uncompressed,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
guint64 uncompressed_len;
|
||||||
|
ot_lobj GConverter *zlib_decomp = NULL;
|
||||||
|
ot_lobj GInputStream *uncomp_input = NULL;
|
||||||
|
|
||||||
|
if (!g_input_stream_read_all (input, &uncompressed_len, sizeof (guint64),
|
||||||
|
NULL, cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
uncompressed_len = GUINT64_FROM_BE (uncompressed_len);
|
||||||
|
zlib_decomp = (GConverter*)g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW);
|
||||||
|
uncomp_input = g_converter_input_stream_new (input, zlib_decomp);
|
||||||
|
|
||||||
|
if (out_len)
|
||||||
|
*out_len = uncompressed_len;
|
||||||
|
ot_transfer_out_value (out_uncompressed, &uncomp_input);
|
||||||
|
ret = TRUE;
|
||||||
|
out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ostree_content_file_parse (GFile *content_path,
|
ostree_content_file_parse (GFile *content_path,
|
||||||
gboolean trusted,
|
gboolean trusted,
|
||||||
|
|
@ -909,8 +937,9 @@ ostree_checksum_bytes_peek (GVariant *bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
ostree_get_relative_object_path (const char *checksum,
|
ostree_get_relative_object_path (const char *checksum,
|
||||||
OstreeObjectType type)
|
OstreeObjectType type,
|
||||||
|
gboolean compressed)
|
||||||
{
|
{
|
||||||
GString *path;
|
GString *path;
|
||||||
|
|
||||||
|
|
@ -923,6 +952,8 @@ ostree_get_relative_object_path (const char *checksum,
|
||||||
g_string_append (path, checksum + 2);
|
g_string_append (path, checksum + 2);
|
||||||
g_string_append_c (path, '.');
|
g_string_append_c (path, '.');
|
||||||
g_string_append (path, ostree_object_type_to_string (type));
|
g_string_append (path, ostree_object_type_to_string (type));
|
||||||
|
if (!OSTREE_OBJECT_TYPE_IS_META (type) && compressed)
|
||||||
|
g_string_append (path, "z");
|
||||||
|
|
||||||
return g_string_free (path, FALSE);
|
return g_string_free (path, FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ void ostree_object_from_string (const char *str,
|
||||||
OstreeObjectType *out_objtype);
|
OstreeObjectType *out_objtype);
|
||||||
|
|
||||||
char *ostree_get_relative_object_path (const char *checksum,
|
char *ostree_get_relative_object_path (const char *checksum,
|
||||||
OstreeObjectType type);
|
OstreeObjectType type,
|
||||||
|
gboolean compressed);
|
||||||
|
|
||||||
char *ostree_get_relative_archive_content_path (const char *checksum);
|
char *ostree_get_relative_archive_content_path (const char *checksum);
|
||||||
|
|
||||||
|
|
@ -169,6 +170,12 @@ ostree_content_stream_parse (GInputStream *input,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
gboolean ostree_zlib_content_stream_open (GInputStream *input,
|
||||||
|
guint64 *out_len,
|
||||||
|
GInputStream **out_uncompressed,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
gboolean ostree_content_file_parse (GFile *content_path,
|
gboolean ostree_content_file_parse (GFile *content_path,
|
||||||
gboolean trusted,
|
gboolean trusted,
|
||||||
GInputStream **out_input,
|
GInputStream **out_input,
|
||||||
|
|
|
||||||
|
|
@ -582,6 +582,8 @@ ostree_repo_mode_from_string (const char *mode,
|
||||||
ret_mode = OSTREE_REPO_MODE_BARE;
|
ret_mode = OSTREE_REPO_MODE_BARE;
|
||||||
else if (strcmp (mode, "archive") == 0)
|
else if (strcmp (mode, "archive") == 0)
|
||||||
ret_mode = OSTREE_REPO_MODE_ARCHIVE;
|
ret_mode = OSTREE_REPO_MODE_ARCHIVE;
|
||||||
|
else if (strcmp (mode, "archive-z") == 0)
|
||||||
|
ret_mode = OSTREE_REPO_MODE_ARCHIVE_Z;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
|
@ -837,6 +839,7 @@ stage_object (OstreeRepo *self,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
const char *actual_checksum;
|
const char *actual_checksum;
|
||||||
gboolean do_commit;
|
gboolean do_commit;
|
||||||
|
OstreeRepoMode repo_mode;
|
||||||
ot_lobj GFileInfo *temp_info = NULL;
|
ot_lobj GFileInfo *temp_info = NULL;
|
||||||
ot_lobj GFile *temp_file = NULL;
|
ot_lobj GFile *temp_file = NULL;
|
||||||
ot_lobj GFile *raw_temp_file = NULL;
|
ot_lobj GFile *raw_temp_file = NULL;
|
||||||
|
|
@ -863,6 +866,8 @@ stage_object (OstreeRepo *self,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repo_mode = ostree_repo_get_mode (self);
|
||||||
|
|
||||||
if (out_csum)
|
if (out_csum)
|
||||||
{
|
{
|
||||||
checksum = g_checksum_new (G_CHECKSUM_SHA256);
|
checksum = g_checksum_new (G_CHECKSUM_SHA256);
|
||||||
|
|
@ -870,7 +875,40 @@ stage_object (OstreeRepo *self,
|
||||||
checksum_input = ostree_checksum_input_stream_new (input, checksum);
|
checksum_input = ostree_checksum_input_stream_new (input, checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objtype == OSTREE_OBJECT_TYPE_FILE)
|
if (objtype == OSTREE_OBJECT_TYPE_FILE
|
||||||
|
&& repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z)
|
||||||
|
{
|
||||||
|
gssize bytes_written;
|
||||||
|
guint64 len_be;
|
||||||
|
ot_lobj GOutputStream *raw_out_stream = NULL;
|
||||||
|
ot_lobj GConverter *zlib_compressor = NULL;
|
||||||
|
ot_lobj GOutputStream *compressed_out_stream = NULL;
|
||||||
|
|
||||||
|
if (!ostree_create_temp_regular_file (self->tmp_dir,
|
||||||
|
ostree_object_type_to_string (objtype), NULL,
|
||||||
|
&temp_file, &raw_out_stream,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
len_be = GUINT64_TO_BE (file_object_length);
|
||||||
|
if (!g_output_stream_write_all (raw_out_stream, (const guchar*) &len_be,
|
||||||
|
sizeof (guint64), NULL, cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
zlib_compressor = (GConverter*)g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_RAW, 9);
|
||||||
|
compressed_out_stream = g_converter_output_stream_new (raw_out_stream, zlib_compressor);
|
||||||
|
|
||||||
|
bytes_written = g_output_stream_splice (compressed_out_stream,
|
||||||
|
checksum_input ? (GInputStream*)checksum_input : input,
|
||||||
|
G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||||
|
cancellable, error);
|
||||||
|
if (bytes_written < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
staged_raw_file = TRUE;
|
||||||
|
temp_file_is_regular = TRUE;
|
||||||
|
}
|
||||||
|
else if (objtype == OSTREE_OBJECT_TYPE_FILE)
|
||||||
{
|
{
|
||||||
ot_lobj GInputStream *file_input = NULL;
|
ot_lobj GInputStream *file_input = NULL;
|
||||||
ot_lobj GFileInfo *file_info = NULL;
|
ot_lobj GFileInfo *file_info = NULL;
|
||||||
|
|
@ -884,7 +922,7 @@ stage_object (OstreeRepo *self,
|
||||||
|
|
||||||
temp_file_is_regular = g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR;
|
temp_file_is_regular = g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR;
|
||||||
|
|
||||||
if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_BARE)
|
if (repo_mode == OSTREE_REPO_MODE_BARE)
|
||||||
{
|
{
|
||||||
if (!ostree_create_temp_file_from_input (self->tmp_dir,
|
if (!ostree_create_temp_file_from_input (self->tmp_dir,
|
||||||
ostree_object_type_to_string (objtype), NULL,
|
ostree_object_type_to_string (objtype), NULL,
|
||||||
|
|
@ -894,7 +932,7 @@ stage_object (OstreeRepo *self,
|
||||||
goto out;
|
goto out;
|
||||||
staged_raw_file = TRUE;
|
staged_raw_file = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else if (repo_mode == OSTREE_REPO_MODE_ARCHIVE)
|
||||||
{
|
{
|
||||||
ot_lvariant GVariant *file_meta = NULL;
|
ot_lvariant GVariant *file_meta = NULL;
|
||||||
ot_lobj GInputStream *file_meta_input = NULL;
|
ot_lobj GInputStream *file_meta_input = NULL;
|
||||||
|
|
@ -947,6 +985,8 @@ stage_object (OstreeRepo *self,
|
||||||
staged_archive_file = TRUE;
|
staged_archive_file = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1127,6 +1167,7 @@ scan_loose_devino (OstreeRepo *self,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GError *temp_error = NULL;
|
GError *temp_error = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
OstreeRepoMode repo_mode;
|
||||||
ot_lptrarray GPtrArray *object_dirs = NULL;
|
ot_lptrarray GPtrArray *object_dirs = NULL;
|
||||||
ot_lobj GFile *objdir = NULL;
|
ot_lobj GFile *objdir = NULL;
|
||||||
|
|
||||||
|
|
@ -1136,6 +1177,10 @@ scan_loose_devino (OstreeRepo *self,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repo_mode = ostree_repo_get_mode (self);
|
||||||
|
if (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
if (!get_loose_object_dirs (self, &object_dirs, cancellable, error))
|
if (!get_loose_object_dirs (self, &object_dirs, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
@ -1172,9 +1217,9 @@ scan_loose_devino (OstreeRepo *self,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE
|
if (!((repo_mode == OSTREE_REPO_MODE_ARCHIVE
|
||||||
&& g_str_has_suffix (name, ".filecontent"))
|
&& g_str_has_suffix (name, ".filecontent"))
|
||||||
|| (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_BARE
|
|| (repo_mode == OSTREE_REPO_MODE_BARE
|
||||||
&& g_str_has_suffix (name, ".file"))))
|
&& g_str_has_suffix (name, ".file"))))
|
||||||
{
|
{
|
||||||
g_clear_object (&file_info);
|
g_clear_object (&file_info);
|
||||||
|
|
@ -1358,14 +1403,17 @@ stage_directory_meta (OstreeRepo *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
GFile *
|
GFile *
|
||||||
ostree_repo_get_object_path (OstreeRepo *self,
|
ostree_repo_get_object_path (OstreeRepo *self,
|
||||||
const char *checksum,
|
const char *checksum,
|
||||||
OstreeObjectType type)
|
OstreeObjectType type)
|
||||||
{
|
{
|
||||||
char *relpath;
|
char *relpath;
|
||||||
GFile *ret;
|
GFile *ret;
|
||||||
|
gboolean compressed;
|
||||||
|
|
||||||
relpath = ostree_get_relative_object_path (checksum, type);
|
compressed = (type == OSTREE_OBJECT_TYPE_FILE
|
||||||
|
&& ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE_Z);
|
||||||
|
relpath = ostree_get_relative_object_path (checksum, type, compressed);
|
||||||
ret = g_file_resolve_relative_path (self->repodir, relpath);
|
ret = g_file_resolve_relative_path (self->repodir, relpath);
|
||||||
g_free (relpath);
|
g_free (relpath);
|
||||||
|
|
||||||
|
|
@ -1572,7 +1620,8 @@ ostree_repo_write_ref (OstreeRepo *self,
|
||||||
if (!write_checksum_file (dir, name, rev, error))
|
if (!write_checksum_file (dir, name, rev, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (self->mode == OSTREE_REPO_MODE_ARCHIVE)
|
if (self->mode == OSTREE_REPO_MODE_ARCHIVE
|
||||||
|
|| self->mode == OSTREE_REPO_MODE_ARCHIVE_Z)
|
||||||
{
|
{
|
||||||
if (!write_ref_summary (self, NULL, error))
|
if (!write_ref_summary (self, NULL, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -2483,6 +2532,7 @@ ostree_repo_load_file (OstreeRepo *self,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
OstreeRepoMode repo_mode;
|
||||||
ot_lvariant GVariant *file_data = NULL;
|
ot_lvariant GVariant *file_data = NULL;
|
||||||
ot_lobj GFile *loose_path = NULL;
|
ot_lobj GFile *loose_path = NULL;
|
||||||
ot_lobj GFileInfo *content_loose_info = NULL;
|
ot_lobj GFileInfo *content_loose_info = NULL;
|
||||||
|
|
@ -2494,65 +2544,92 @@ ostree_repo_load_file (OstreeRepo *self,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
repo_mode = ostree_repo_get_mode (self);
|
||||||
|
|
||||||
if (loose_path)
|
if (loose_path)
|
||||||
{
|
{
|
||||||
if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE)
|
switch (repo_mode)
|
||||||
{
|
{
|
||||||
ot_lvariant GVariant *archive_meta = NULL;
|
case OSTREE_REPO_MODE_ARCHIVE:
|
||||||
|
{
|
||||||
|
ot_lvariant GVariant *archive_meta = NULL;
|
||||||
|
|
||||||
if (!ot_util_variant_map (loose_path, OSTREE_FILE_HEADER_GVARIANT_FORMAT,
|
if (!ot_util_variant_map (loose_path, OSTREE_FILE_HEADER_GVARIANT_FORMAT,
|
||||||
TRUE, &archive_meta, error))
|
TRUE, &archive_meta, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!ostree_file_header_parse (archive_meta, &ret_file_info, &ret_xattrs,
|
if (!ostree_file_header_parse (archive_meta, &ret_file_info, &ret_xattrs,
|
||||||
error))
|
error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR)
|
if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR)
|
||||||
{
|
{
|
||||||
ot_lobj GFile *archive_content_path = NULL;
|
ot_lobj GFile *archive_content_path = NULL;
|
||||||
ot_lobj GFileInfo *content_info = NULL;
|
ot_lobj GFileInfo *content_info = NULL;
|
||||||
|
|
||||||
archive_content_path = ostree_repo_get_archive_content_path (self, checksum);
|
archive_content_path = ostree_repo_get_archive_content_path (self, checksum);
|
||||||
content_info = g_file_query_info (archive_content_path, OSTREE_GIO_FAST_QUERYINFO,
|
content_info = g_file_query_info (archive_content_path, OSTREE_GIO_FAST_QUERYINFO,
|
||||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||||
cancellable, error);
|
cancellable, error);
|
||||||
if (!content_info)
|
if (!content_info)
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (out_input)
|
|
||||||
{
|
|
||||||
ret_input = (GInputStream*)g_file_read (archive_content_path, cancellable, error);
|
|
||||||
if (!ret_input)
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
g_file_info_set_size (ret_file_info, g_file_info_get_size (content_info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret_file_info = g_file_query_info (loose_path, OSTREE_GIO_FAST_QUERYINFO,
|
|
||||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
|
||||||
cancellable, error);
|
|
||||||
if (!ret_file_info)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (out_xattrs)
|
|
||||||
{
|
|
||||||
if (!ostree_get_xattrs_for_file (loose_path, &ret_xattrs,
|
|
||||||
cancellable, error))
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (out_input && g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR)
|
|
||||||
{
|
|
||||||
ret_input = (GInputStream*) g_file_read (loose_path, cancellable, error);
|
|
||||||
if (!ret_input)
|
|
||||||
{
|
|
||||||
g_prefix_error (error, "Error opening loose file object %s: ", ot_gfile_get_path_cached (loose_path));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
}
|
if (out_input)
|
||||||
|
{
|
||||||
|
ret_input = (GInputStream*)g_file_read (archive_content_path, cancellable, error);
|
||||||
|
if (!ret_input)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
g_file_info_set_size (ret_file_info, g_file_info_get_size (content_info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OSTREE_REPO_MODE_ARCHIVE_Z:
|
||||||
|
{
|
||||||
|
ot_lobj GInputStream *file_in = NULL;
|
||||||
|
ot_lobj GInputStream *uncomp_input = NULL;
|
||||||
|
guint64 uncompressed_len;
|
||||||
|
|
||||||
|
file_in = (GInputStream*)g_file_read (loose_path, cancellable, error);
|
||||||
|
if (!file_in)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (!ostree_zlib_content_stream_open (file_in, &uncompressed_len, &uncomp_input,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (!ostree_content_stream_parse (uncomp_input, uncompressed_len, TRUE,
|
||||||
|
&ret_input, &ret_file_info, &ret_xattrs,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OSTREE_REPO_MODE_BARE:
|
||||||
|
{
|
||||||
|
ret_file_info = g_file_query_info (loose_path, OSTREE_GIO_FAST_QUERYINFO,
|
||||||
|
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||||
|
cancellable, error);
|
||||||
|
if (!ret_file_info)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (out_xattrs)
|
||||||
|
{
|
||||||
|
if (!ostree_get_xattrs_for_file (loose_path, &ret_xattrs,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out_input && g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_REGULAR)
|
||||||
|
{
|
||||||
|
ret_input = (GInputStream*) g_file_read (loose_path, cancellable, error);
|
||||||
|
if (!ret_input)
|
||||||
|
{
|
||||||
|
g_prefix_error (error, "Error opening loose file object %s: ", ot_gfile_get_path_cached (loose_path));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (self->parent_repo)
|
else if (self->parent_repo)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@ GFile * ostree_repo_get_path (OstreeRepo *self);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OSTREE_REPO_MODE_BARE,
|
OSTREE_REPO_MODE_BARE,
|
||||||
OSTREE_REPO_MODE_ARCHIVE
|
OSTREE_REPO_MODE_ARCHIVE,
|
||||||
|
OSTREE_REPO_MODE_ARCHIVE_Z
|
||||||
} OstreeRepoMode;
|
} OstreeRepoMode;
|
||||||
|
|
||||||
gboolean ostree_repo_mode_from_string (const char *mode,
|
gboolean ostree_repo_mode_from_string (const char *mode,
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ static GOptionEntry options[] = {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
OstreeRepo *repo;
|
OstreeRepo *repo;
|
||||||
char *remote_name;
|
char *remote_name;
|
||||||
|
OstreeRepoMode remote_mode;
|
||||||
OstreeFetcher *fetcher;
|
OstreeFetcher *fetcher;
|
||||||
SoupURI *base_uri;
|
SoupURI *base_uri;
|
||||||
|
|
||||||
|
|
@ -332,7 +333,8 @@ fetch_loose_object (OtPullData *pull_data,
|
||||||
ot_lobj GFile *ret_temp_path = NULL;
|
ot_lobj GFile *ret_temp_path = NULL;
|
||||||
SoupURI *obj_uri = NULL;
|
SoupURI *obj_uri = NULL;
|
||||||
|
|
||||||
objpath = ostree_get_relative_object_path (checksum, objtype);
|
objpath = ostree_get_relative_object_path (checksum, objtype,
|
||||||
|
pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z);
|
||||||
obj_uri = suburi_new (pull_data->base_uri, objpath, NULL);
|
obj_uri = suburi_new (pull_data->base_uri, objpath, NULL);
|
||||||
|
|
||||||
if (!fetch_uri (pull_data, obj_uri, ostree_object_type_to_string (objtype), &ret_temp_path,
|
if (!fetch_uri (pull_data, obj_uri, ostree_object_type_to_string (objtype), &ret_temp_path,
|
||||||
|
|
@ -639,6 +641,7 @@ content_fetch_on_checksum_complete (GObject *object,
|
||||||
GError **error = &local_error;
|
GError **error = &local_error;
|
||||||
guint64 length;
|
guint64 length;
|
||||||
GCancellable *cancellable = NULL;
|
GCancellable *cancellable = NULL;
|
||||||
|
gboolean compressed;
|
||||||
ot_lfree guchar *csum;
|
ot_lfree guchar *csum;
|
||||||
ot_lvariant GVariant *file_meta = NULL;
|
ot_lvariant GVariant *file_meta = NULL;
|
||||||
ot_lobj GFileInfo *file_info = NULL;
|
ot_lobj GFileInfo *file_info = NULL;
|
||||||
|
|
@ -651,25 +654,6 @@ content_fetch_on_checksum_complete (GObject *object,
|
||||||
if (!csum)
|
if (!csum)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!ot_util_variant_map (data->meta_path, OSTREE_FILE_HEADER_GVARIANT_FORMAT, FALSE,
|
|
||||||
&file_meta, error))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (!ostree_file_header_parse (file_meta, &file_info, &xattrs, error))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (data->content_path)
|
|
||||||
{
|
|
||||||
content_input = (GInputStream*)g_file_read (data->content_path, cancellable, error);
|
|
||||||
if (!content_input)
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ostree_raw_file_to_content_stream (content_input, file_info, xattrs,
|
|
||||||
&file_object_input, &length,
|
|
||||||
cancellable, error))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
checksum = ostree_checksum_from_bytes (csum);
|
checksum = ostree_checksum_from_bytes (csum);
|
||||||
|
|
||||||
if (strcmp (checksum, data->checksum) != 0)
|
if (strcmp (checksum, data->checksum) != 0)
|
||||||
|
|
@ -680,6 +664,39 @@ content_fetch_on_checksum_complete (GObject *object,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compressed = data->pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
|
||||||
|
|
||||||
|
if (compressed)
|
||||||
|
{
|
||||||
|
content_input = (GInputStream*)g_file_read (data->content_path, cancellable, error);
|
||||||
|
if (!content_input)
|
||||||
|
goto out;
|
||||||
|
if (!ostree_zlib_content_stream_open (content_input, &length, &file_object_input,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ot_util_variant_map (data->meta_path, OSTREE_FILE_HEADER_GVARIANT_FORMAT, TRUE,
|
||||||
|
&file_meta, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (!ostree_file_header_parse (file_meta, &file_info, &xattrs, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (data->content_path)
|
||||||
|
{
|
||||||
|
content_input = (GInputStream*)g_file_read (data->content_path, cancellable, error);
|
||||||
|
if (!content_input)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ostree_raw_file_to_content_stream (content_input, file_info, xattrs,
|
||||||
|
&file_object_input, &length,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ostree_repo_stage_content_trusted (data->pull_data->repo, checksum,
|
if (!ostree_repo_stage_content_trusted (data->pull_data->repo, checksum,
|
||||||
file_object_input, length,
|
file_object_input, length,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
|
|
@ -702,6 +719,7 @@ content_fetch_on_complete (GObject *object,
|
||||||
OtFetchOneContentItemData *data = user_data;
|
OtFetchOneContentItemData *data = user_data;
|
||||||
GError *local_error = NULL;
|
GError *local_error = NULL;
|
||||||
GError **error = &local_error;
|
GError **error = &local_error;
|
||||||
|
gboolean compressed;
|
||||||
GCancellable *cancellable = NULL;
|
GCancellable *cancellable = NULL;
|
||||||
gboolean was_content_fetch = FALSE;
|
gboolean was_content_fetch = FALSE;
|
||||||
gboolean need_content_fetch = FALSE;
|
gboolean need_content_fetch = FALSE;
|
||||||
|
|
@ -711,6 +729,7 @@ content_fetch_on_complete (GObject *object,
|
||||||
ot_lobj GInputStream *file_object_input = NULL;
|
ot_lobj GInputStream *file_object_input = NULL;
|
||||||
ot_lvariant GVariant *xattrs = NULL;
|
ot_lvariant GVariant *xattrs = NULL;
|
||||||
|
|
||||||
|
compressed = data->pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
|
||||||
was_content_fetch = data->fetching_content;
|
was_content_fetch = data->fetching_content;
|
||||||
|
|
||||||
if (was_content_fetch)
|
if (was_content_fetch)
|
||||||
|
|
@ -752,7 +771,25 @@ content_fetch_on_complete (GObject *object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!need_content_fetch)
|
if (!need_content_fetch && compressed)
|
||||||
|
{
|
||||||
|
ot_lobj GInputStream *uncomp_input = NULL;
|
||||||
|
guint64 uncompressed_len;
|
||||||
|
|
||||||
|
g_assert (data->content_path != NULL);
|
||||||
|
content_input = (GInputStream*)g_file_read (data->content_path, cancellable, error);
|
||||||
|
if (!content_input)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (!ostree_zlib_content_stream_open (content_input, &uncompressed_len, &uncomp_input,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
data->pull_data->outstanding_checksum_requests++;
|
||||||
|
ot_gio_checksum_stream_async (uncomp_input, G_PRIORITY_DEFAULT, NULL,
|
||||||
|
content_fetch_on_checksum_complete, data);
|
||||||
|
}
|
||||||
|
else if (!need_content_fetch)
|
||||||
{
|
{
|
||||||
if (data->content_path)
|
if (data->content_path)
|
||||||
{
|
{
|
||||||
|
|
@ -806,20 +843,24 @@ enqueue_loose_meta_requests (OtPullData *pull_data)
|
||||||
ot_lfree char *objpath = NULL;
|
ot_lfree char *objpath = NULL;
|
||||||
SoupURI *obj_uri = NULL;
|
SoupURI *obj_uri = NULL;
|
||||||
OtFetchOneContentItemData *one_item_data;
|
OtFetchOneContentItemData *one_item_data;
|
||||||
|
gboolean compressed = pull_data->remote_mode == OSTREE_REPO_MODE_ARCHIVE_Z;
|
||||||
|
|
||||||
one_item_data = g_new0 (OtFetchOneContentItemData, 1);
|
one_item_data = g_new0 (OtFetchOneContentItemData, 1);
|
||||||
one_item_data->pull_data = pull_data;
|
one_item_data->pull_data = pull_data;
|
||||||
one_item_data->checksum = g_strdup (checksum);
|
one_item_data->checksum = g_strdup (checksum);
|
||||||
one_item_data->fetching_content = FALSE;
|
one_item_data->fetching_content = compressed;
|
||||||
|
|
||||||
objpath = ostree_get_relative_object_path (checksum, OSTREE_OBJECT_TYPE_FILE);
|
objpath = ostree_get_relative_object_path (checksum, OSTREE_OBJECT_TYPE_FILE, compressed);
|
||||||
obj_uri = suburi_new (pull_data->base_uri, objpath, NULL);
|
obj_uri = suburi_new (pull_data->base_uri, objpath, NULL);
|
||||||
|
|
||||||
ostree_fetcher_request_uri_async (pull_data->fetcher, obj_uri, cancellable,
|
ostree_fetcher_request_uri_async (pull_data->fetcher, obj_uri, cancellable,
|
||||||
content_fetch_on_complete, one_item_data);
|
content_fetch_on_complete, one_item_data);
|
||||||
soup_uri_free (obj_uri);
|
soup_uri_free (obj_uri);
|
||||||
|
|
||||||
pull_data->outstanding_filemeta_requests++;
|
if (compressed)
|
||||||
|
pull_data->outstanding_filecontent_requests++;
|
||||||
|
else
|
||||||
|
pull_data->outstanding_filemeta_requests++;
|
||||||
g_hash_table_iter_remove (&hash_iter);
|
g_hash_table_iter_remove (&hash_iter);
|
||||||
|
|
||||||
/* Don't let too many requests queue up; when we're fetching
|
/* Don't let too many requests queue up; when we're fetching
|
||||||
|
|
@ -1026,9 +1067,9 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
|
||||||
gpointer key, value;
|
gpointer key, value;
|
||||||
int i;
|
int i;
|
||||||
GCancellable *cancellable = NULL;
|
GCancellable *cancellable = NULL;
|
||||||
OstreeRepoMode remote_repo_mode;
|
|
||||||
ot_lfree char *remote_key = NULL;
|
ot_lfree char *remote_key = NULL;
|
||||||
ot_lobj OstreeRepo *repo = NULL;
|
ot_lobj OstreeRepo *repo = NULL;
|
||||||
|
ot_lfree char *remote_config_content = NULL;
|
||||||
ot_lfree char *path = NULL;
|
ot_lfree char *path = NULL;
|
||||||
ot_lfree char *baseurl = NULL;
|
ot_lfree char *baseurl = NULL;
|
||||||
ot_lfree char *summary_data = NULL;
|
ot_lfree char *summary_data = NULL;
|
||||||
|
|
@ -1094,12 +1135,13 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
|
||||||
&remote_mode_str, error))
|
&remote_mode_str, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!ostree_repo_mode_from_string (remote_mode_str, &remote_repo_mode, error))
|
if (!ostree_repo_mode_from_string (remote_mode_str, &pull_data->remote_mode, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
switch (remote_repo_mode)
|
switch (pull_data->remote_mode)
|
||||||
{
|
{
|
||||||
case OSTREE_REPO_MODE_ARCHIVE:
|
case OSTREE_REPO_MODE_ARCHIVE:
|
||||||
|
case OSTREE_REPO_MODE_ARCHIVE_Z:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,12 @@
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
static gboolean archive;
|
static gboolean opt_archive;
|
||||||
|
static char *opt_mode = NULL;
|
||||||
|
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{ "archive", 0, 0, G_OPTION_ARG_NONE, &archive, "Initialize repository as archive", NULL },
|
{ "archive", 0, 0, G_OPTION_ARG_NONE, &opt_archive, "Initialize repository as archive", NULL },
|
||||||
|
{ "mode", 0, 0, G_OPTION_ARG_STRING, &opt_mode, "Initialize repository in given mode (bare, archive, archive-z)", NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -44,6 +46,7 @@ ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error)
|
||||||
GOptionContext *context = NULL;
|
GOptionContext *context = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
__attribute__ ((unused)) GCancellable *cancellable = NULL;
|
__attribute__ ((unused)) GCancellable *cancellable = NULL;
|
||||||
|
const char *mode_str = "bare";
|
||||||
ot_lobj GFile *child = NULL;
|
ot_lobj GFile *child = NULL;
|
||||||
ot_lobj GFile *grandchild = NULL;
|
ot_lobj GFile *grandchild = NULL;
|
||||||
ot_lobj OstreeRepo *repo = NULL;
|
ot_lobj OstreeRepo *repo = NULL;
|
||||||
|
|
@ -58,7 +61,16 @@ ostree_builtin_init (int argc, char **argv, GFile *repo_path, GError **error)
|
||||||
child = g_file_get_child (repo_path, "config");
|
child = g_file_get_child (repo_path, "config");
|
||||||
|
|
||||||
config_data = g_string_new (DEFAULT_CONFIG_CONTENTS);
|
config_data = g_string_new (DEFAULT_CONFIG_CONTENTS);
|
||||||
g_string_append_printf (config_data, "mode=%s\n", archive ? "archive" : "bare");
|
if (opt_archive)
|
||||||
|
mode_str = "archive";
|
||||||
|
else if (opt_mode)
|
||||||
|
{
|
||||||
|
OstreeRepoMode mode;
|
||||||
|
if (!ostree_repo_mode_from_string (opt_mode, &mode, error))
|
||||||
|
goto out;
|
||||||
|
mode_str = opt_mode;
|
||||||
|
}
|
||||||
|
g_string_append_printf (config_data, "mode=%s\n", mode_str);
|
||||||
if (!g_file_replace_contents (child,
|
if (!g_file_replace_contents (child,
|
||||||
config_data->str,
|
config_data->str,
|
||||||
config_data->len,
|
config_data->len,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
$OSTREE checkout test2 checkout-test2
|
||||||
|
echo "ok checkout"
|
||||||
|
|
||||||
|
cd checkout-test2
|
||||||
|
assert_has_file firstfile
|
||||||
|
assert_has_file baz/cow
|
||||||
|
assert_file_has_content baz/cow moo
|
||||||
|
assert_has_file baz/deeper/ohyeah
|
||||||
|
echo "ok content"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
mkdir repo2
|
||||||
|
${CMD_PREFIX} ostree --repo=repo2 init
|
||||||
|
${CMD_PREFIX} ostree --repo=repo2 pull-local repo
|
||||||
|
echo "ok local clone"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
${CMD_PREFIX} ostree --repo=repo2 checkout test2 test2-checkout-from-local-clone
|
||||||
|
cd test2-checkout-from-local-clone
|
||||||
|
assert_file_has_content baz/cow moo
|
||||||
|
echo "ok local clone checkout"
|
||||||
|
|
||||||
|
$OSTREE checkout -U test2 checkout-user-test2
|
||||||
|
echo "ok user checkout"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}/checkout-test2
|
||||||
|
$OSTREE commit -b test2-uid0 -s 'UID 0 test' --owner-uid=0 --owner-gid=0
|
||||||
|
echo "ok uid0 commit"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
$OSTREE ls test2-uid0 /firstfile > uid0-ls-output.txt
|
||||||
|
assert_file_has_content uid0-ls-output.txt "-00664 0 0 6 /firstfile"
|
||||||
|
echo "ok uid0 ls"
|
||||||
|
|
||||||
|
$OSTREE checkout -U test2-uid0 checkout-user-test2-uid0
|
||||||
|
echo "ok user checkout from uid 0"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
$OSTREE cat test2 /baz/cow > cow-contents
|
||||||
|
assert_file_has_content cow-contents "moo"
|
||||||
|
echo "ok cat-file"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
$OSTREE fsck
|
||||||
|
echo "ok fsck"
|
||||||
|
|
@ -75,8 +75,8 @@ setup_test_repository () {
|
||||||
cd repo
|
cd repo
|
||||||
ot_repo="--repo=`pwd`"
|
ot_repo="--repo=`pwd`"
|
||||||
export OSTREE="${CMD_PREFIX} ostree ${ot_repo}"
|
export OSTREE="${CMD_PREFIX} ostree ${ot_repo}"
|
||||||
if test "$mode" = "archive"; then
|
if test -n "$mode"; then
|
||||||
$OSTREE init --archive
|
$OSTREE init --mode=${mode}
|
||||||
else
|
else
|
||||||
$OSTREE init
|
$OSTREE init
|
||||||
fi
|
fi
|
||||||
|
|
@ -110,11 +110,13 @@ setup_test_repository () {
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_fake_remote_repo1() {
|
setup_fake_remote_repo1() {
|
||||||
|
mode=$1
|
||||||
|
shift
|
||||||
oldpwd=`pwd`
|
oldpwd=`pwd`
|
||||||
mkdir ostree-srv
|
mkdir ostree-srv
|
||||||
cd ostree-srv
|
cd ostree-srv
|
||||||
mkdir gnomerepo
|
mkdir gnomerepo
|
||||||
${CMD_PREFIX} ostree --repo=gnomerepo init --archive
|
${CMD_PREFIX} ostree --repo=gnomerepo init --mode=$mode
|
||||||
mkdir gnomerepo-files
|
mkdir gnomerepo-files
|
||||||
cd gnomerepo-files
|
cd gnomerepo-files
|
||||||
echo first > firstfile
|
echo first > firstfile
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ echo "1..28"
|
||||||
|
|
||||||
. libtest.sh
|
. libtest.sh
|
||||||
|
|
||||||
setup_test_repository "regular"
|
setup_test_repository "bare"
|
||||||
echo "ok setup"
|
echo "ok setup"
|
||||||
|
|
||||||
$OSTREE checkout test2 checkout-test2
|
$OSTREE checkout test2 checkout-test2
|
||||||
|
|
|
||||||
|
|
@ -26,48 +26,4 @@ echo '1..11'
|
||||||
setup_test_repository "archive"
|
setup_test_repository "archive"
|
||||||
echo "ok setup"
|
echo "ok setup"
|
||||||
|
|
||||||
$OSTREE checkout test2 checkout-test2
|
. ${SRCDIR}/archive-test.sh
|
||||||
echo "ok checkout"
|
|
||||||
|
|
||||||
cd checkout-test2
|
|
||||||
assert_has_file firstfile
|
|
||||||
assert_has_file baz/cow
|
|
||||||
assert_file_has_content baz/cow moo
|
|
||||||
assert_has_file baz/deeper/ohyeah
|
|
||||||
echo "ok content"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
|
||||||
mkdir repo2
|
|
||||||
${CMD_PREFIX} ostree --repo=repo2 init
|
|
||||||
${CMD_PREFIX} ostree --repo=repo2 pull-local repo
|
|
||||||
echo "ok local clone"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
|
||||||
${CMD_PREFIX} ostree --repo=repo2 checkout test2 test2-checkout-from-local-clone
|
|
||||||
cd test2-checkout-from-local-clone
|
|
||||||
assert_file_has_content baz/cow moo
|
|
||||||
echo "ok local clone checkout"
|
|
||||||
|
|
||||||
$OSTREE checkout -U test2 checkout-user-test2
|
|
||||||
echo "ok user checkout"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}/checkout-test2
|
|
||||||
$OSTREE commit -b test2-uid0 -s 'UID 0 test' --owner-uid=0 --owner-gid=0
|
|
||||||
echo "ok uid0 commit"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
|
||||||
$OSTREE ls test2-uid0 /firstfile > uid0-ls-output.txt
|
|
||||||
assert_file_has_content uid0-ls-output.txt "-00664 0 0 6 /firstfile"
|
|
||||||
echo "ok uid0 ls"
|
|
||||||
|
|
||||||
$OSTREE checkout -U test2-uid0 checkout-user-test2-uid0
|
|
||||||
echo "ok user checkout from uid 0"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
|
||||||
$OSTREE cat test2 /baz/cow > cow-contents
|
|
||||||
assert_file_has_content cow-contents "moo"
|
|
||||||
echo "ok cat-file"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
|
||||||
$OSTREE fsck
|
|
||||||
echo "ok fsck"
|
|
||||||
|
|
|
||||||
|
|
@ -21,20 +21,9 @@ set -e
|
||||||
|
|
||||||
. libtest.sh
|
. libtest.sh
|
||||||
|
|
||||||
echo '1..2'
|
echo '1..11'
|
||||||
|
|
||||||
setup_fake_remote_repo1
|
setup_test_repository "archive-z"
|
||||||
cd ${test_tmpdir}
|
echo "ok setup"
|
||||||
mkdir repo
|
|
||||||
${CMD_PREFIX} ostree --repo=repo init
|
|
||||||
${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo
|
|
||||||
${CMD_PREFIX} ostree-pull --repo=repo origin main
|
|
||||||
${CMD_PREFIX} ostree --repo=repo fsck
|
|
||||||
echo "ok pull"
|
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
. ${SRCDIR}/archive-test.sh
|
||||||
$OSTREE checkout origin/main checkout-origin-main
|
|
||||||
cd checkout-origin-main
|
|
||||||
assert_file_has_content firstfile '^first$'
|
|
||||||
assert_file_has_content baz/cow '^moo$'
|
|
||||||
echo "ok pull contents"
|
|
||||||
|
|
@ -23,7 +23,7 @@ set -e
|
||||||
|
|
||||||
echo "1..1"
|
echo "1..1"
|
||||||
|
|
||||||
setup_test_repository "regular"
|
setup_test_repository "bare"
|
||||||
$OSTREE log test2 > $test_tmpdir/log.txt
|
$OSTREE log test2 > $test_tmpdir/log.txt
|
||||||
assert_file_has_content $test_tmpdir/log.txt "Test Commit 1"
|
assert_file_has_content $test_tmpdir/log.txt "Test Commit 1"
|
||||||
assert_file_has_content $test_tmpdir/log.txt "Test Commit 2"
|
assert_file_has_content $test_tmpdir/log.txt "Test Commit 2"
|
||||||
|
|
@ -23,7 +23,7 @@ set -e
|
||||||
|
|
||||||
echo '1..2'
|
echo '1..2'
|
||||||
|
|
||||||
setup_test_repository "regular"
|
setup_test_repository "bare"
|
||||||
$OSTREE remote add origin http://example.com/ostree/gnome
|
$OSTREE remote add origin http://example.com/ostree/gnome
|
||||||
echo "ok remote add"
|
echo "ok remote add"
|
||||||
assert_file_has_content $test_tmpdir/repo/config "example.com"
|
assert_file_has_content $test_tmpdir/repo/config "example.com"
|
||||||
|
|
@ -23,7 +23,7 @@ echo "1..1"
|
||||||
|
|
||||||
. libtest.sh
|
. libtest.sh
|
||||||
|
|
||||||
setup_test_repository "regular"
|
setup_test_repository "bare"
|
||||||
$OSTREE checkout test2 checkout-test2
|
$OSTREE checkout test2 checkout-test2
|
||||||
cd checkout-test2
|
cd checkout-test2
|
||||||
chmod o+x firstfile
|
chmod o+x firstfile
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ echo "1..7"
|
||||||
|
|
||||||
. libtest.sh
|
. libtest.sh
|
||||||
|
|
||||||
setup_test_repository "regular"
|
setup_test_repository "bare"
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
mkdir foo
|
mkdir foo
|
||||||
cd foo
|
cd foo
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue