Use correct includes for RPM libraries

Resolves: rhbz#2080210
This commit is contained in:
Jan Černý 2022-05-30 13:00:58 +02:00
parent 0e086fa284
commit 2466b49406
2 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,81 @@
From 8dec1bb5e9546e75ae6e7b7cf94cf00197ce3e5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Tue, 24 May 2022 12:15:44 +0200
Subject: [PATCH 1/2] Use correct includes
rpmvercmp is defined in rpm/rpmver.h
risdigit is defined in rpm/rpmstring.h
Resolves: rhbz#2080210
---
cmake/FindRPM.cmake | 3 +++
config.h.in | 1 +
src/OVAL/results/oval_cmp_evr_string.c | 5 +++++
3 files changed, 9 insertions(+)
diff --git a/cmake/FindRPM.cmake b/cmake/FindRPM.cmake
index a666942eae..369d153fcc 100644
--- a/cmake/FindRPM.cmake
+++ b/cmake/FindRPM.cmake
@@ -30,6 +30,9 @@ set(RPM_VERSION ${RPM_PKGCONF_VERSION})
if(RPM_VERSION)
string(COMPARE GREATER "4.6" ${RPM_VERSION} RPM46_FOUND)
string(COMPARE GREATER "4.7" ${RPM_VERSION} RPM47_FOUND)
+ if(NOT (RPM_VERSION VERSION_LESS "4.18"))
+ set(RPM418_FOUND 1)
+ endif()
endif()
# Set the include dir variables and the libraries and let libfind_process do the rest.
diff --git a/config.h.in b/config.h.in
index 1b72855822..bb1428afc8 100644
--- a/config.h.in
+++ b/config.h.in
@@ -44,6 +44,7 @@
#cmakedefine HAVE_RPMVERCMP
#cmakedefine RPM46_FOUND
#cmakedefine RPM47_FOUND
+#cmakedefine RPM418_FOUND
#cmakedefine BZIP2_FOUND
diff --git a/src/OVAL/results/oval_cmp_evr_string.c b/src/OVAL/results/oval_cmp_evr_string.c
index 3bfc8ce5f9..3ba0fa0cbd 100644
--- a/src/OVAL/results/oval_cmp_evr_string.c
+++ b/src/OVAL/results/oval_cmp_evr_string.c
@@ -37,7 +37,12 @@
#include "common/_error.h"
#ifdef HAVE_RPMVERCMP
+#ifdef RPM418_FOUND
+#include <rpm/rpmver.h>
+#include <rpm/rpmstring.h>
+#else
#include <rpm/rpmlib.h>
+#endif
#else
#ifdef OS_WINDOWS
#include <malloc.h>
From bd41965d8e467dd0d3603e7e5594a698aa6a415c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Mon, 30 May 2022 11:32:35 +0200
Subject: [PATCH 2/2] Use VERSION_GREATER_EQUAL
---
cmake/FindRPM.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/FindRPM.cmake b/cmake/FindRPM.cmake
index 369d153fcc..22875a463b 100644
--- a/cmake/FindRPM.cmake
+++ b/cmake/FindRPM.cmake
@@ -30,7 +30,7 @@ set(RPM_VERSION ${RPM_PKGCONF_VERSION})
if(RPM_VERSION)
string(COMPARE GREATER "4.6" ${RPM_VERSION} RPM46_FOUND)
string(COMPARE GREATER "4.7" ${RPM_VERSION} RPM47_FOUND)
- if(NOT (RPM_VERSION VERSION_LESS "4.18"))
+ if(RPM_VERSION VERSION_GREATER_EQUAL "4.18")
set(RPM418_FOUND 1)
endif()
endif()

View File

@ -1,6 +1,6 @@
Name: openscap Name: openscap
Version: 1.3.6 Version: 1.3.6
Release: 4%{?dist} Release: 5%{?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+
@ -10,6 +10,7 @@ Patch1: openscap-1.3.7-pr-1841-fix-shellcheck-warning.patch
Patch2: openscap-1.3.7-pr-1843-prevent-fails-of-epoch-test.patch 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
BuildRequires: make BuildRequires: make
BuildRequires: cmake >= 2.6 BuildRequires: cmake >= 2.6
BuildRequires: gcc BuildRequires: gcc
@ -215,6 +216,9 @@ ln -sf ../oscap-remediate.service %{buildroot}%{_unitdir}/system-update.target.w
%{_mandir}/man8/oscap-podman.8* %{_mandir}/man8/oscap-podman.8*
%changelog %changelog
* Mon May 30 2022 Jan Černý <jcerny@redhat.com> - 1:1.3.6-5
- Use correct includes (rhbz#2080210)
* Fri Feb 4 2022 Evgenii Kolesnikov <ekolesni@redhat.com> - 1:1.3.6-4 * Fri Feb 4 2022 Evgenii Kolesnikov <ekolesni@redhat.com> - 1:1.3.6-4
- Prevent file permissions errors - Prevent file permissions errors