!61 [sync] PR-60: 【openEuler-23.09】Refix the failure of building with cppcheck>=2.11 by using upstream patch

From: @openeuler-sync-bot 
Reviewed-by: @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
This commit is contained in:
openeuler-ci-bot 2023-08-17 01:45:48 +00:00 committed by Gitee
commit a432f6b3d9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 41 additions and 8 deletions

View File

@ -0,0 +1,33 @@
From 2a49df86007becae89f335025e549bdbd26a24d2 Mon Sep 17 00:00:00 2001
From: Ondrej Mosnacek <omosnace@redhat.com>
Date: Wed, 26 Jul 2023 10:32:34 +0200
Subject: [PATCH] Prevent cppcheck from defining CHECK_DIR
Recent versions of cppcheck fail with a syntax error when they check
apps/kcapi-hasher.c with CHECK_DIR defined (probably they now define it
to 1 instead of an empty value). To fix it, instruct cppcheck to only
check with CHECK_DIR left undefined.
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2225970
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 0a6ff26..0189848 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -241,7 +241,7 @@ endif
if HAVE_CPPCHECK
cppcheck:
- $(CPPCHECK) --error-exitcode=42 --enable=performance,warning,portability $(sort $(SCAN_FILES))
+ $(CPPCHECK) -U CHECK_DIR --error-exitcode=42 --enable=performance,warning,portability $(sort $(SCAN_FILES))
endif
if HAVE_MKTEMP
--
2.27.0

View File

@ -8,9 +8,6 @@
%define enable_docbook_pdf 0
%endif
# check failed with cppcheck >= 2.11
%define min_cppcheck %pkg_version_cmp cppcheck 2.11
# Calculate hmac file after installing for binary
%define __spec_install_post \
%{?__debug_package:%{__debug_install_post}} \
@ -29,7 +26,7 @@ ln -s libkcapi.so.%{version}.hmac %{buildroot}/%{_lib}/fipscheck/libkcapi.so.
Name: libkcapi
Version: 1.4.0
Release: 4
Release: 5
Summary: libkcapi - Linux Kernel Crypto API User Space Interface Library
License: BSD or GPLv2
@ -39,6 +36,7 @@ Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc
Patch0: libkcapi-1.1.1-lib_Fix_kcapi_handle_destroy_closing_FD_0.patch
Patch1: backport-Append-newline-to-stdout.patch
Patch2: backport-Prevent-cppcheck-from-defining-CHECK_DIR.patch
BuildRequires: clang coreutils cppcheck gcc hardlink
BuildRequires: libtool openssl perl systemd xmlto kernel-headers >= 4.10.0
@ -178,10 +176,6 @@ done
%ldconfig_scriptlets
%check
%if %{min_cppcheck} >= 0
# add -UCHECK_DIR to cppcheck with cppcheck >= 2.11
sed -i 's/\$(CPPCHECK)/\$(CPPCHECK) -UCHECK_DIR/' Makefile
%endif
for t in cppcheck scan;do
%make_build $t
done
@ -227,6 +221,12 @@ popd
%{_mandir}/man3/kcapi_*.3.*
%changelog
* Wed Aug 16 2023 yixiangzhike <yixiangzhike007@163.com> - 1.4.0-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:refix the failure of building with cppcheck>=2.11 by using upstream patch
* Tue Aug 15 2023 yixiangzhike <yixiangzhike007@163.com> - 1.4.0-4
- Type:bugfix
- ID:NA