Skip to content

Commit

Permalink
Repoquery the test repo in prepare phase
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jpopelka committed Feb 1, 2024
1 parent 029290b commit 2cacb84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mini-tps.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: mini-tps
Version: 0.1
Release: 168%{?dist}
Release: 169%{?dist}
Summary: Mini TPS - Test Package Sanity

License: GPLv2
Expand Down Expand Up @@ -64,6 +64,9 @@ install -pD -m 0755 profiles/fedora/prepare-system %{buildroot}%{_libexecdir}/mi


%changelog
* Thu Feb 01 2024 Jiri Popelka <[email protected]> - 0.1-169
- rebuilt

* Mon Jan 29 2024 Jiri Popelka <[email protected]> - 0.1-168
- Handle missing compose (id)

Expand Down
21 changes: 21 additions & 0 deletions mtps-get-task
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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

0 comments on commit 2cacb84

Please sign in to comment.