|
Packit Service |
2a3f3d |
#!/bin/bash
|
|
Packit Service |
2a3f3d |
#
|
|
Packit Service |
2a3f3d |
# Copyright (C) 2014 Colin Walters <walters@verbum.org>
|
|
Packit Service |
2a3f3d |
#
|
|
Packit Service |
2a3f3d |
# SPDX-License-Identifier: LGPL-2.0+
|
|
Packit Service |
2a3f3d |
#
|
|
Packit Service |
2a3f3d |
# This library is free software; you can redistribute it and/or
|
|
Packit Service |
2a3f3d |
# modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
2a3f3d |
# License as published by the Free Software Foundation; either
|
|
Packit Service |
2a3f3d |
# version 2 of the License, or (at your option) any later version.
|
|
Packit Service |
2a3f3d |
#
|
|
Packit Service |
2a3f3d |
# This library is distributed in the hope that it will be useful,
|
|
Packit Service |
2a3f3d |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
2a3f3d |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
2a3f3d |
# Lesser General Public License for more details.
|
|
Packit Service |
2a3f3d |
#
|
|
Packit Service |
2a3f3d |
# You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
2a3f3d |
# License along with this library; if not, write to the
|
|
Packit Service |
2a3f3d |
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit Service |
2a3f3d |
# Boston, MA 02111-1307, USA.
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
set -euo pipefail
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
. $(dirname $0)/libtest.sh
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
setup_fake_remote_repo1 "archive"
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
echo '1..4'
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
repopath=${test_tmpdir}/ostree-srv/gnomerepo
|
|
Packit Service |
2a3f3d |
cp -a ${repopath} ${repopath}.orig
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
for remoteurl in $(cat httpd-address)/ostree/gnomerepo \
|
|
Packit Service |
2a3f3d |
file://$(pwd)/ostree-srv/gnomerepo; do
|
|
Packit Service |
2a3f3d |
cd ${test_tmpdir}
|
|
Packit Service |
2a3f3d |
rm repo -rf
|
|
Packit Service |
2a3f3d |
mkdir repo
|
|
Packit Service |
2a3f3d |
ostree_repo_init repo
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin ${remoteurl}
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo pull --subpath=/baz/deeper --subpath=/baz/another origin main
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo ls origin:main /baz/deeper
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo ls origin:main /baz/another
|
|
Packit Service |
2a3f3d |
if ${CMD_PREFIX} ostree --repo=repo ls origin:main /firstfile 2>err.txt; then
|
|
Packit Service |
2a3f3d |
assert_not_reached
|
|
Packit Service |
2a3f3d |
fi
|
|
Packit Service |
2a3f3d |
assert_file_has_content err.txt "Couldn't find file object"
|
|
Packit Service |
2a3f3d |
rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse origin:main)
|
|
Packit Service |
2a3f3d |
assert_has_file repo/state/${rev}.commitpartial
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
# Test pulling a file, not a dir
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo pull --subpath=/firstfile origin main
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo ls origin:main /firstfile
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo pull origin main
|
|
Packit Service |
2a3f3d |
assert_not_has_file repo/state/${rev}.commitpartial
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo fsck
|
|
Packit Service |
2a3f3d |
echo "ok subpaths"
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
rm -rf repo
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
ostree_repo_init repo
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin ${remoteurl}
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
# Pull a directory which is not the first in the commit (/baz/another is before)
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo pull --subpath=/baz/deeper origin main
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
# Ensure it is there
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo ls origin:main /baz/deeper
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
# Now prune, this should not prune the /baz/deeper dirmeta even if the
|
|
Packit Service |
2a3f3d |
# /baz/another dirmeta is not in the repo.
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo prune --refs-only
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
# Ensure it is still there
|
|
Packit Service |
2a3f3d |
${CMD_PREFIX} ostree --repo=repo ls origin:main /baz/deeper
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
echo "ok prune with commitpartial"
|
|
Packit Service |
2a3f3d |
|
|
Packit Service |
2a3f3d |
done
|