Skip to content

Commit

Permalink
Merge pull request #86 from ggtakec/update_etc
Browse files Browse the repository at this point in the history
Changed support OS and Fixed about cppcheck, etc
  • Loading branch information
ggtakec authored Mar 11, 2024
2 parents 4dfda8b + f566643 commit 6660622
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 53 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,26 @@ jobs:
- rockylinux:9
- rockylinux:8
- centos:centos7
- fedora:39
- fedora:38
- fedora:37
- alpine:3.19
- alpine:3.18

container:
image: ${{ matrix.container }}

steps:
# [NOTE]
# actions/checkout@v3 uses nodejs v16 and will be deprecated.
# However, @v4 does not work on centos7 depending on the glibc version,
# so we will continue to use @v3.
#
# Checks-out your repository under $GITHUB_WORKSPACE, so your
# job can access it
#
- name: Checkout sources
- name: Checkout source code(other than centos7)
if: matrix.container != 'centos:centos7'
uses: actions/checkout@v4

- name: Checkout source code(only centos7)
if: matrix.container == 'centos:centos7'
uses: actions/checkout@v3

#
Expand Down Expand Up @@ -153,18 +160,18 @@ jobs:
# <default tag flag>: If you want to use the created Docker image as the default image, specify "default".
#
imageinfo:
- alpine:3.18,alpine:3.18,alpine,default
- alpine:3.19,alpine:3.19,alpine,default
- ubuntu:22.04,ubuntu:22.04,ubuntu

#
# Run building and pushing helper
#
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

#
# Login to avoid the Docker Hub rate limit
Expand All @@ -178,7 +185,7 @@ jobs:
#
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESSTOKEN }}
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/ostypevars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ elif [ "${CI_OSTYPE}" = "centos:7" ] || [ "${CI_OSTYPE}" = "centos:centos7" ]; t
PKG_EXT="rpm"
IS_OS_CENTOS=1

elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
DIST_TAG="fedora/38"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libyaml-devel chmpx-devel nss-devel"
elif [ "${CI_OSTYPE}" = "fedora:39" ]; then
DIST_TAG="fedora/39"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libyaml-devel chmpx-devel nss-devel systemd"
INSTALLER_BIN="dnf"
UPDATE_CMD="update"
UPDATE_CMD_ARG=""
Expand All @@ -242,8 +242,8 @@ elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
PKG_EXT="rpm"
IS_OS_FEDORA=1

elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
DIST_TAG="fedora/37"
elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
DIST_TAG="fedora/38"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libyaml-devel chmpx-devel nss-devel"
INSTALLER_BIN="dnf"
UPDATE_CMD="update"
Expand All @@ -256,6 +256,20 @@ elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
PKG_EXT="rpm"
IS_OS_FEDORA=1

elif [ "${CI_OSTYPE}" = "alpine:3.19" ]; then
DIST_TAG="alpine/v3.19"
INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf libtool groff util-linux-misc musl-locales ruby-dev procps yaml-dev chmpx-dev openssl-dev"
INSTALLER_BIN="apk"
UPDATE_CMD="update"
UPDATE_CMD_ARG="--no-progress"
INSTALL_CMD="add"
INSTALL_CMD_ARG="--no-progress --no-cache"
INSTALL_AUTO_ARG=""
INSTALL_QUIET_ARG="-q"
PKG_OUTPUT_DIR="apk_build"
PKG_EXT="apk"
IS_OS_ALPINE=1

elif [ "${CI_OSTYPE}" = "alpine:3.18" ]; then
DIST_TAG="alpine/v3.18"
INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf libtool groff util-linux-misc musl-locales ruby-dev procps yaml-dev chmpx-dev openssl-dev"
Expand Down
38 changes: 29 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,50 @@ EXTRA_DIST=RELEASE_VERSION @CONFIGURECUSTOM@
# Versions of cppcheck below 1.8 perform poorly and the test is
# skipped if those versions are installed.
#
CPPCHECK_NG_VERSION = -e \^0\\. -e \^1\\.[0-7]
CPPCHECK_NG_VER = -e \^0\\. -e \^1\\.[0-7]
CPPCHECK_CMD = cppcheck
CPPCHECK_TARGET = $(SUBDIRS)
CPPCHECK_BUILD_DIR = /tmp/cppcheck
CPPCHECK_BASE_OPT = --quiet \
--error-exitcode=1 \
--inline-suppr \
-j 4 \
-j 8 \
--std=c++03 \
--xml
CPPCHECK_ENABLE_OPT = --enable=warning,style,information,missingInclude
CPPCHECK_IGNORE_OPT = --suppress=unmatchedSuppression
CPPCHECK_INCDIR_OPT = -I . -I lib
CPPCHECK_DEFINE_OPT =

# [NOTE] Switch options
# The options available vary depending on the version.
# There are cases where you use options that do not exist in older
# versions.
#
CPPCHECK_GT207_VER = 2007
CPPCHECK_GT207_ADD_OPT = --suppress=ctuOneDefinitionRuleViolation
CPPCHECK_GE211_VER = 2011
CPPCHECK_GE211_ADD_OPT = --check-level=exhaustive \
--suppress=missingIncludeSystem

cppcheck:
@if command -v $(CPPCHECK_CMD) >/dev/null 2>&1; then \
if ($(CPPCHECK_CMD) --version | sed -e 's|Cppcheck[[:space:]]*||gi' | grep -q $(CPPCHECK_NG_VERSION)); then \
@set -e; \
if command -v $(CPPCHECK_CMD) >/dev/null 2>&1; then \
if ($(CPPCHECK_CMD) --version | sed -e 's|Cppcheck[[:space:]]*||gi' | grep -q $(CPPCHECK_NG_VER)); then \
echo "*** [INFO] cppcheck version below 1.8, so skip to run cppcheck."; \
else \
echo "*** Check all files with CppCheck"; \
if [ -d $(CPPCHECK_BUILD_DIR) ]; then \
rm -rf $(CPPCHECK_BUILD_DIR); \
fi; \
mkdir -p $(CPPCHECK_BUILD_DIR); \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
if test `$(CPPCHECK_CMD) --version | sed -e 's/\./ /g' | awk '{print ($$2 * 1000 + $$3)}'` -le $(CPPCHECK_GT207_VER); then \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_INCDIR_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
elif test `$(CPPCHECK_CMD) --version | sed -e 's/\./ /g' | awk '{print ($$2 * 1000 + $$3)}'` -lt $(CPPCHECK_GE211_VER); then \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_INCDIR_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) $(CPPCHECK_GT207_ADD_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
else \
$(CPPCHECK_CMD) $(CPPCHECK_BASE_OPT) $(CPPCHECK_DEFINE_OPT) $(CPPCHECK_INCDIR_OPT) $(CPPCHECK_ENABLE_OPT) $(CPPCHECK_IGNORE_OPT) $(CPPCHECK_GT207_ADD_OPT) $(CPPCHECK_GE211_ADD_OPT) --cppcheck-build-dir=$(CPPCHECK_BUILD_DIR) $(CPPCHECK_TARGET); \
fi; \
rm -rf $(CPPCHECK_BUILD_DIR); \
fi; \
else \
Expand All @@ -76,16 +95,17 @@ SHELLCHECK_FILES_SH = `grep -ril '^\#!/bin/sh' . | grep '\.sh' | grep -v '\
SHELLCHECK_FILES_INCLUDE_SH = `grep -Lir '^\#!/bin/sh' . | grep '\.sh' | grep -v '\.log' | grep -v '/\.git/' | grep -v '/rpmbuild/' | grep -v '/debian_build/' | grep -v '/autom4te.cache/' | grep -v '/m4/' | grep -v '/install-sh' | grep -v '/ltmain.sh' | tr '\n' ' '`

shellcheck:
@if type shellcheck > /dev/null 2>&1; then \
@set -e; \
if type shellcheck > /dev/null 2>&1; then \
echo "*** Check all files with ShellCheck"; \
if [ -n "$(SHELLCHECK_FILES_NO_SH)" ]; then \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_NO_SH) || exit 1; \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_NO_SH); \
fi; \
if [ -n "$(SHELLCHECK_FILES_SH)" ]; then \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_SH) || exit 1; \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_IGN_OPT) $(SHELLCHECK_FILES_SH); \
fi; \
if [ -n "$(SHELLCHECK_FILES_INCLUDE_SH)" ]; then \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_INCLUDE_IGN_OPT) $(SHELLCHECK_FILES_INCLUDE_SH) || exit 1; \
LC_ALL=C.UTF-8 $(SHELLCHECK_CMD) $(SHELLCHECK_BASE_OPT) $(SHELLCHECK_INCLUDE_IGN_OPT) $(SHELLCHECK_FILES_INCLUDE_SH); \
fi; \
echo " -> No error was detected."; \
echo ""; \
Expand Down
6 changes: 3 additions & 3 deletions buildutils/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: @PACKAGE_NAME@
Section: database
Priority: optional
Maintainer: @DEV_NAME@ <@DEV_EMAIL@>
Build-Depends: @DEBHELPER_DEP@, k2hash-dev (>= 1.0.92), chmpx-dev (>= 1.0.104), libfullock-dev (>= 1.0.57), libyaml-dev, gnutls-dev
Build-Depends: @DEBHELPER_DEP@, k2hash-dev (>= 1.0.93), chmpx-dev (>= 1.0.105), libfullock-dev (>= 1.0.59), libyaml-dev, gnutls-dev
Standards-Version: 3.9.8
Homepage: https://@GIT_DOMAIN@/@GIT_ORG@/@GIT_REPO@
Vcs-Git: git://@GIT_DOMAIN@/@GIT_ORG@/@[email protected]
Expand All @@ -11,14 +11,14 @@ Vcs-Browser: https://@GIT_DOMAIN@/@GIT_ORG@/@GIT_REPO@
Package: @PACKAGE_NAME@-dev
Section: devel
Architecture: amd64
Depends: ${misc:Depends}, @PACKAGE_NAME@ (= ${binary:Version}), k2hash-dev (>= 1.0.92), chmpx-dev (>= 1.0.104), libfullock-dev (>= 1.0.57), libyaml-dev, gnutls-dev
Depends: ${misc:Depends}, @PACKAGE_NAME@ (= ${binary:Version}), k2hash-dev (>= 1.0.93), chmpx-dev (>= 1.0.105), libfullock-dev (>= 1.0.59), libyaml-dev, gnutls-dev
Description: @SHORTDESC@ (development)
Development package for building with @PACKAGE_NAME@ shared library.
This package has header files and symbols for it.

Package: @PACKAGE_NAME@
Section: database
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, init-system-helpers (>= 1.14), k2hash (>= 1.0.92), chmpx (>= 1.0.104), libfullock (>= 1.0.57)
Depends: ${shlibs:Depends}, ${misc:Depends}, init-system-helpers (>= 1.14), k2hash (>= 1.0.93), chmpx (>= 1.0.105), libfullock (>= 1.0.59)
Description: @SHORTDESC@
@DEBLONGDESC@
8 changes: 4 additions & 4 deletions buildutils/k2hdkc.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ License: @PKGLICENSE@
@RPMPKG_GROUP@
URL: https://@GIT_DOMAIN@/@GIT_ORG@/@PACKAGE_NAME@
Source0: https://@GIT_DOMAIN@/@GIT_ORG@/@PACKAGE_NAME@/archive/%{gittag}/%{name}-%{version}.tar.gz
Requires: libfullock%{?_isa} >= 1.0.57, k2hash%{?_isa} >= 1.0.92, chmpx%{?_isa} >= 1.0.104
Requires: libfullock%{?_isa} >= 1.0.59, k2hash%{?_isa} >= 1.0.93, chmpx%{?_isa} >= 1.0.105
%if 0%{?rhel} == 6
BuildRequires: git-core gcc-c++ make libtool libfullock-devel >= 1.0.57, k2hash-devel >= 1.0.92, chmpx-devel >= 1.0.104, libyaml-devel, nss-devel
BuildRequires: git-core gcc-c++ make libtool libfullock-devel >= 1.0.59, k2hash-devel >= 1.0.93, chmpx-devel >= 1.0.105, libyaml-devel, nss-devel
%else
BuildRequires: systemd git-core gcc-c++ make libtool libfullock-devel >= 1.0.57, k2hash-devel >= 1.0.92, chmpx-devel >= 1.0.104, libyaml-devel, nss-devel
BuildRequires: systemd git-core gcc-c++ make libtool libfullock-devel >= 1.0.59, k2hash-devel >= 1.0.93, chmpx-devel >= 1.0.105, libyaml-devel, nss-devel
%endif

%description
Expand Down Expand Up @@ -126,7 +126,7 @@ rm -rf %{buildroot}
#
%package devel
Summary: @SHORTDESC@ (development)
Requires: %{name}%{?_isa} = %{version}-%{release}, libfullock-devel%{?_isa} >= 1.0.57, k2hash-devel%{?_isa} >= 1.0.92, chmpx-devel%{?_isa} >= 1.0.104, libyaml-devel, nss-devel
Requires: %{name}%{?_isa} = %{version}-%{release}, libfullock-devel%{?_isa} >= 1.0.59, k2hash-devel%{?_isa} >= 1.0.93, chmpx-devel%{?_isa} >= 1.0.105, libyaml-devel, nss-devel

%description devel
Development package for building with @PACKAGE_NAME@ shared library.
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ AC_ARG_ENABLE(check-depend-libs,
esac]
)
AS_IF([test ${check_depend_libs} = 1], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([fullock], [libfullock >= 1.0.57], [], [AC_MSG_ERROR(not found libfullock package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([k2hash], [libk2hash >= 1.0.92], [], [AC_MSG_ERROR(not found k2hash package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([chmpx], [libchmpx >= 1.0.104], [], [AC_MSG_ERROR(not found chmpx package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([fullock], [libfullock >= 1.0.59], [], [AC_MSG_ERROR(not found libfullock package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([k2hash], [libk2hash >= 1.0.93], [], [AC_MSG_ERROR(not found k2hash package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([chmpx], [libchmpx >= 1.0.105], [], [AC_MSG_ERROR(not found chmpx package)])])

#
# CFLAGS/CXXFLAGS
Expand Down
2 changes: 1 addition & 1 deletion lib/k2hdkc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ dkcres_type_t k2hdkc_get_res_code(k2hdkc_chmpx_h handle)
ERR_DKCPRN("Parameter handle is invalid.");
return DKC_NORESTYPE;
}
K2hdkcSlave* pSlave = reinterpret_cast<K2hdkcSlave*>(handle);
const K2hdkcSlave* pSlave = reinterpret_cast<K2hdkcSlave*>(handle);

return pSlave->GetResponseCode();
}
Expand Down
2 changes: 2 additions & 0 deletions lib/k2hdkccombase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,8 @@ bool K2hdkcCommand::CommandSending(void)
TriggerResponse = false;

// set callback
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownPointerToBool
if(!K2hdkcCommand::WaitFp(pSendComAll->com_head.comnumber, this, K2hdkcCommand::pWaitFpParam)){
// cppcheck-suppress literalWithCharPtrCompare
ERR_DKCPRN("Failed to set receive waiting callback for type(%s).", STR_DKCCOM_TYPE(pSendComAll->com_head.comtype));
Expand Down
4 changes: 1 addition & 3 deletions src/k2hdkcconfparser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,7 @@ bool K2hdkcConfig::InitializeK2hash(K2HShm& k2hash) const
ERR_DKCPRN("Failed to set k2hash about encrypt pass phrase.");
return false;
}
if(set_default){
set_default = false;
}
set_default = false;
}
}
MSG_DKCPRN("Succeed: set attributes");
Expand Down
Loading

0 comments on commit 6660622

Please sign in to comment.