|
1 | 1 | # |
2 | 2 | # Copyright(c) 2020-2022 Intel Corporation |
| 3 | +# Copyright(c) 2025 Huawei Technologies |
| 4 | +# Copyright(c) 2025 Brian J. Murrell |
3 | 5 | # SPDX-License-Identifier: BSD-3-Clause |
4 | 6 | # |
5 | 7 |
|
|
12 | 14 |
|
13 | 15 | %global __python %{__python3} |
14 | 16 | <DEBUG_PACKAGE> |
15 | | -%define kver %(uname -r) |
16 | | -%define kver_filename k%{expand:%(kname="%{kver}"; echo "${kname%.*}" | sed -r "y/-/_/;")} |
17 | | - |
18 | | - |
19 | | -Name: <CAS_NAME> |
20 | | -Version: <CAS_VERSION> |
21 | | -Release: 1%{?dist} |
22 | | -Summary: Open Cache Acceleration Software |
23 | | -Group: System |
24 | | -Vendor: Intel Corporation |
25 | | -License: <CAS_LICENSE_NAME> |
26 | | -URL: <CAS_HOMEPAGE> |
27 | | -Source0: https://github.com/Open-CAS/<CAS_NAME>/releases/download/v%{version}/%{name}-%{version}.tar.gz |
28 | | -Packager: <PACKAGE_MAINTAINER> |
29 | | -BuildRequires: coreutils, gawk, gcc, kernel-devel, kernel-headers, make |
30 | | -Requires: <CAS_NAME>-modules-%{version}, python3, sed, python3-PyYAML |
| 17 | +%define kver <KVER> |
| 18 | +# Following define takes kernel version, cuts everything after (and including) |
| 19 | +# second hyphen (-), and then cuts the architecture (including 'noarch') part. |
| 20 | +# It's the only package version variant that is accepted by RPM spec. |
| 21 | +%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}")} |
| 22 | +%define kver_filename k%{expand:%(echo "%{kver}" | sed -r "y/-/_/;")} |
| 23 | + |
| 24 | + |
| 25 | +Name: <CAS_NAME> |
| 26 | +Version: <CAS_VERSION> |
| 27 | +Release: 1%{?dist} |
| 28 | +Summary: Open Cache Acceleration Software |
| 29 | +Group: System |
| 30 | +License: <CAS_LICENSE_NAME> |
| 31 | +URL: <CAS_HOMEPAGE> |
| 32 | +Source0: https://github.com/Open-CAS/<CAS_NAME>/releases/download/v%{version}/%{name}-%{version}.tar.gz |
| 33 | +Packager: <PACKAGE_MAINTAINER> |
| 34 | +BuildRequires: coreutils |
| 35 | +BuildRequires: gawk |
| 36 | +BuildRequires: gcc |
| 37 | +BuildRequires: make |
| 38 | +BuildRequires: procps |
| 39 | +BuildRequires: python3 |
| 40 | +BuildRequires: kernel = %{kver_pkg} |
| 41 | +BuildRequires: kernel-devel = %{kver_pkg} |
| 42 | +# Allow using different version of kernel-headers package (some distros requires it). |
| 43 | +BuildRequires: kernel-headers |
| 44 | +BuildRequires: <LIBELF_PKG> |
| 45 | +BuildRequires: <UTIL_PKG> |
| 46 | +Requires: <CAS_NAME>-modules-%{version} |
| 47 | +Requires: python3 |
| 48 | +Requires: python3-PyYAML |
| 49 | +Requires: sed |
31 | 50 | %description |
32 | 51 | Open Cache Acceleration Software (Open CAS) is an open source project |
33 | 52 | encompassing block caching software libraries, adapters, tools and more. |
@@ -55,13 +74,14 @@ This package contains only CAS kernel modules. |
55 | 74 |
|
56 | 75 |
|
57 | 76 | %build |
| 77 | +export KERNEL_DIR=/lib/modules/%{kver}/build/ |
58 | 78 | ./configure |
59 | 79 | <MAKE_BUILD> |
60 | 80 |
|
61 | 81 |
|
62 | 82 | %install |
63 | 83 | rm -rf $RPM_BUILD_ROOT |
64 | | -/usr/bin/make install_files DESTDIR=$RPM_BUILD_ROOT |
| 84 | +/usr/bin/make install_files DESTDIR=$RPM_BUILD_ROOT KERNEL_VERSION=%{kver} |
65 | 85 |
|
66 | 86 |
|
67 | 87 | %post |
@@ -98,7 +118,7 @@ if [[ ! "$ID_LIKE" =~ suse|sles ]]; then |
98 | 118 | printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --add-modules |
99 | 119 | else |
100 | 120 | for version in $(echo "${modules[@]}" | tr " " "\n" | cut -d"/" -f4 | sort | uniq); do |
101 | | - # run depmod for all kernel versions for which the modules installed |
| 121 | + # run depmod for all kernel versions for which the modules installed |
102 | 122 | depmod $version |
103 | 123 | done |
104 | 124 | fi |
|
161 | 181 |
|
162 | 182 |
|
163 | 183 | %changelog |
| 184 | +* Mon Aug 25 2025 Rafal Stefanowski <rafal.stefanowski@huawei.com> - 25.03-1 |
| 185 | +* Thu Aug 7 2025 Brian J. Murrell <brian@interlinx.bc.ca> - 25.03-1 |
| 186 | +- Allow building RPM packages for different kernel versions |
| 187 | +- Update dependencies |
164 | 188 | * Mon Mar 21 2022 Rafal Stefanowski <rafal.stefanowski@intel.com> - 22.03-1 |
165 | 189 | - Update modules destination directory and permissions |
166 | 190 | - Add license to modules package |
|
0 commit comments