From 05b3e52e7cb45ff1bc22b3d7bcb89fc6aeb734c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= Date: Tue, 31 May 2022 10:06:31 +0200 Subject: [PATCH] Update tests due to relocation of RPM database --- openscap-1.3.7-pr-1850-relocate-rpmdb.patch | 50 +++++++++++++++++++++ openscap.spec | 6 ++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 openscap-1.3.7-pr-1850-relocate-rpmdb.patch diff --git a/openscap-1.3.7-pr-1850-relocate-rpmdb.patch b/openscap-1.3.7-pr-1850-relocate-rpmdb.patch new file mode 100644 index 0000000..ab1db0b --- /dev/null +++ b/openscap-1.3.7-pr-1850-relocate-rpmdb.patch @@ -0,0 +1,50 @@ +From b0d013aedab978e7d945ae8016e0df0a9dd0bf68 Mon Sep 17 00:00:00 2001 +From: Matus Marhefka +Date: Mon, 21 Mar 2022 16:12:35 +0100 +Subject: [PATCH] tests/probes/rpm/rpm_common.sh: update wrt Fedora 36 RPM DB + change + +Since Fedora 36 RPM database location changed, see +https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr +--- + tests/probes/rpm/rpm_common.sh | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/tests/probes/rpm/rpm_common.sh b/tests/probes/rpm/rpm_common.sh +index 2438272557..31b3f3fcd1 100755 +--- a/tests/probes/rpm/rpm_common.sh ++++ b/tests/probes/rpm/rpm_common.sh +@@ -9,6 +9,13 @@ RPMBASE="${builddir}/tests/probes/rpm" + RPMTEST="${RPMBASE}/root" + RPMBUILD="${RPMBASE}/build" + ++# Since Fedora 36 RPM database location changed, see ++# https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr ++if [ -d "/usr/lib/sysimage/rpm/" ]; then ++ RPMDB_PATH="/usr/lib/sysimage/rpm/" ++else ++ RPMDB_PATH="/var/lib/rpm/" ++fi + + function rpm_build { + require "rpmbuild" || return 255 +@@ -28,8 +35,8 @@ function rpm_prepare_offline { + cp /usr/lib/rpm/rpmrc ${RPMTEST}/usr/lib/rpm/rpmrc + cp /usr/lib/rpm/macros ${RPMTEST}/usr/lib/rpm/macros + rpm_build +- rpm -i ${RPMBUILD}/RPMS/noarch/foobar-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}/var/lib/rpm/" +- rpm -i ${RPMBUILD}/RPMS/noarch/foo-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}/var/lib/rpm/" ++ rpm -i ${RPMBUILD}/RPMS/noarch/foobar-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}" ++ rpm -i ${RPMBUILD}/RPMS/noarch/foo-1.0-1.noarch.rpm --badreloc --relocate="/etc=${RPMTEST}/etc/" --dbpath="${RPMTEST}${RPMDB_PATH}" + } + + function rpm_cleanup_offline { +@@ -40,7 +47,7 @@ function rpm_cleanup_offline { + function rpm_query { + require "rpm" || return 255 + if [ -d "$OSCAP_PROBE_ROOT" ]; then +- DB="--dbpath=$OSCAP_PROBE_ROOT/var/lib/rpm/" ++ DB="--dbpath=${OSCAP_PROBE_ROOT}${RPMDB_PATH}" + fi + rpm $DB --qf "%{$2}\n" -q $1 | head - + } diff --git a/openscap.spec b/openscap.spec index f6adcd5..8c22667 100644 --- a/openscap.spec +++ b/openscap.spec @@ -1,6 +1,6 @@ Name: openscap Version: 1.3.6 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 1 Summary: Set of open source libraries enabling integration of the SCAP line of standards License: LGPLv2+ @@ -11,6 +11,7 @@ Patch2: openscap-1.3.7-pr-1843-prevent-fails-of-epoch-test.patch Patch3: openscap-1.3.7-pr-1844-prevent-fails-of-epoch-test-2.patch Patch4: openscap-1.3.7-pr-1846-prevent-file-permissions-errors.patch Patch5: openscap-1.3.7-pr-1864-rpm-includes.patch +Patch6: openscap-1.3.7-pr-1850-relocate-rpmdb.patch BuildRequires: make BuildRequires: cmake >= 2.6 BuildRequires: gcc @@ -216,6 +217,9 @@ ln -sf ../oscap-remediate.service %{buildroot}%{_unitdir}/system-update.target.w %{_mandir}/man8/oscap-podman.8* %changelog +* Tue May 31 2022 Jan Černý - 1:1.3.6-6 +- Update tests due to relocation of RPM database + * Mon May 30 2022 Jan Černý - 1:1.3.6-5 - Use correct includes (rhbz#2080210)