New upstream version 2016.14
This commit is contained in:
commit
90f43fba94
100 files changed
+1821
-1339
No files matched your search
+18
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..58"
|
||||
echo "1..60"
|
||||
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
echo "ok checkout"
|
||||
@@ -178,6 +178,9 @@ echo "ok user checkout"
|
||||
$OSTREE commit -b test2 -s "Another commit" --tree=ref=test2
|
||||
echo "ok commit from ref"
|
||||
|
||||
$OSTREE commit -b test2 -s "Another commit with modifier" --tree=ref=test2 --owner-uid=`id -u`
|
||||
echo "ok commit from ref with modifier"
|
||||
|
||||
$OSTREE commit -b trees/test2 -s 'ref with / in it' --tree=ref=test2
|
||||
echo "ok commit ref with /"
|
||||
|
||||
@@ -191,6 +194,20 @@ cd ${test_tmpdir}/checkout-test2-4
|
||||
$OSTREE commit -b test2 -s "no xattrs" --no-xattrs
|
||||
echo "ok commit with no xattrs"
|
||||
|
||||
mkdir tree-A tree-B
|
||||
touch tree-A/file-a tree-B/file-b
|
||||
|
||||
$OSTREE commit -b test3-1 -s "Initial tree" --tree=dir=tree-A
|
||||
$OSTREE commit -b test3-2 -s "Replacement tree" --tree=dir=tree-B
|
||||
$OSTREE commit -b test3-combined -s "combined tree" --tree=ref=test3-1 --tree=ref=test3-2
|
||||
|
||||
$OSTREE checkout test3-combined checkout-test3-combined
|
||||
|
||||
assert_has_file checkout-test3-combined/file-a
|
||||
assert_has_file checkout-test3-combined/file-b
|
||||
|
||||
echo "ok commit combined ref trees"
|
||||
|
||||
# NB: The + is optional, but we need to make sure we support it
|
||||
cd ${test_tmpdir}
|
||||
cat > test-statoverride.txt <<EOF
|
||||
|
||||
@@ -51,7 +51,7 @@ fi
|
||||
newstagepath=$(ls -d sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*)
|
||||
assert_has_dir "${newstagepath}"
|
||||
env OSTREE_BOOTID=${NEW_TEST_BOOTID} ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
newstagepath=$(ls -d sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*)
|
||||
newstagepath=$(echo sysroot/ostree/repo/tmp/staging-${NEW_TEST_BOOTID}-*)
|
||||
assert_not_has_dir "${stagepath}"
|
||||
assert_not_has_dir "${newstagepath}"
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ mkdir repo
|
||||
${CMD_PREFIX} ostree --repo=repo init
|
||||
${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo
|
||||
${CMD_PREFIX} ostree --repo=repo pull origin main
|
||||
${CMD_PREFIX} ostree --repo=repo show --gpg-verify-remote=origin main | grep -o 'Found [[:digit:]] signature' > show-verify-remote
|
||||
assert_file_has_content show-verify-remote 'Found 1 signature'
|
||||
rm repo -rf
|
||||
|
||||
# A test with corrupted detached signature
|
||||
|
||||
@@ -468,6 +468,8 @@ entry_pathname_test_helper (gconstpointer data, gboolean on)
|
||||
goto out;
|
||||
}
|
||||
|
||||
archive_read_free (a);
|
||||
ostree_repo_commit_modifier_unref (modifier);
|
||||
out:
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
@@ -534,6 +536,7 @@ test_libarchive_selinux (gconstpointer data)
|
||||
g_assert_cmpstr (buf, ==, "system_u:object_r:etc_t:s0");
|
||||
|
||||
out:
|
||||
archive_read_free (a);
|
||||
if (modifier)
|
||||
ostree_repo_commit_modifier_unref (modifier);
|
||||
g_assert_no_error (error);
|
||||
@@ -562,5 +565,6 @@ int main (int argc, char **argv)
|
||||
|
||||
if (td.tmpd && g_getenv ("TEST_SKIP_CLEANUP") == NULL)
|
||||
(void) glnx_shutil_rm_rf_at (AT_FDCWD, td.tmpd, NULL, NULL);
|
||||
g_free (td.tmpd);
|
||||
return r;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ unset OSTREE_GPG_HOME
|
||||
|
||||
setup_fake_remote_repo1 "archive-z2"
|
||||
|
||||
echo "1..1"
|
||||
echo "1..4"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir repo
|
||||
@@ -143,5 +143,67 @@ if ${OSTREE} pull R2:main >/dev/null 2>&1; then
|
||||
fi
|
||||
${OSTREE} pull R3:main >/dev/null
|
||||
|
||||
libtest_cleanup_gpg
|
||||
echo "ok"
|
||||
|
||||
rm repo/refs/remotes/* -rf
|
||||
${OSTREE} prune --refs-only
|
||||
|
||||
# Test the successful gpgkeypath option
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/key3.asc R4 $(cat httpd-address)/ostree/gnomerepo
|
||||
${OSTREE} pull R4:main >/dev/null
|
||||
|
||||
rm repo/refs/remotes/* -rf
|
||||
${OSTREE} prune --refs-only
|
||||
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/INVALIDKEYPATH.asc R5 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R5:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with nonexistent key"
|
||||
fi
|
||||
assert_file_has_content err.txt "INVALIDKEYPATH.*No such file or directory"
|
||||
|
||||
rm repo/refs/remotes/* -rf
|
||||
${OSTREE} prune --refs-only
|
||||
|
||||
${OSTREE} remote add --set=gpgkeypath=${test_tmpdir}/gpghome/key2.asc R6 $(cat httpd-address)/ostree/gnomerepo
|
||||
if ${OSTREE} pull R6:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling with different key"
|
||||
fi
|
||||
assert_file_has_content err.txt "GPG signatures found, but none are in trusted keyring"
|
||||
|
||||
echo "ok"
|
||||
|
||||
# Test deltas with signed commits; this test is a bit
|
||||
# weird here but this file has separate per-remote keys.
|
||||
cd ${test_tmpdir}
|
||||
rm repo/refs/remotes/* -rf
|
||||
${OSTREE} prune --refs-only
|
||||
echo $(date) > workdir/testfile-for-deltas-1
|
||||
# Sign with keyid 1 for first commit
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main --gpg-sign ${TEST_GPG_KEYID_1} --gpg-homedir ${test_tmpdir}/gpghome workdir
|
||||
prevrev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo rev-parse main)
|
||||
# Pull the previous revision
|
||||
${OSTREE} pull R1:main
|
||||
assert_streq $(${OSTREE} rev-parse R1:main) ${prevrev}
|
||||
# Sign with keyid 2, but use remote r1
|
||||
echo $(date) > workdir/testfile-for-deltas-2
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main --gpg-sign ${TEST_GPG_KEYID_2} --gpg-homedir ${test_tmpdir}/gpghome workdir
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo static-delta generate main
|
||||
# Summary is signed with key1
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u --gpg-sign ${TEST_GPG_KEYID_1} --gpg-homedir ${test_tmpdir}/gpghome
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo rev-parse main)
|
||||
if ${OSTREE} pull --require-static-deltas R1:main 2>err.txt; then
|
||||
assert_not_reached "Unexpectedly succeeded at pulling commit signed with untrusted key"
|
||||
fi
|
||||
assert_file_has_content err.txt "GPG signatures found, but none are in trusted keyring"
|
||||
|
||||
echo "ok gpg untrusted signed commit for delta upgrades"
|
||||
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo reset main{,^}
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main --gpg-sign ${TEST_GPG_KEYID_1} --gpg-homedir ${test_tmpdir}/gpghome workdir
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo static-delta generate main
|
||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u --gpg-sign ${TEST_GPG_KEYID_1} --gpg-homedir ${test_tmpdir}/gpghome
|
||||
${OSTREE} pull --require-static-deltas R1:main
|
||||
|
||||
echo "ok gpg trusted signed commit for delta upgrades"
|
||||
|
||||
libtest_cleanup_gpg
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2016 Red Hat, Inc.
|
||||
#
|
||||
# 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 -euo pipefail
|
||||
|
||||
echo '1..2'
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
setup_fake_remote_repo1 "archive" "" \
|
||||
"--expected-header foo=bar --expected-header baz=badger"
|
||||
|
||||
assert_fail (){
|
||||
set +e
|
||||
$@
|
||||
if [ $? = 0 ] ; then
|
||||
echo 1>&2 "$@ did not fail"; exit 1
|
||||
fi
|
||||
set -euo pipefail
|
||||
}
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm repo -rf
|
||||
mkdir repo
|
||||
${CMD_PREFIX} ostree --repo=repo init
|
||||
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo
|
||||
|
||||
# Sanity check the setup, without headers the pull should fail
|
||||
assert_fail ${CMD_PREFIX} ostree --repo=repo pull origin main
|
||||
|
||||
echo "ok, setup done"
|
||||
|
||||
# Now pull should succeed now
|
||||
${CMD_PREFIX} ostree --repo=repo pull --http-header foo=bar --http-header baz=badger origin main
|
||||
|
||||
echo "ok, pull succeeded"
|
||||
Reference in new issue
Block a user