osbuild/tests/unit-tests/prep-host-environment.sh
Tomáš Hozza eb27aa4849
Test: allow erasing packages when installing build deps
It became a common thing that the SUT has newer selinux-policy installed
than the version available in the configured repositories. osbuild has a
build dependency on selinux-policy-devel, which installation fails in
such case (there is no `*-devel` package with of the installed version
available in the configured repositories). None of the other workarounds
actually work consistently, so fall back to allowing DNF to downgrade
the installed selinux-policy on SUT.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-04-07 14:13:40 +02:00

37 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/bash
# Prepare the host environment for running the osbuild unit tests.
# This includes installing missing dependencies and tools.
set -euxo pipefail
source /etc/os-release
# Move to the checked out git repo with the test plans
# this should be the root of the dist-git repo
cd "${TMT_TREE}"
# install all test dependencies
sudo dnf install -y \
rpmdevtools \
python3-mako \
python3-pip \
rpm-ostree \
dosfstools
# Allow erasing, since the SUT sometimes has a newer selinux-policy installed than the one available
# in the host repos, which makes the installation of selinux-policy-devel fail.
sudo dnf builddep -y --allowerasing --nobest osbuild.spec
# Install pytst from pip, because the version in some RHEL / CentOS releases is too old
sudo pip3 install pytest
# Make sure that /usr/lib/systemd/boot/efi/linuxx64.efi.stub is available to enable pe32p tests
case "${ID}-${VERSION_ID}" in
rhel-8.* | centos-8)
sudo dnf install -y systemd-udev
;;
*)
sudo dnf install -y systemd-boot-unsigned
;;
esac