Skip to content

Commit

Permalink
btrfs: link against libbtrfsutil
Browse files Browse the repository at this point in the history
libblockdev has historically used btrfs-progs CLI utilities in the
meanwhile libbtrfsutil has been developed and used by snapper.

Not parsing CLI output and using the library functions should provide a
more stable way to gather information from btrfs.
  • Loading branch information
jelly committed Jan 22, 2024
1 parent 4222e69 commit efb752a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ srpm_build_deps:
- autoconf
- autoconf-archive
- automake
- btrfs-progs-devel
- cryptsetup-devel
- device-mapper-devel
- e2fsprogs-devel
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ AS_IF([test "x$with_fs" != "xno" -o "x$with_crypto" != "xno" -o "x$with_swap" !=
[Define as neutral value if libblkid doesn't provide the definition])])]
[])

AS_IF([test "x$with_btrfs" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([LIBBTRFSUTIL], [libbtrfsutil >= 6.6])],
[])

AS_IF([test "x$with_btrfs" != "xno" -o "x$with_mdraid" != "xno" -o "x$with_tools" != "xno"],
[LIBBLOCKDEV_PKG_CHECK_MODULES([BYTESIZE], [bytesize >= 0.1])],
[])
Expand Down
2 changes: 1 addition & 1 deletion dist/libblockdev.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ with the libblockdev-utils library.

%if %{with_btrfs}
%package btrfs
BuildRequires: libbytesize-devel
BuildRequires: libbytesize-devel btrfs-progs-devel
Summary: The BTRFS plugin for the libblockdev library
Requires: %{name}-utils%{?_isa} = %{version}-%{release}
Requires: btrfs-progs
Expand Down
2 changes: 2 additions & 0 deletions misc/install-test-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- name: Install build dependencies not covered by dnf builddep (Fedora)
package: name={{item}} state=present
with_items:
- btrfs-progs-devel
- libfdisk-devel
- keyutils-libs-devel
- libnvme-devel
Expand Down Expand Up @@ -162,6 +163,7 @@
- name: Install build dependencies not covered by apt build-dep (Debian/Ubuntu)
package: name={{item}} state=present
with_items:
- libbtrfsutil-dev
- libfdisk-dev
- libkeyutils-dev
- libext2fs-dev
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ endif


if WITH_BTRFS
libbd_btrfs_la_CFLAGS = $(GLIB_CFLAGS) $(GIO_CFLAGS) $(BYTESIZE_CFLAGS) -Wall -Wextra -Werror
libbd_btrfs_la_LIBADD = ${builddir}/../utils/libbd_utils.la $(GLIB_LIBS) $(GIO_LIBS) $(BYTESIZE_LIBS)
libbd_btrfs_la_CFLAGS = $(GLIB_CFLAGS) $(GIO_CFLAGS) $(BYTESIZE_CFLAGS) $(LIBBTRFSUTIL_CFLAGS) -Wall -Wextra -Werror
libbd_btrfs_la_LIBADD = ${builddir}/../utils/libbd_utils.la $(GLIB_LIBS) $(GIO_LIBS) $(BYTESIZE_LIBS) $(LIBBTRFSUTIL_LIBS)
libbd_btrfs_la_LDFLAGS = -L${srcdir}/../utils/ -version-info 3:0:0 -Wl,--no-undefined -export-symbols-regex '^bd_.*'
libbd_btrfs_la_CPPFLAGS = -I${builddir}/../../include/
libbd_btrfs_la_SOURCES = btrfs.c btrfs.h check_deps.c check_deps.h
Expand Down

0 comments on commit efb752a

Please sign in to comment.