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:
Colin Walters committed 2012-09-23 19:23:45 -04:00
1 parent 35a1ff51d0
commit 40ce43036f
15 files changed
+348 -165

No files matched your search

+66
View File
@@ -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"
+5 -3
View File
@@ -75,8 +75,8 @@ setup_test_repository () {
cd repo
ot_repo="--repo=`pwd`"
export OSTREE="${CMD_PREFIX} ostree ${ot_repo}"
if test "$mode" = "archive"; then
$OSTREE init --archive
if test -n "$mode"; then
$OSTREE init --mode=${mode}
else
$OSTREE init
fi
@@ -110,11 +110,13 @@ setup_test_repository () {
}
setup_fake_remote_repo1() {
mode=$1
shift
oldpwd=`pwd`
mkdir ostree-srv
cd ostree-srv
mkdir gnomerepo
${CMD_PREFIX} ostree --repo=gnomerepo init --archive
${CMD_PREFIX} ostree --repo=gnomerepo init --mode=$mode
mkdir gnomerepo-files
cd gnomerepo-files
echo first > firstfile
+1 -1
View File
@@ -23,7 +23,7 @@ echo "1..28"
. libtest.sh
setup_test_repository "regular"
setup_test_repository "bare"
echo "ok setup"
$OSTREE checkout test2 checkout-test2
+1 -45
View File
@@ -26,48 +26,4 @@ echo '1..11'
setup_test_repository "archive"
echo "ok setup"
$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"
. ${SRCDIR}/archive-test.sh
@@ -21,20 +21,9 @@ set -e
. libtest.sh
echo '1..2'
echo '1..11'
setup_fake_remote_repo1
cd ${test_tmpdir}
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"
setup_test_repository "archive-z"
echo "ok setup"
cd ${test_tmpdir}
$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"
. ${SRCDIR}/archive-test.sh
+1 -1
View File
@@ -23,7 +23,7 @@ set -e
echo "1..1"
setup_test_repository "regular"
setup_test_repository "bare"
$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 2"
@@ -23,7 +23,7 @@ set -e
echo '1..2'
setup_test_repository "regular"
setup_test_repository "bare"
$OSTREE remote add origin http://example.com/ostree/gnome
echo "ok remote add"
assert_file_has_content $test_tmpdir/repo/config "example.com"
+1 -1
View File
@@ -23,7 +23,7 @@ echo "1..1"
. libtest.sh
setup_test_repository "regular"
setup_test_repository "bare"
$OSTREE checkout test2 checkout-test2
cd checkout-test2
chmod o+x firstfile
+1 -1
View File
@@ -23,7 +23,7 @@ echo "1..7"
. libtest.sh
setup_test_repository "regular"
setup_test_repository "bare"
cd ${test_tmpdir}
mkdir foo
cd foo