New upstream version 2022.2

This commit is contained in:
Simon McVittie committed 2022-03-07 19:15:17 +00:00
commit c27a45a449
134 files changed
+5374 -4216

No files matched your search

Binary file not shown.
+2 -1
View File
@@ -155,7 +155,8 @@ ot_test_setup_sysroot (GCancellable *cancellable,
}
/* Make sure deployments are mutable */
g_setenv ("OSTREE_SYSROOT_DEBUG", buf->str, TRUE);
if (!g_setenv ("OSTREE_SYSROOT_DEBUG", buf->str, TRUE))
return glnx_null_throw (error, "Failed to set environment variable OSTREE_SYSROOT_DEBUG");
g_autoptr(GFile) sysroot_path = g_file_new_for_path ("sysroot");
return ostree_sysroot_new (sysroot_path);
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: LGPL-2.0+
set -euo pipefail
. $(dirname $0)/libtest.sh
mode="bare-split-xattrs"
OSTREE="${CMD_PREFIX} ostree --repo=${test_tmpdir}/repo"
SUDO="sudo --non-interactive"
PRIVILEGED="false"
if [ $(id -u) -eq 0 ]; then
PRIVILEGED="true"
SUDO=""
elif $(${SUDO} -v); then
PRIVILEGED="true"
fi
cd ${test_tmpdir}
${OSTREE} init --mode "${mode}"
${OSTREE} config get core.mode > mode.txt
assert_file_has_content mode.txt "${mode}"
tap_ok "repo init"
rm -rf -- repo mode.txt
cd ${test_tmpdir}
${OSTREE} init --mode "${mode}"
${OSTREE} fsck --all
tap_ok "repo fsck"
rm -rf -- repo
cd ${test_tmpdir}
mkdir -p "${test_tmpdir}/files"
touch files/foo
${OSTREE} init --mode "${mode}"
if ${OSTREE} commit --orphan -m "not implemented" files; then
assert_not_reached "commit to bare-split-xattrs should have failed"
fi
${OSTREE} fsck --all
tap_ok "commit not implemented"
rm -rf -- repo files
cd ${test_tmpdir}
mkdir -p "${test_tmpdir}/files"
touch files/foo
${OSTREE} init --mode "${mode}"
OSTREE_EXP_WRITE_BARE_SPLIT_XATTRS=true ${OSTREE} commit --orphan -m "experimental" files
if ${OSTREE} fsck --all; then
assert_not_reached "fsck should have failed"
fi
tap_ok "commit exp override"
rm -rf -- repo files
if [ "${PRIVILEGED}" = "true" ]; then
COMMIT="d614c428015227259031b0f19b934dade908942fd71c49047e0daa70e7800a5d"
cd ${test_tmpdir}
${SUDO} tar --same-permissions --same-owner -xaf ${test_srcdir}/fixtures/bare-split-xattrs/basic.tar.xz
${SUDO} ${OSTREE} fsck --all
${OSTREE} log ${COMMIT} > out.txt
assert_file_has_content_literal out.txt "fixtures: bare-split-xattrs repo"
${OSTREE} ls ${COMMIT} -X /foo > out.txt
assert_file_has_content_literal out.txt "{ @a(ayay) [] } /foo"
${OSTREE} ls ${COMMIT} -X /bar > out.txt
assert_file_has_content_literal out.txt "{ [(b'user.mykey', [byte 0x6d, 0x79, 0x76, 0x61, 0x6c, 0x75, 0x65])] } /bar"
${OSTREE} ls ${COMMIT} /foolink > out.txt
assert_file_has_content_literal out.txt "/foolink -> foo"
tap_ok "reading simple fixture"
${SUDO} rm -rf -- repo log.txt
else
tap_ok "reading simple fixture # skip Unable to sudo"
fi
tap_end
+12 -1
View File
@@ -23,7 +23,7 @@ set -euo pipefail
mode="bare-user-only"
setup_test_repository "$mode"
extra_basic_tests=6
extra_basic_tests=7
. $(dirname $0)/basic-test.sh
$CMD_PREFIX ostree --version > version.yaml
@@ -54,6 +54,17 @@ fi
assert_file_has_content err.txt "Content object.*invalid mode.*with bits 040.*"
echo "ok failed to commit suid"
cd ${test_tmpdir}
rm repo-input -rf
ostree_repo_init repo-input init --mode=archive
rm files -rf && mkdir files
if $CMD_PREFIX ostree --repo=repo-input commit -b metadata --tree=dir=files --add-metadata-string='=FOO' 2>err.txt; then
assert_not_reached "committed an empty metadata key"
fi
assert_file_has_content err.txt "Empty metadata key"
$CMD_PREFIX ostree --repo=repo-input commit -b metadata --tree=dir=files --add-metadata-string='FOO='
echo "ok rejected invalid metadata"
cd ${test_tmpdir}
rm repo-input -rf
ostree_repo_init repo-input init --mode=archive
+3
View File
@@ -9,6 +9,9 @@ set -euo pipefail
echo '1..2'
# Test CLI extensions via $PATH. If you change this, you may
# also want to change the corresponding destructive version in
# tests/kolainst/destructive/basic-misc.sh
mkdir -p ./localbin
ORIG_PATH="${PATH}"
export PATH="./localbin/:${PATH}"
+2 -1
View File
@@ -78,7 +78,8 @@ test_fixture_setup (TestFixture *fixture,
* certificates for certain test cases. */
homedir = g_test_build_filename (G_TEST_DIST, "tests/gpg-verify-data", NULL);
g_setenv ("GNUPGHOME", homedir, TRUE);
gboolean is_ok = g_setenv ("GNUPGHOME", homedir, TRUE);
g_assert (is_ok == TRUE);
result = g_initable_new (OSTREE_TYPE_GPG_VERIFY_RESULT,
NULL, &local_error, NULL);
+84 -14
View File
@@ -25,8 +25,6 @@ skip_without_user_xattrs
setup_fake_remote_repo1 "archive"
echo '1..12'
cd ${test_tmpdir}
mkdir repo
ostree_repo_init repo
@@ -50,6 +48,12 @@ assert_repo_has_n_commits() {
assert_streq "$(find ${repo}/objects -name '*.commit' | wc -l)" "${count}"
}
assert_repo_has_n_non_commit_objects() {
repo=$1
count=$2
assert_streq "$(find ${repo}/objects -name '*.*' ! -name '*.commit' ! -name '*.tombstone-commit'| wc -l)" "${count}"
}
# Test --no-prune
objectcount_orig=$(find repo/objects | wc -l)
${CMD_PREFIX} ostree prune --repo=repo --refs-only --depth=0 --no-prune | tee noprune.txt
@@ -144,7 +148,7 @@ if ${CMD_PREFIX} ostree --repo=repo prune --static-deltas-only --keep-younger-th
fi
assert_file_has_content_literal err.txt "--static-deltas-only requires --delete-commit"
echo "ok prune"
tap_ok prune
rm repo -rf
ostree_repo_init repo --mode=bare-user
@@ -152,7 +156,7 @@ ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat
${CMD_PREFIX} ostree --repo=repo pull --depth=-1 --commit-metadata-only origin test
${CMD_PREFIX} ostree --repo=repo prune
echo "ok prune with partial repo"
tap_ok prune with partial repo
assert_has_n_objects() {
find $1/objects -name '*.filez' | wc -l > object-count
@@ -188,7 +192,7 @@ ${CMD_PREFIX} ostree --repo=repo refs --delete test
${CMD_PREFIX} ostree --repo=child-repo prune --refs-only --depth=0
assert_has_n_objects child-repo 3
echo "ok prune with parent repo"
tap_ok prune with parent repo
# Delete all the above since I can't be bothered to think about how new tests
# would interact. We make a new repo test suite, then clone it
@@ -233,7 +237,7 @@ $OSTREE fsck
${CMD_PREFIX} ostree --repo=repo prune --keep-younger-than="1 week ago" --retain-branch-depth=stable=5
assert_repo_has_n_commits repo 9
$OSTREE fsck
echo "ok retain branch depth and keep-younger-than"
tap_ok retain branch depth and keep-younger-than
# Just stable branch ref, we should prune everything except the tip of dev,
# so 8 stable + 1 dev = 9
@@ -242,7 +246,7 @@ ${CMD_PREFIX} ostree --repo=repo prune --depth=0 --retain-branch-depth=stable=-1
assert_repo_has_n_commits repo 9
$OSTREE fsck
echo "ok retain branch depth (alone)"
tap_ok retain branch depth [alone]
# Test --only-branch with --depth=0; this should be exactly identical to the
# above with a result of 9.
@@ -250,13 +254,13 @@ reinitialize_datesnap_repo
${CMD_PREFIX} ostree --repo=repo prune --only-branch=dev --depth=0
assert_repo_has_n_commits repo 9
$OSTREE fsck
echo "ok --only-branch --depth=0"
tap_ok --only-branch --depth=0
# Test --only-branch with --depth=1; should just add 1 to the above, for 10.
reinitialize_datesnap_repo
${CMD_PREFIX} ostree --repo=repo prune --only-branch=dev --depth=1
assert_repo_has_n_commits repo 10
echo "ok --only-branch --depth=1"
tap_ok --only-branch --depth=1
# Test --only-branch with all branches
reinitialize_datesnap_repo
@@ -265,27 +269,27 @@ assert_repo_has_n_commits repo 2
reinitialize_datesnap_repo
${CMD_PREFIX} ostree --repo=repo prune --only-branch=dev --only-branch=stable --depth=1
assert_repo_has_n_commits repo 4
echo "ok --only-branch (all) --depth=1"
tap_ok --only-branch [all] --depth=1
# Test --only-branch and --retain-branch-depth overlap
reinitialize_datesnap_repo
${CMD_PREFIX} ostree --repo=repo prune --only-branch=dev --only-branch=stable --depth=0 \
--retain-branch-depth=stable=2
assert_repo_has_n_commits repo 4
echo "ok --only-branch and --retain-branch-depth overlap"
tap_ok --only-branch and --retain-branch-depth overlap
# Test --only-branch and --retain-branch-depth together
reinitialize_datesnap_repo
${CMD_PREFIX} ostree --repo=repo prune --only-branch=dev --depth=0 --retain-branch-depth=stable=2
assert_repo_has_n_commits repo 4
echo "ok --only-branch and --retain-branch-depth together"
tap_ok --only-branch and --retain-branch-depth together
# Test --only-branch with --keep-younger-than; this should be identical to the test
# above for --retain-branch-depth=stable=-1
reinitialize_datesnap_repo
${CMD_PREFIX} ostree --repo=repo prune --only-branch=stable --keep-younger-than="1 week ago"
assert_repo_has_n_commits repo 11
echo "ok --only-branch --keep-younger-than"
tap_ok --only-branch --keep-younger-than
# Test --only-branch with a nonexistent ref
reinitialize_datesnap_repo
@@ -293,4 +297,70 @@ if ${CMD_PREFIX} ostree --repo=repo prune --only-branch=BACON 2>err.txt; then
fatal "we pruned BACON?"
fi
assert_file_has_content err.txt "Refspec.*BACON.*not found"
echo "ok --only-branch=BACON"
tap_ok --only-branch=BACON
# We will use the same principle as datesnap repo
# to create a snapshot to test --commit-only
rm -rf commit-only-test-repo
ostree_repo_init commit-only-test-repo --mode=archive
# Older commits w/ content objects
echo 'message' > tree/file.txt
${CMD_PREFIX} ostree --repo=commit-only-test-repo commit --branch=stable -m test -s "new stable build 1" tree --timestamp="October 15 1985"
${CMD_PREFIX} ostree --repo=commit-only-test-repo commit --branch=dev -m test -s "new dev build 1" tree --timestamp="October 15 1985"
# Commits without any content objects
${CMD_PREFIX} ostree --repo=commit-only-test-repo commit --branch=stable -m test -s "new stable build 2" tree
${CMD_PREFIX} ostree --repo=commit-only-test-repo commit --branch=dev -m test -s "new dev build 2" tree
# Commits with content objects
echo 'message2' > tree/file2.txt
${CMD_PREFIX} ostree --repo=commit-only-test-repo commit --branch=stable -m test -s "new stable build 2" tree
${CMD_PREFIX} ostree --repo=commit-only-test-repo commit --branch=dev -m test -s "new dev build 2" tree
assert_repo_has_n_commits commit-only-test-repo 6
reinitialize_commit_only_test_repo() {
rm repo -rf
ostree_repo_init repo --mode=archive
${CMD_PREFIX} ostree --repo=repo pull-local --depth=-1 commit-only-test-repo
}
orig_obj_count=$(find commit-only-test-repo/objects -name '*.*' ! -name '*.commit' | wc -l)
# --commit-only tests
# Test single branch
reinitialize_commit_only_test_repo
${CMD_PREFIX} ostree --repo=repo prune --commit-only --only-branch=dev --depth=0
assert_repo_has_n_commits repo 4
assert_repo_has_n_non_commit_objects repo ${orig_obj_count}
tap_ok --commit-only and --only-branch
# Test multiple branches (and depth > 0)
reinitialize_commit_only_test_repo
${CMD_PREFIX} ostree --repo=repo prune --commit-only --refs-only --depth=1
assert_repo_has_n_commits repo 4
assert_repo_has_n_non_commit_objects repo ${orig_obj_count}
tap_ok --commit-only and multiple branches depth=1
# Test --delete-commit with --commit-only
reinitialize_commit_only_test_repo
# this commit does not have a parent commit
COMMIT_TO_DELETE=$(${CMD_PREFIX} ostree --repo=repo log dev | grep ^commit | cut -f 2 -d' ' | tail -n 1)
${CMD_PREFIX} ostree --repo=repo prune --commit-only --delete-commit=$COMMIT_TO_DELETE
assert_repo_has_n_commits repo 5
# We gain an extra
assert_repo_has_n_non_commit_objects repo ${orig_obj_count}
tap_ok --commit-only and --delete-commit
# Test --delete-commit when it creates orphaned commits
reinitialize_commit_only_test_repo
# get the current HEAD's parent on dev branch
COMMIT_TO_DELETE=$(${CMD_PREFIX} ostree --repo=repo log dev | grep ^commit | cut -f 2 -d' ' | head -n 2 | tail -n 1)
${CMD_PREFIX} ostree --repo=repo prune --commit-only --refs-only --delete-commit=$COMMIT_TO_DELETE
# we deleted a commit that orphaned another, so we lose two commits
assert_repo_has_n_commits repo 4
assert_repo_has_n_non_commit_objects repo ${orig_obj_count}
tap_ok --commit-only and --delete-commit with orphaned commits
# Test --keep-younger-than with --commit-only
reinitialize_commit_only_test_repo
${CMD_PREFIX} ostree --repo=repo prune --commit-only --keep-younger-than="1 week ago"
assert_repo_has_n_commits repo 4
assert_repo_has_n_non_commit_objects repo ${orig_obj_count}
tap_ok --commit-only and --keep-younger-than
tap_end
+2 -1
View File
@@ -35,7 +35,8 @@ main (int argc, char **argv)
OstreeRollsumMatches *matches;
GMappedFile *mfile;
g_setenv ("GIO_USE_VFS", "local", TRUE);
gboolean is_ok = g_setenv ("GIO_USE_VFS", "local", TRUE);
g_assert (is_ok == TRUE);
if (argc < 3)
return 1;
+1
View File
@@ -56,6 +56,7 @@ assert_file_has_content_literal summary.txt "* main"
assert_file_has_content_literal summary.txt "* other"
assert_file_has_content_literal summary.txt "ostree.summary.last-modified"
assert_file_has_content_literal summary.txt "Timestamp (ostree.commit.timestamp): "
assert_file_has_content_literal summary.txt "Version (ostree.commit.version): 3.2"
echo "ok view summary"
# Check the summary can be viewed raw too.
+1 -1
View File
@@ -54,7 +54,7 @@ echo 'ok documented symbols'
# ONLY update this checksum in release commits!
cat > released-sha256.txt <<EOF
165d3d940b7e6e09f39221b983fd17efae8ae40b8b2136a84b422a21e402f771 ${released_syms}
4f0600ad7af4ba937f463dc0bdc38aef6f53b154e88730b935552330c6a19a3f ${released_syms}
EOF
sha256sum -c released-sha256.txt
+2 -1
View File
@@ -58,7 +58,8 @@ int
main (int argc, char **argv)
{
g_setenv ("GIO_USE_VFS", "local", TRUE);
gboolean is_ok = g_setenv ("GIO_USE_VFS", "local", TRUE);
g_assert (is_ok == TRUE);
g_test_init (&argc, &argv, NULL);