Hello,
since i encountered this in the past and postponed it, I did a bit of a digging and found this:
As you probably found out by now it is caused by package-notes being dependent
on environment variables that are expected to be present during package build.
See the actual package-notes file contents:
$ cat /usr/lib/rpm/redhat/redhat-package-notes
*link:
+ --package-metadata={\"type\":\"rpm\",\"name\":\"%:getenv(RPM_PACKAGE_NAME \",\"version\":\"%:getenv(RPM_PACKAGE_VERSION -%:getenv(RPM_PACKAGE_RELEASE \",\"architecture\":\"%:getenv(RPM_ARCH \",\"osCpe\":\"cpe:/o:fedoraproject:fedora:38\"}))))
I took a look at your test and found out that your test uses rpmbuild to perform
preparation of sources:
rlRun "rpmbuild -bp libarchive.spec"
rlRun "rpmbuild -bc libarchive.spec"
rlRun "popd"
This probably executes configure in a way that configures linking to be
done with "-specs=/usr/lib/rpm/redhat/redhat-package-notes" option and thus
you now need the environment variables that the file mentions. These variables
are defined and exported before build stage in macro defined in file
/usr/lib/rpm/macros and if you would have executed the check phase with
rpmbuild command, you would propably face no issue (did not verify this).
Unfortunately the test performs check manually:
rlRun "make check &> $TmpDir/make_check.log" 0 "Make check"
rlRun -s "./libarchive_test"
rlAssertGrep "Tests failed:[[:blank:]]* 0" $rlRun_LOG
and thus there are no environment variables.
This can be fixed by a little bit of a hack. Add this line:
rlRun 'eval "$(rpm --eval %___build_pre)"; cd ~/rpmbuild/BUILD/libarchive-*' 0 "setting environment"
before the make check and you are good to go. This causes
that needed environment variables will be defined.
I hope that this helps you or based on this information you will be able
to find a better solution.
Best Regards.