Spec: Implement KMP package for OpenSUSE Tumbleweed

At least on OBS, opensuse leap <=16.1 come with linux 6.12,
so no KMP for them...
This commit is contained in:
Roman Lebedev 2025-11-19 02:18:38 +03:00
parent bf5087c071
commit db2af22c69
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
3 changed files with 50 additions and 4 deletions

View File

@ -280,6 +280,7 @@ jobs:
addFilter("dkms-bcachefs.noarch: E: devel-file-in-non-devel-package")
EOT
tar -xvf *.tar.xz -C "$OBS_REPO_DIR" --wildcards '*/bcachefs-tools.spec' --strip-components=1
tar -xvf *.tar.xz -C "$OBS_REPO_DIR" --wildcards '*/bcachefs-kmp.spec-preambule' --strip-components=1
tar -xvf *.tar.xz -C "$OBS_REPO_DIR" --wildcards '*/debian/cargo.config' --strip-components=2
patch "$OBS_REPO_DIR/bcachefs-tools.spec" <<EOF
--- a/bcachefs-tools.spec

View File

@ -0,0 +1,6 @@
Requires: %{name} = %{version}-%{release}
Requires: kernel-%1
Provides: multiversion(kernel)
Enhances: kernel-%1
Supplements: (bcachefs-tools and kernel-%1)
Recommends: %{name}-ueficert = %{version}

View File

@ -15,14 +15,24 @@
%global make_opts VERSION="%{version}" BCACHEFS_FUSE=1 BUILD_VERBOSE=1 PREFIX=%{_prefix} ROOT_SBINDIR=%{_sbindir}
%global MSRV 1.77
%global MINIMAL_KERNEL_VERSION_FOR_TOOLS 6.11.3
%global MINIMAL_KERNEL_VERSION_FOR_MODULE 6.16
%global _KMP_TMPDIR "%{_tmppath}/%{name}-%{version}-kmp"
%if %{undefined _with_kmp}
%if 0%{?suse_version} >= 1690
%global _with_kmp 1
%endif
%endif
Name: bcachefs-tools
# define with i.e. --define '_version 1.0'
Version: 0%{?_version}
Release: 0%{?dist}
Summary: Userspace tools for bcachefs
%global MSRV 1.77
# --- rust ---
# Apache-2.0
# Apache-2.0 OR MIT
@ -43,6 +53,7 @@ Source: bcachefs-tools_%{version}.tar.xz
Source1: bcachefs-tools_%{version}.tar.xz.sig
Source2: apt.bcachefs.org.keyring
Source3: cargo.config
Source4: bcachefs-kmp.spec-preambule
Source99: %{dkmsname}.rpmlintrc
%else
Source: https://evilpiepirate.org/%{name}/%{name}-vendored-%{version}.tar.zst
@ -67,7 +78,7 @@ BuildRequires: rust >= %{MSRV}
BuildRequires: rustc >= %{MSRV}
%endif
BuildRequires: kernel-headers >= 6.11.3
BuildRequires: kernel-headers >= %{MINIMAL_KERNEL_VERSION_FOR_TOOLS}
BuildRequires: libaio-devel >= 0.3.111
BuildRequires: libattr-devel
BuildRequires: pkgconfig(blkid)
@ -88,6 +99,13 @@ BuildRequires: pkgconfig
BuildRequires: systemd-rpm-macros
%if 0%{?_with_kmp} != 0
BuildRequires: %kernel_module_package_buildreqs
BuildRequires: kernel-devel >= %{MINIMAL_KERNEL_VERSION_FOR_MODULE}
BuildRequires: kernel-syms >= %{MINIMAL_KERNEL_VERSION_FOR_MODULE}
%kernel_module_package -n %{kmodname} -x xen -p %_sourcedir/bcachefs-kmp.spec-preambule
%endif
# Rust parts FTBFS on 32-bit arches
ExcludeArch: %{ix86} %{arm32}
@ -130,7 +148,7 @@ mount, create, check, modify and correct any inconsistencies in the bcachefs fil
Summary: Bcachefs kernel module managed by DKMS
Requires: diffutils
Requires: dkms >= 3.2.1
Requires: kernel-devel >= 6.16
Requires: kernel-devel >= %{MINIMAL_KERNEL_VERSION_FOR_MODULE}
Requires: gcc
Requires: make
Requires: perl
@ -197,6 +215,16 @@ cp %{_sourcedir}/cargo.config $PWD/.cargo/config.toml
%set_build_flags
%make_build %{make_opts}
%if 0%{?_with_kmp} != 0
%make_build install_dkms DKMSDIR="%{_KMP_TMPDIR}/src"
for kmp_flavor in %{?flavors_to_build}; do
rm -Rf "%{_KMP_TMPDIR}/obj-$kmp_flavor"
cp -a "%{_KMP_TMPDIR}/src/." "%{_KMP_TMPDIR}/obj-$kmp_flavor"
%make_build \
-C "%{_KMP_TMPDIR}/obj-$kmp_flavor" \
KDIR="/usr/src/linux-obj/%_target_cpu/$kmp_flavor"
done
%endif
%install
%if 0%{?_version} == 0
@ -212,8 +240,19 @@ cp %{_sourcedir}/cargo.config $PWD/.cargo/config.toml
# Purge unneeded debian stuff
rm -rfv %{buildroot}/%{_datadir}/initramfs-tools
%if 0%{?_with_kmp} != 0
for kmp_flavor in %{?flavors_to_build}; do
%make_build \
-C "/usr/src/linux-obj/%_target_cpu/$kmp_flavor" \
M="%{_KMP_TMPDIR}/obj-$kmp_flavor" \
INSTALL_MOD_PATH="%buildroot" \
modules_install
done
%endif
%changelog
* Sun Nov 19 2025 Roman Lebedev <lebedev.ri@gmail.com>
- Implement KMP package for OpenSUSE Tumbleweed
* Sun Oct 19 2025 Roman Lebedev <lebedev.ri@gmail.com>
- Fix DKMS support on SUSE
* Sun Oct 12 2025 Roman Lebedev <lebedev.ri@gmail.com>