From 9b3bf81fb150514c25982a981bafdc5ee7455fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Mon, 7 Aug 2023 15:25:21 +0200 Subject: [PATCH] A few hints for occasional manual usage --- plans/all_tests/all_tests.fmf | 21 ++++++++++++++ plans/install_fedora_build.sh | 53 +++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100755 plans/install_fedora_build.sh diff --git a/plans/all_tests/all_tests.fmf b/plans/all_tests/all_tests.fmf index 3debdb2..4532e92 100644 --- a/plans/all_tests/all_tests.fmf +++ b/plans/all_tests/all_tests.fmf @@ -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 diff --git a/plans/install_fedora_build.sh b/plans/install_fedora_build.sh new file mode 100755 index 0000000..1eb3936 --- /dev/null +++ b/plans/install_fedora_build.sh @@ -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