2016-02-10 13:42:57 +03:00
#!/bin/bash
#
# Copyright (C) 2016 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 -euo pipefail
2016-06-06 19:46:48 +03:00
. ${ commondir } /libtest.sh
2016-02-10 13:42:57 +03:00
echo "1..2"
2017-03-16 04:09:36 +03:00
rpm-ostree ex container init
2017-04-04 20:45:59 +03:00
if test -n " ${ OSTREE_NO_XATTRS :- } " ; then
echo -e 'disable-xattrs=true\n' >> repo/config
fi
2016-02-24 01:50:07 +03:00
2017-06-29 17:11:25 +03:00
build_rpm foo
build_rpm fake-shell provides /bin/sh
2016-02-10 13:42:57 +03:00
2017-06-29 17:11:25 +03:00
cat > rpmmd.repos.d/test-repo.repo <<EOF
[ test-repo]
baseurl = file://$PWD /yumrepo
gpgcheck = 0
EOF
cat > foo.conf <<EOF
2016-02-10 13:42:57 +03:00
[ tree]
2017-06-29 17:11:25 +03:00
ref = foo
packages = foo
2016-02-10 13:42:57 +03:00
repos = test-repo
EOF
2017-06-29 17:11:25 +03:00
rpm-ostree ex container assemble foo.conf
assert_has_dir roots/foo.0
ostree --repo= repo rev-parse foo
2016-02-10 13:42:57 +03:00
echo "ok assemble"
cat >nobranch.conf <<EOF
[ tree]
2017-06-29 17:11:25 +03:00
packages = foo
2016-02-10 13:42:57 +03:00
repos = test-repo
EOF
2017-03-16 04:09:36 +03:00
if rpm-ostree ex container assemble nobranch.conf 2>err.txt; then
2016-02-10 13:42:57 +03:00
assert_not_reached "nobranch.conf"
fi
cat >nopackages.conf <<EOF
[ tree]
2017-06-29 17:11:25 +03:00
ref = foo
2016-02-10 13:42:57 +03:00
packages =
repos = test-repo
EOF
2017-03-16 04:09:36 +03:00
if rpm-ostree ex container assemble nopackages.conf 2>err.txt; then
2016-02-10 13:42:57 +03:00
assert_not_reached "nopackages.conf"
fi
cat >norepos.conf <<EOF
[ tree]
2017-06-29 17:11:25 +03:00
ref = foo
packages = foo
2016-02-10 13:42:57 +03:00
EOF
2017-03-16 04:09:36 +03:00
if rpm-ostree ex container assemble norepos.conf 2>err.txt; then
2016-02-10 13:42:57 +03:00
assert_not_reached "norepos.conf"
fi
cat >notfoundpackage.conf <<EOF
[ tree]
ref = notfound
packages = notfound
repos = test-repo
EOF
2017-03-16 04:09:36 +03:00
if rpm-ostree ex container assemble notfound.conf 2>err.txt; then
2016-02-10 13:42:57 +03:00
assert_not_reached "notfound.conf"
fi
echo "ok error conditions"