Update tests due to relocation of RPM database

This commit is contained in:
Jan Černý 2022-05-31 10:06:31 +02:00
parent 2466b49406
commit 05b3e52e7c
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From b0d013aedab978e7d945ae8016e0df0a9dd0bf68 Mon Sep 17 00:00:00 2001
From: Matus Marhefka <mmarhefk@redhat.com>
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 -
}

View File

@ -1,6 +1,6 @@
Name: openscap Name: openscap
Version: 1.3.6 Version: 1.3.6
Release: 5%{?dist} Release: 6%{?dist}
Epoch: 1 Epoch: 1
Summary: Set of open source libraries enabling integration of the SCAP line of standards Summary: Set of open source libraries enabling integration of the SCAP line of standards
License: LGPLv2+ 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 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 Patch4: openscap-1.3.7-pr-1846-prevent-file-permissions-errors.patch
Patch5: openscap-1.3.7-pr-1864-rpm-includes.patch Patch5: openscap-1.3.7-pr-1864-rpm-includes.patch
Patch6: openscap-1.3.7-pr-1850-relocate-rpmdb.patch
BuildRequires: make BuildRequires: make
BuildRequires: cmake >= 2.6 BuildRequires: cmake >= 2.6
BuildRequires: gcc BuildRequires: gcc
@ -216,6 +217,9 @@ ln -sf ../oscap-remediate.service %{buildroot}%{_unitdir}/system-update.target.w
%{_mandir}/man8/oscap-podman.8* %{_mandir}/man8/oscap-podman.8*
%changelog %changelog
* Tue May 31 2022 Jan Černý <jcerny@redhat.com> - 1:1.3.6-6
- Update tests due to relocation of RPM database
* Mon May 30 2022 Jan Černý <jcerny@redhat.com> - 1:1.3.6-5 * Mon May 30 2022 Jan Černý <jcerny@redhat.com> - 1:1.3.6-5
- Use correct includes (rhbz#2080210) - Use correct includes (rhbz#2080210)