From 2cacb8473db9835d4bbb4a7451a03dc34eb72300 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Thu, 1 Feb 2024 18:18:01 +0100 Subject: [PATCH] Repoquery the test repo in prepare phase We check it before running tests https://github.com/fedora-ci/mini-tps/blob/main/mtps-run-tests#L174 but better fail sooner. There's not much we can do when this problem happens. We would need to disable the correct module but that might (e.g. in python27 module case) break other packages dependencies. So just warn the user. --- mini-tps.spec | 5 ++++- mtps-get-task | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mini-tps.spec b/mini-tps.spec index a71e456..1d31281 100644 --- a/mini-tps.spec +++ b/mini-tps.spec @@ -1,6 +1,6 @@ Name: mini-tps Version: 0.1 -Release: 168%{?dist} +Release: 169%{?dist} Summary: Mini TPS - Test Package Sanity License: GPLv2 @@ -64,6 +64,9 @@ install -pD -m 0755 profiles/fedora/prepare-system %{buildroot}%{_libexecdir}/mi %changelog +* Thu Feb 01 2024 Jiri Popelka - 0.1-169 +- rebuilt + * Mon Jan 29 2024 Jiri Popelka - 0.1-168 - Handle missing compose (id) diff --git a/mtps-get-task b/mtps-get-task index 2fed373..6e9f452 100755 --- a/mtps-get-task +++ b/mtps-get-task @@ -23,6 +23,7 @@ if [ -z "${YUMDNFCMD:-}" ]; then source "$(dirname "${BASH_SOURCE[0]}")/mtps-set RET_NO_RPMS_IN_BREW=7 RET_NO_RPMS_IN_REPOS=8 +RET_EMPTY_REPOQUERY=9 task_result2rpms() { local arch="$1" && shift @@ -758,8 +759,10 @@ echo "Using $CREATEREPO_BIN" if [ -n "$REPOFILENAME" ]; then repo_file_text="$(mk_named_repo "$REPOFILENAME" "$REPODIR" "1")" + repo_name="$REPOFILENAME" else repo_file_text="$(mk_repo "$TASK" "$REPODIR" "1")" + repo_name="brew-${TASK}" fi echo "Repo file:" echo "$repo_file_text" @@ -775,3 +778,21 @@ if [[ -n "$INSTALLREPOFILE" && "$id" -eq 0 ]]; then echo "Creating repo file: $repofile" echo "$repo_file_text" > "$repofile" fi + +# Query packages in the created repo +nevras_in_repo="$( + "$YUMDNFCMD" repoquery \ + --qf "%{repoid} %{name}-%{epoch}:%{version}-%{release}.%{arch}" \ + --repo "$repo_name" 2>&1 | \ + sed -n -e "/^${repo_name}[[:space:]]/ s/^${repo_name}[[:space:]]//p" +)" +# Exclude SRPMs +nevras_in_repo="$(echo "$nevras_in_repo" | sed -n -e "/\.src$/d;p")" + +if [ -z "${nevras_in_repo// /}" ]; then + # Yum/dnf thinks there are no packages in the testing repo. + # This usually happens when the packages are filtered out + # because they (different version-release) are included + # in an (enabled) module. + exit "$RET_EMPTY_REPOQUERY" +fi