]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
add rpm make target and fix up spec file
authorEric Sandeen <sandeen@sandeen.net>
Wed, 8 Mar 2023 15:25:13 +0000 (09:25 -0600)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 Mar 2023 15:26:44 +0000 (10:26 -0500)
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 <sandeen@sandeen.net>
Makefile
packaging/bcachefs-tools.spec

index 443322801fbf679aafc82c769b3c4203d7bf8ec0..cd85880ab531dd5a27179289a9d6f344682f2f4c 100644 (file)
--- 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
index 00d0fbb47e35e2c6e332ea36bbdaa4685341452f..a8f023a88302ee77762a8c8e82741e1b6dd10be6 100644 (file)
@@ -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 <sandeen@sandeen.net> - 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 <unquietwiki@gmail.com> - 2020.01.21-1
 - Updated RPM package definition to reflect that changes in codebase have occurred.
+
 * Tue Jan 07 2020 Michael Adams <unquietwiki@gmail.com> - 2020.01.07-1
 - Initial RPM package definition
 - Makefile needs further work to accomodate RPM macros.