Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sanity/rules-d/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require+:
- createrepo_c
- /usr/bin/yum-builddep
recommend:
- rpmbuild
- /usr/bin/rpmbuild
- file-devel
- lmdb-devel
tag:
Expand Down
7 changes: 4 additions & 3 deletions Sanity/rules-d/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ PACKAGE="fapolicyd"
rlJournalStart && {
rlPhaseStartSetup && {
rlRun "rlImport --all" 0 "Import libraries" || rlDie "cannot continue"
tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue"
rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue"
# tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue"
# rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue"
# || "dnf config-manager --set-enabled rhel-CRB"
rlRun "rlFetchSrcForInstalled fapolicyd"
rlRun "yum-builddep ./fapolicyd-*.src.rpm --enablerepo '*' -y"
Comment on lines +35 to +39

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This block has a couple of issues that should be addressed for robustness and maintainability:

  1. Disabled Checks: Important checks for RHEL environments on lines 35-36 have been commented out. This can hide potential issues on RHEL. These should be executed conditionally.
  2. Broad Repository Enablement: Using --enablerepo '*' on line 39 is risky as it can pull dependencies from unexpected sources. It's much safer to enable only the specific repositories required.

A better approach is to detect the distribution and configure the necessary repositories (like rhel-CRB for RHEL or crb for CentOS Stream) before installing build dependencies. This makes the test more reliable.

Suggested change
# tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue"
# rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue"
# || "dnf config-manager --set-enabled rhel-CRB"
rlRun "yumdownloader --source fapolicyd"
rlRun "yum-builddep ./fapolicyd-*.src.rpm --enablerepo '*' -y"
if rlIsRHEL; then
tcfRun "rlCheckMakefileRequires" || rlDie "cannot continue"
rlRun "dnf repolist enabled | grep rhel-CRB" 0 "Check if required rhel-CRB repo is enabled" || rlDie "cannot continue"
elif rlIsRHELLike; then
# For RHEL-like distros (e.g., CentOS Stream), enable the 'crb' repository.
rlRun "dnf config-manager --set-enabled crb" 0 "Enable crb repo for build dependencies"
fi
rlRun "yumdownloader --source fapolicyd"
rlRun "yum-builddep ./fapolicyd-*.src.rpm -y"

IFS=' ' read -r SRC N V R A < <(rpm -q --qf '%{sourcerpm} %{name} %{version} %{release} %{arch}\n' fapolicyd)
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
CleanupRegister "rlRun 'rm -r $TmpDir' 0 'Removing tmp directory'"
Expand All @@ -46,7 +48,6 @@ rlJournalStart && {
rlRun "fapSetup"
CleanupRegister --mark "rlRun 'RpmSnapshotRevert'; rlRun 'RpmSnapshotDiscard'"
rlRun "RpmSnapshotCreate"
rlRun "rlFetchSrcForInstalled fapolicyd"
rlRun "rpm -ivh ./fapolicyd*.src.rpm"
rlRun "yum-builddep -y ~/rpmbuild/SPECS/fapolicyd.spec"
R2=".$(echo "$R" | cut -d . -f 2-)"
Expand Down