Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion casadm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ clean:
distclean: clean

install: install_files
@mandb -q

install_files:
@echo "Installing casadm"
@install -m 755 -D $(TARGET) $(DESTDIR)$(BINARY_PATH)/$(TARGET)
@install -m 644 -D $(TARGET).8.gz $(DESTDIR)/usr/share/man/man8/$(TARGET).8.gz
@mandb -q

uninstall:
@echo "Uninstalling casadm"
Expand Down
60 changes: 42 additions & 18 deletions tools/pckgen.d/rpm/CAS_NAME.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#
# Copyright(c) 2020-2022 Intel Corporation
# Copyright(c) 2025 Huawei Technologies
# Copyright(c) 2025 Brian J. Murrell
# SPDX-License-Identifier: BSD-3-Clause
#

Expand All @@ -12,22 +14,39 @@

%global __python %{__python3}
<DEBUG_PACKAGE>
%define kver %(uname -r)
%define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")}


Name: <CAS_NAME>
Version: <CAS_VERSION>
Release: 1%{?dist}
Summary: Open Cache Acceleration Software
Group: System
Vendor: Intel Corporation
License: <CAS_LICENSE_NAME>
URL: <CAS_HOMEPAGE>
Source0: https://github.com/Open-CAS/<CAS_NAME>/releases/download/v%{version}/%{name}-%{version}.tar.gz
Packager: <PACKAGE_MAINTAINER>
BuildRequires: coreutils, gawk, gcc, kernel-devel, kernel-headers, make
Requires: <CAS_NAME>-modules-%{version}, python3, sed, python3-PyYAML
%define kver <KVER>
# Following define takes kernel version, cuts everything after (and including)
# second hyphen (-), and then cuts the architecture (including 'noarch') part.
# It's the only package version variant that is accepted by RPM spec.
%define kver_pkg %{expand:%(kpkg="%{kver}"; for i in $(seq 2 $(grep -o '-' <<<$kpkg | grep -c .)); do kpkg="${kpkg%%-*}"; done; kpkg="${kpkg%%.$(uname -m)}"; echo "${kpkg%%.noarch}")}
%define kver_filename k%{expand:%(echo "%{kver}" | sed -r "y/-/_/;")}


Name: <CAS_NAME>
Version: <CAS_VERSION>
Release: 1%{?dist}
Summary: Open Cache Acceleration Software
Group: System
License: <CAS_LICENSE_NAME>
URL: <CAS_HOMEPAGE>
Source0: https://github.com/Open-CAS/<CAS_NAME>/releases/download/v%{version}/%{name}-%{version}.tar.gz
Packager: <PACKAGE_MAINTAINER>
BuildRequires: coreutils
BuildRequires: gawk
BuildRequires: gcc
BuildRequires: make
BuildRequires: procps
BuildRequires: python3
BuildRequires: kernel = %{kver_pkg}
BuildRequires: kernel-devel = %{kver_pkg}
# Allow using different version of kernel-headers package (some distros requires it).
BuildRequires: kernel-headers
BuildRequires: <LIBELF_PKG>
BuildRequires: <UTIL_PKG>
Requires: <CAS_NAME>-modules-%{version}
Requires: python3
Requires: python3-PyYAML
Requires: sed
%description
Open Cache Acceleration Software (Open CAS) is an open source project
encompassing block caching software libraries, adapters, tools and more.
Expand Down Expand Up @@ -55,13 +74,14 @@ This package contains only CAS kernel modules.


%build
export KERNEL_DIR=/lib/modules/%{kver}/build/
./configure
<MAKE_BUILD>


%install
rm -rf $RPM_BUILD_ROOT
/usr/bin/make install_files DESTDIR=$RPM_BUILD_ROOT
/usr/bin/make install_files DESTDIR=$RPM_BUILD_ROOT KERNEL_VERSION=%{kver}


%post
Expand Down Expand Up @@ -98,7 +118,7 @@ if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --add-modules
else
for version in $(echo "${modules[@]}" | tr " " "\n" | cut -d"/" -f4 | sort | uniq); do
# run depmod for all kernel versions for which the modules installed
# run depmod for all kernel versions for which the modules installed
depmod $version
done
fi
Expand Down Expand Up @@ -161,6 +181,10 @@ fi


%changelog
* Mon Aug 25 2025 Rafal Stefanowski <rafal.stefanowski@huawei.com> - 25.03-1
* Thu Aug 7 2025 Brian J. Murrell <brian@interlinx.bc.ca> - 25.03-1
- Allow building RPM packages for different kernel versions
- Update dependencies
* Mon Mar 21 2022 Rafal Stefanowski <rafal.stefanowski@intel.com> - 22.03-1
- Update modules destination directory and permissions
- Add license to modules package
Expand Down
Loading