openscap/openscap-1.3.7-pr-1864-rpm-includes.patch
Jan Černý 2466b49406 Use correct includes for RPM libraries
Resolves: rhbz#2080210
2022-05-30 13:00:58 +02:00

82 lines
2.4 KiB
Diff

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()