Created
May 13, 2020 02:08
-
-
Save chenxiaolong/d7f8321a5d45e4770d1dd31e7bc6ce66 to your computer and use it in GitHub Desktop.
[zfs-0.8.4] Update rpm packaging to build akmods package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From aa9c17e52a694fc3fa7d31aa232045ba61b47cb5 Mon Sep 17 00:00:00 2001 | |
From: Andrew Gunnerson <[email protected]> | |
Date: Tue, 12 May 2020 22:05:28 -0400 | |
Subject: [PATCH] rpm: Add support for building an akmods package | |
Signed-off-by: Andrew Gunnerson <[email protected]> | |
--- | |
config/zfs-build.m4 | 7 ++++--- | |
rpm/generic/zfs-kmod.spec.in | 28 ++++++++++++++++++++++++---- | |
2 files changed, 28 insertions(+), 7 deletions(-) | |
diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 | |
index 92aa6030d..e620e6af7 100644 | |
--- a/config/zfs-build.m4 | |
+++ b/config/zfs-build.m4 | |
@@ -294,9 +294,10 @@ AC_DEFUN([ZFS_AC_RPM], [ | |
AC_SUBST(MULTIARCH_LIBDIR) | |
]) | |
- RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"' | |
- RPM_DEFINE_KMOD+=' --define "ksrc $(LINUX)"' | |
- RPM_DEFINE_KMOD+=' --define "kobj $(LINUX_OBJ)"' | |
+ #RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"' | |
+ #RPM_DEFINE_KMOD+=' --define "ksrc $(LINUX)"' | |
+ #RPM_DEFINE_KMOD+=' --define "kobj $(LINUX_OBJ)"' | |
+ RPM_DEFINE_KMOD='' | |
RPM_DEFINE_KMOD+=' --define "_wrong_version_format_terminate_build 0"' | |
RPM_DEFINE_DKMS='' | |
diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in | |
index 4a8f66231..d2601257a 100644 | |
--- a/rpm/generic/zfs-kmod.spec.in | |
+++ b/rpm/generic/zfs-kmod.spec.in | |
@@ -1,3 +1,4 @@ | |
+%define debug_package %{nil} | |
%define module @PACKAGE@ | |
# See comment in zfs.spec.in. | |
@@ -31,13 +32,13 @@ | |
%endif | |
%endif | |
-#define repo rpmfusion | |
+%define repo rpmfusion | |
#define repo chaos | |
# (un)define the next line to either build for the newest or all current kernels | |
-%define buildforkernels newest | |
+#define buildforkernels newest | |
#define buildforkernels current | |
-#define buildforkernels akmod | |
+%define buildforkernels akmod | |
%bcond_with debug | |
%bcond_with debuginfo | |
@@ -68,7 +69,7 @@ Conflicts: %{module}-dkms | |
# Building for a repository use the proper build-sysbuild package | |
# to determine which kernel-devel packages should be installed. | |
BuildRequires: %{_bindir}/kmodtool | |
-%{!?kernels:BuildRequires: buildsys-build-%{repo}-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu}} | |
+#%{!?kernels:BuildRequires: buildsys-build-%{repo}-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu}} | |
%else | |
@@ -104,6 +105,16 @@ BuildRequires: %{_bindir}/kmodtool | |
%description | |
This package contains the ZFS kernel modules. | |
+# akmod package requires -common subpackage | |
+%package common | |
+Summary: Common files for the ZFS kernel modules | |
+Requires: %{name} = %{version}-%{release} | |
+BuildArch: noarch | |
+ | |
+%description common | |
+This package contains the common files (license, documentation, etc.) for the | |
+ZFS kernel modules. | |
+ | |
%prep | |
# Error out if there was something wrong with kmodtool. | |
%{?kmodtool_check} | |
@@ -128,6 +139,9 @@ bash %{SOURCE10} --target %{_target_cpu} %{?repo:--repo %{?repo}} --kmodname %{ | |
%setup -q -c -T -a 0 | |
+# For common package | |
+cp %{module}-%{version}/{COPYRIGHT,LICENSE,NOTICE,README.md} . | |
+ | |
for kernel_version in %{?kernel_versions}; do | |
%{__mkdir} _kmod_build_${kernel_version%%___*} | |
done | |
@@ -159,9 +173,15 @@ for kernel_version in %{?kernel_versions}; do | |
cd .. | |
done | |
# find-debuginfo.sh only considers executables | |
+%if %{defined kernel_versions} | |
chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/* | |
+%endif | |
%{?akmod_install} | |
%clean | |
rm -rf $RPM_BUILD_ROOT | |
+ | |
+%files common | |
+%doc README.md | |
+%license COPYRIGHT LICENSE NOTICE | |
-- | |
2.26.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment