From 3deb1e0b17728ea273a45b60c9ee464b7465ddd0 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 8 Mar 2023 09:25:13 -0600 Subject: [PATCH] add rpm make target and fix up spec file Add a new make target to build an rpm. This uses rpmbuild --build-in-place, so no SRPM is created. Also clean up the specfile to remove manually-added Requires: that will be auto-generated, add a couple new BuildRequires: and use macros for file locations. Signed-off-by: Eric Sandeen --- Makefile | 8 +++-- packaging/bcachefs-tools.spec | 59 ++++++++++++++++------------------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 4433228..cd85880 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,10 @@ LDLIBS+=-lm -lpthread -lrt -lkeyutils -laio -ldl LDLIBS+=$(EXTRA_LDLIBS) ifeq ($(PREFIX),/usr) - ROOT_SBINDIR=/sbin + ROOT_SBINDIR?=/sbin INITRAMFS_DIR=$(PREFIX)/share/initramfs-tools else - ROOT_SBINDIR=$(PREFIX)/sbin + ROOT_SBINDIR?=$(PREFIX)/sbin INITRAMFS_DIR=/etc/initramfs-tools endif @@ -176,6 +176,10 @@ clean: deb: all debuild -us -uc -nc -b -i -I +.PHONY: rpm +rpm: clean + rpmbuild --build-in-place -bb --define "_version $(subst -,_,$(VERSION))" packaging/bcachefs-tools.spec + bcachefs-principles-of-operation.pdf: doc/bcachefs-principles-of-operation.tex pdflatex doc/bcachefs-principles-of-operation.tex pdflatex doc/bcachefs-principles-of-operation.tex diff --git a/packaging/bcachefs-tools.spec b/packaging/bcachefs-tools.spec index 00d0fbb..a8f023a 100644 --- a/packaging/bcachefs-tools.spec +++ b/packaging/bcachefs-tools.spec @@ -1,45 +1,28 @@ Name: bcachefs-tools -Version: 2020.01.21 +# define with i.e. --define '_version 1.0' +Version: %{_version} Release: 1%{?dist} Summary: Userspace tools for bcachefs License: GPLv2 URL: https://github.com/koverstreet/bcachefs-tools -Source0: %{name}-%{version}.tar.bz2 -BuildRequires: epel-release -BuildRequires: bzip2 BuildRequires: gcc BuildRequires: make +BuildRequires: cargo +BuildRequires: clang-devel BuildRequires: keyutils-libs-devel BuildRequires: libaio-devel BuildRequires: libattr-devel BuildRequires: libblkid-devel BuildRequires: libsodium-devel -BuildRequires: libtool-ltdl-devel BuildRequires: libuuid-devel -BuildRequires: libvmmalloc-devel BuildRequires: libzstd-devel BuildRequires: lz4-devel +BuildRequires: systemd-devel BuildRequires: userspace-rcu-devel -BuildRequires: valgrind-devel BuildRequires: zlib-devel -Requires: epel-release -Requires: bzip2 -Requires: keyutils-libs -Requires: libaio -Requires: libattr -Requires: libblkid -Requires: libsodium -Requires: libtool-ltdl -Requires: libuuid -Requires: libvmmalloc -Requires: libzstd -Requires: lz4 -Requires: userspace-rcu -Requires: zlib - %description The bcachefs tool, which has a number of subcommands for formatting and managing bcachefs filesystems. Run bcachefs --help for full list of commands. @@ -47,25 +30,37 @@ The bcachefs tool, which has a number of subcommands for formatting and managing %setup -q %build -make +%make_build V=0 --no-print-directory %install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/usr/local/sbin -mkdir -p $RPM_BUILD_ROOT/usr/local/share/man/man8 -%make_install +mkdir -p $RPM_BUILD_ROOT%{_sbindir} +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8 +%make_install PREFIX=%{_exec_prefix} ROOT_SBINDIR=%{_sbindir} + +# These may be debian-specific, and for unlocking encrypted root fs +rm -f %{buildroot}/%{_datadir}/initramfs-tools/hooks/bcachefs +rm -f %{buildroot}/%{_datadir}/initramfs-tools/scripts/local-premount/bcachefs +# The library is not needed by userspace +rm -f %{buildroot}/usr/lib/libbcachefs.so %files -/usr/local/sbin/bcachefs -/usr/local/sbin/fsck.bcachefs -/usr/local/sbin/mkfs.bcachefs -/usr/local/share/man/man8/bcachefs.8 -/etc/initramfs-tools/hooks/bcachefs -/etc/initramfs-tools/scripts/local-premount/bcachefs +%{_sbindir}/mount.bcachefs +%{_sbindir}/bcachefs +%{_sbindir}/fsck.bcachefs +%{_sbindir}/mkfs.bcachefs +%{_mandir}/man8/bcachefs.8.gz %changelog +* Tue Nov 15 2022 Eric Sandeen - 2022.11.15-1 +- NOTE: This binary RPM has been built directly from the bcachefs-tools + git tree with "make rpm" from the git hash indicated in the package version. +- Update spec file to allow in-tree rpm builds +- Remove maually added Requires: and unneeded build-requires + * Tue Jan 21 2020 Michael Adams - 2020.01.21-1 - Updated RPM package definition to reflect that changes in codebase have occurred. + * Tue Jan 07 2020 Michael Adams - 2020.01.07-1 - Initial RPM package definition - Makefile needs further work to accomodate RPM macros. -- 2.39.2