Blame tests/test-pull-contenturl.sh

rpm-build 0fba15
#!/bin/bash
rpm-build 0fba15
#
rpm-build 0fba15
# Copyright (C) 2016 Red Hat, Inc.
rpm-build 0fba15
#
rpm-build 0fba15
# SPDX-License-Identifier: LGPL-2.0+
rpm-build 0fba15
#
rpm-build 0fba15
# This library is free software; you can redistribute it and/or
rpm-build 0fba15
# modify it under the terms of the GNU Lesser General Public
rpm-build 0fba15
# License as published by the Free Software Foundation; either
rpm-build 0fba15
# version 2 of the License, or (at your option) any later version.
rpm-build 0fba15
#
rpm-build 0fba15
# This library is distributed in the hope that it will be useful,
rpm-build 0fba15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build 0fba15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build 0fba15
# Lesser General Public License for more details.
rpm-build 0fba15
#
rpm-build 0fba15
# You should have received a copy of the GNU Lesser General Public
rpm-build 0fba15
# License along with this library; if not, write to the
rpm-build 0fba15
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rpm-build 0fba15
# Boston, MA 02111-1307, USA.
rpm-build 0fba15
rpm-build 0fba15
set -euo pipefail
rpm-build 0fba15
rpm-build 0fba15
. $(dirname $0)/libtest.sh
rpm-build 0fba15
rpm-build 0fba15
echo "1..2"
rpm-build 0fba15
rpm-build 0fba15
COMMIT_SIGN=""
rpm-build 0fba15
if has_gpgme; then
rpm-build 0fba15
  COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
rpm-build 0fba15
fi
rpm-build 0fba15
rpm-build 0fba15
setup_fake_remote_repo1 "archive" "${COMMIT_SIGN}"
rpm-build 0fba15
rpm-build 0fba15
# create a summary
rpm-build 0fba15
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo \
rpm-build 0fba15
  summary -u ${COMMIT_SIGN}
rpm-build 0fba15
rpm-build 0fba15
# Let's bring up an identical server in which meta files are missing
rpm-build 0fba15
cd ${test_tmpdir}
rpm-build 0fba15
mkdir httpd-content
rpm-build 0fba15
cd httpd-content
rpm-build 0fba15
cp -a ${test_tmpdir}/ostree-srv ostree
rpm-build 0fba15
rpm-build 0fba15
# delete all the meta stuff from here
rpm-build 0fba15
rm ostree/gnomerepo/summary
rpm-build 0fba15
if has_gpgme; then
rpm-build 0fba15
  rm ostree/gnomerepo/summary.sig
rpm-build 0fba15
  find ostree/gnomerepo/objects -name '*.commitmeta' | xargs rm
rpm-build 0fba15
fi
rpm-build 0fba15
rpm-build 0fba15
# delete all the content stuff from there
rpm-build 0fba15
find ${test_tmpdir}/ostree-srv/gnomerepo/objects \
rpm-build 0fba15
  ! -name '*.commitmeta' -type f | xargs rm
rpm-build 0fba15
rpm-build 0fba15
${OSTREE_HTTPD} --autoexit --daemonize -p ${test_tmpdir}/httpd-content-port
rpm-build 0fba15
content_port=$(cat ${test_tmpdir}/httpd-content-port)
rpm-build 0fba15
echo "http://127.0.0.1:${content_port}" > ${test_tmpdir}/httpd-content-address
rpm-build 0fba15
rpm-build 0fba15
cd ${test_tmpdir}
rpm-build 0fba15
mkdir repo
rpm-build 0fba15
ostree_repo_init repo
rpm-build 0fba15
if has_gpgme; then VERIFY=true; else VERIFY=false; fi
rpm-build 0fba15
${CMD_PREFIX} ostree --repo=repo remote add origin \
rpm-build 0fba15
  --set=gpg-verify=$VERIFY --set=gpg-verify-summary=$VERIFY \
rpm-build 0fba15
  --contenturl=$(cat httpd-content-address)/ostree/gnomerepo \
rpm-build 0fba15
  $(cat httpd-address)/ostree/gnomerepo
rpm-build 0fba15
${CMD_PREFIX} ostree --repo=repo pull origin:main
rpm-build 0fba15
rpm-build 0fba15
echo "ok pull objects from contenturl"
rpm-build 0fba15
rpm-build 0fba15
if ! has_gpgme; then
rpm-build 0fba15
  echo "ok don't pull sigs from contenturl # SKIP not compiled with gpgme"
rpm-build 0fba15
else
rpm-build 0fba15
  echo "ok don't pull sigs from contenturl"
rpm-build 0fba15
fi