From 76012d701b71350f2491463ec223e247a87faad0 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 27 Sep 2025 16:48:25 -0400 Subject: [PATCH] New RPM packaging derived from the Fedora package This works as a new reference package and can be built from the Makefile with "make rpm". It will work for virtually all RPM distributions. Signed-off-by: Neal Gompa --- Makefile | 2 +- bcachefs-tools.spec | 178 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 bcachefs-tools.spec diff --git a/Makefile b/Makefile index 9e41dcd4..3a770390 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ deb: all .PHONY: rpm rpm: clean - rpmbuild --build-in-place -bb --define "_version $(subst -,_,$(VERSION))" packaging/bcachefs-tools.spec + rpmbuild --build-in-place -bb --define "_version $(subst -,_,$(VERSION))" bcachefs-tools.spec bcachefs-principles-of-operation.pdf: doc/bcachefs-principles-of-operation.tex pdflatex doc/bcachefs-principles-of-operation.tex diff --git a/bcachefs-tools.spec b/bcachefs-tools.spec new file mode 100644 index 00000000..b5289da7 --- /dev/null +++ b/bcachefs-tools.spec @@ -0,0 +1,178 @@ +%global kmodname bcachefs + +# Ensure that the build script shell is bash +%global _buildshell /bin/bash + +%global dkmsname dkms-%{kmodname} + +# SUSE Linux does not define the dist tag, so we must define it manually +%if "%{_vendor}" == "suse" +%global dist .suse%{?suse_version} +%endif + +# Disable LTO for now until more testing can be done. +%global _lto_cflags %{nil} + +%global make_opts VERSION="%{version}" BCACHEFS_FUSE=1 BUILD_VERBOSE=1 PREFIX=%{_prefix} ROOT_SBINDIR=%{_sbindir} + +Name: bcachefs-tools +# define with i.e. --define '_version 1.0' +Version: %{_version} +Release: 0%{?dist} +Summary: Userspace tools for bcachefs + +# --- rust --- +# Apache-2.0 +# Apache-2.0 OR MIT +# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT +# MIT +# MIT OR Apache-2.0 +# MPL-2.0 +# Unlicense OR MIT +# --- misc --- +# GPL-2.0-only +# GPL-2.0-or-later +# LGPL-2.1-only +# BSD-3-Clause +License: GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-only AND BSD-3-Clause AND (Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 with LLVM-exception OR Apache-2.0 OR MIT) AND MIT AND MPL-2.0 AND (Unlicense OR MIT)) +URL: https://bcachefs.org/ +Source: https://evilpiepirate.org/%{name}/%{name}-vendored-%{version}.tar.zst + +BuildRequires: findutils +BuildRequires: gcc +BuildRequires: jq +BuildRequires: make +BuildRequires: tar +BuildRequires: zstd + +BuildRequires: cargo + +%if 0%{?suse_version} +BuildRequires: rust +%else +BuildRequires: rustc +%endif + +BuildRequires: libaio-devel +BuildRequires: libattr-devel +BuildRequires: pkgconfig(blkid) +BuildRequires: pkgconfig(fuse3) >= 3.7 +BuildRequires: pkgconfig(libkeyutils) +BuildRequires: pkgconfig(liblz4) +BuildRequires: pkgconfig(libsodium) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(liburcu) +BuildRequires: pkgconfig(libzstd) +BuildRequires: pkgconfig(udev) +BuildRequires: pkgconfig(uuid) +BuildRequires: pkgconfig(zlib) + +BuildRequires: clang-devel +BuildRequires: llvm-devel +BuildRequires: pkgconfig + +BuildRequires: systemd-rpm-macros + +# Rust parts FTBFS on 32-bit arches +ExcludeArch: %{ix86} %{arm32} + +%description +The bcachefs-tools package provides all the userspace programs needed to create, +check, modify and correct any inconsistencies in the bcachefs filesystem. + +%files +%license COPYING +%doc doc/bcachefs-principles-of-operation.tex +%doc doc/bcachefs.5.rst.tmpl +%{_sbindir}/bcachefs +%{_sbindir}/mount.bcachefs +%{_sbindir}/fsck.bcachefs +%{_sbindir}/mkfs.bcachefs +%{_mandir}/man8/bcachefs.8* +%{_udevrulesdir}/64-bcachefs.rules + +# ---------------------------------------------------------------------------- + +%package -n fuse-bcachefs +Summary: FUSE implementation of bcachefs +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n fuse-bcachefs +This package is an experimental implementation of bcachefs leveraging FUSE to +mount, create, check, modify and correct any inconsistencies in the bcachefs filesystem. + +%files -n fuse-bcachefs +%license COPYING +%{_sbindir}/mount.fuse.bcachefs +%{_sbindir}/fsck.fuse.bcachefs +%{_sbindir}/mkfs.fuse.bcachefs + +# ---------------------------------------------------------------------------- + +%package -n %{dkmsname} +Summary: Bcachefs kernel module managed by DKMS +Requires: diffutils +Requires: dkms >= 3.2.1 +Requires: gcc +Requires: make +Requires: perl +Requires: python3 + +Requires: %{name} = %{version}-%{release} + +# For Fedora/RHEL systems +%if 0%{?fedora} || 0%{?rhel} +Supplements: (bcachefs-tools and kernel-core) +%endif +# For SUSE systems +%if 0%{?suse_version} +Supplements: (bcachefs-tools and kernel-default) +%endif + +BuildArch: noarch + +%description -n %{dkmsname} +This package is an implementation of bcachefs built using DKMS to offer the kernel +module to mount, create, check, modify and correct any inconsistencies in the bcachefs +filesystem. + +%preun -n %{dkmsname} +if [ "$(dkms status -m %{kmodname} -v %{version})" ]; then + dkms remove -m %{kmodname} -v %{version} --all --rpm_safe_upgrade +fi + +%post -n %{dkmsname} +if [ "$1" -ge "1" ]; then + if [ -f /usr/lib/dkms/common.postinst ]; then + /usr/lib/dkms/common.postinst %{kmodname} %{version} + exit $? + fi +fi + +%files -n %{dkmsname} +%license COPYING +%{_usrsrc}/%{kmodname}-%{version}/ + +# ---------------------------------------------------------------------------- + + +%prep +%autosetup + + +%build +%set_build_flags +%make_build %{make_opts} + + +%install +%set_build_flags +%make_install %{make_opts} + +# Purge unneeded debian stuff +rm -rfv %{buildroot}/%{_datadir}/initramfs-tools + + +%changelog +* Sat Sep 27 2025 Neal Gompa +- Initial package based on Fedora package