mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-24 06:04:16 +03:00
libarchive: Support commit sizes metadata
Call the helper to set the generate_sizes boolean so that object size data is stored while writing the mtree.
This commit is contained in:
parent
291e9da258
commit
1bbe674d91
@ -348,9 +348,9 @@ content_size_cache_entry_free (gpointer entry)
|
||||
g_slice_free (OstreeContentSizeCacheEntry, entry);
|
||||
}
|
||||
|
||||
static void
|
||||
repo_setup_generate_sizes (OstreeRepo *self,
|
||||
OstreeRepoCommitModifier *modifier)
|
||||
void
|
||||
_ostree_repo_setup_generate_sizes (OstreeRepo *self,
|
||||
OstreeRepoCommitModifier *modifier)
|
||||
{
|
||||
if (modifier && modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES)
|
||||
{
|
||||
@ -3923,7 +3923,7 @@ ostree_repo_write_directory_to_mtree (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
repo_setup_generate_sizes (self, modifier);
|
||||
_ostree_repo_setup_generate_sizes (self, modifier);
|
||||
|
||||
g_autoptr(GPtrArray) path = g_ptr_array_new ();
|
||||
if (!write_directory_to_mtree_internal (self, dir, mtree, modifier, path,
|
||||
@ -3957,7 +3957,7 @@ ostree_repo_write_dfd_to_mtree (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
repo_setup_generate_sizes (self, modifier);
|
||||
_ostree_repo_setup_generate_sizes (self, modifier);
|
||||
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
if (!glnx_dirfd_iterator_init_at (dfd, path, FALSE, &dfd_iter, error))
|
||||
|
@ -844,6 +844,8 @@ ostree_repo_import_archive_to_mtree (OstreeRepo *self,
|
||||
.modifier = modifier
|
||||
};
|
||||
|
||||
_ostree_repo_setup_generate_sizes (self, modifier);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
int r = archive_read_next_header (a, &aictx.entry);
|
||||
|
@ -337,6 +337,10 @@ _ostree_repo_commit_modifier_apply (OstreeRepo *self,
|
||||
GFileInfo *file_info,
|
||||
GFileInfo **out_modified_info);
|
||||
|
||||
void
|
||||
_ostree_repo_setup_generate_sizes (OstreeRepo *self,
|
||||
OstreeRepoCommitModifier *modifier);
|
||||
|
||||
gboolean
|
||||
_ostree_repo_remote_name_is_file (const char *remote_name);
|
||||
|
||||
|
@ -28,7 +28,7 @@ fi
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo "1..17"
|
||||
echo "1..18"
|
||||
|
||||
setup_test_repository "bare"
|
||||
|
||||
@ -234,3 +234,17 @@ for filter in '^usr/bin/,usr/sbin/' '/bin/,/sbin/'; do
|
||||
assert_file_has_content usr/lib/libfoo.so 'a library'
|
||||
echo "ok tar pathname filter modification: ${filter}"
|
||||
done
|
||||
|
||||
# Test sizes metadata. This needs an archive repo, so a separate repo is used.
|
||||
cd ${test_tmpdir}
|
||||
rm -rf repo2
|
||||
ostree_repo_init repo2 --mode=archive
|
||||
${CMD_PREFIX} ostree --repo=repo2 commit \
|
||||
-s "from tar" -b test-tar \
|
||||
--generate-sizes \
|
||||
--tree=tar=foo.tar.gz
|
||||
${CMD_PREFIX} ostree --repo=repo2 show --print-sizes test-tar > sizes.txt
|
||||
assert_file_has_content sizes.txt 'Compressed size (needed/total): 0[ ]bytes/1.1[ ]kB'
|
||||
assert_file_has_content sizes.txt 'Unpacked size (needed/total): 0[ ]bytes/900[ ]bytes'
|
||||
assert_file_has_content sizes.txt 'Number of objects (needed/total): 0/12'
|
||||
echo "ok tar sizes metadata"
|
||||
|
Loading…
x
Reference in New Issue
Block a user