A few hints for occasional manual usage

This commit is contained in:
Václav Kadlčík 2023-08-07 15:25:21 +02:00
commit 9b3bf81fb1
2 changed files with 74 additions and 0 deletions

View file

@ -1,3 +1,24 @@
# Usage examples:
#
# # Fedora-38 in a local virtual machine, no update nor any other preparation
# # requested. Execute the whole "all_tests" plan.
# tmt \
# -c distro=fedora-38 -c arch=x86_64 \
# run -arv \
# provision -h virtual -i fedora-38 -m 4096 -a x86_64 \
# plans -n all_tests
#
# # Fedora Rawhide in 1minutetip. Fully update and install a specific build.
# # Reboot (because of the updates). Pick just one test.
# tmt \
# -c distro=fedora-rawhide -c arch=x86_64 \
# run -arvvv \
# provision -h minute -i fedora-rawhide -F m1.medium \
# prepare -h shell -s 'dnf -y update && BUILDS=annobin-12.24-1.fc39 ./plans/install_fedora_build.sh' \
# reboot --step prepare:end plans \
# plans -n all_tests
# tests -n /Sanity/smoke
summary: All available tests
discover:
how: fmf

53
plans/install_fedora_build.sh Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
# Parametrization is via environment:
# BUILDS
# - Typical usage: Specific annobin build will be downloaded from Koji
# and installed.
# - Can be empty, then the newest available annobin available in the
# present repos will be installed.
# - Can contain multiple builds separated by whitespaces (you can request
# specific builds of a.g. annobin, gcc, rpm-build and redhat-tpm-config).
# ============================================================================
# If BUILDS not given then just install everything seemingly annobin-related
# ============================================================================
if [[ -z "$BUILDS" ]]; then
dnf -y install 'annobin*'
exit $?
fi
# ============================================================================
# BUILDS specified, let's work:
# ============================================================================
# Setup
set -x
set -o errexit
set -o pipefail
dnf -y install koji createrepo
ARCH=$(arch)
LOCAL_DIR=$(mktemp -d -p /var/tmp build-XXXXXXXXXX)
NAME=${LOCAL_DIR##*/}
# Download
cd "$LOCAL_DIR"
for i in $BUILDS; do
koji buildinfo $i >$i.txt
ARCHES="$ARCH"
if grep -q /noarch/ $i.txt; then
ARCHES+=' noarch'
fi
for a in $ARCHES; do
koji download-build --arch=$a $i
done
rm -f $i.txt
done
# Install
dnf install -y *.rpm
# Have them available in a repo, might be handy
createrepo .
echo -e "[$NAME]\nname=$NAME\nbaseurl=file:///$LOCAL_DIR\ngpgcheck=0" >/etc/yum.repos.d/$NAME.repo