Accepting request 947283 from home:dsterba:branches:filesystems

- spec: also provide btrfs-progs as it's common package name in other distros
- spec: clean up conditionals for < 12 versions
- spec: let SLE12 build again (conditional dependency of libreiserfscore)
- Removed patches: sles11-defaults.h (no SLE11 compatibility anymore)
- Added patches: btrfs-progs-kerncompat-add-local-definition-for-alig.patch
  (fix build on SLE12/SLE15)

OBS-URL: https://build.opensuse.org/request/show/947283
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=360
This commit is contained in:
David Sterba 2022-01-18 19:20:26 +00:00 committed by Git OBS Bridge
parent d34fb381da
commit 4d6df1ae7e
4 changed files with 65 additions and 22 deletions

View File

@ -0,0 +1,46 @@
From b0cfe12c4d4b8b4ef335cdf4ddefcbdcd1b70d58 Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Thu, 13 Jan 2022 14:47:08 +0100
Subject: [PATCH] btrfs-progs: kerncompat: add local definition for alignment
macros
There's still problem left with compilation on musl and kernel < 5.11,
because __ALIGN_KERNEL is not defined anymore:
../bin/ld: kernel-shared/volumes.o: in function `create_chunk':
volumes.c:(.text+0x17f8): undefined reference to `__ALIGN_KERNEL'
Due to the entangled includes and unconditional definition of
__ALIGN_KERNEL, we can't use #ifdef in kerncompat.h to define it
eventually (as kerncompat.h is the first include). Instead add local
definitions of the macros and rename them to avoid name clashes.
Pull-request: #433
Signed-off-by: David Sterba <dsterba@suse.com>
---
kerncompat.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kerncompat.h b/kerncompat.h
index 6ca1526e2014..f0a6e196e3b9 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -359,7 +359,14 @@ do { \
/* Alignment check */
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
-#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
+
+/*
+ * Alignment, copied and renamed from /usr/include/linux/const.h to work around
+ * issues caused by moving the definition in 5.12
+ */
+#define __ALIGN_KERNEL__(x, a) __ALIGN_KERNEL_MASK__(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK__(x, mask) (((x) + (mask)) & ~(mask))
+#define ALIGN(x, a) __ALIGN_KERNEL__((x), (a))
static inline int is_power_of_2(unsigned long n)
{
--
2.33.0

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue Jan 18 00:00:00 CET 2022 - dsterba@suse.cz
- spec: also provide btrfs-progs as it's common package name in other distros
- spec: clean up conditionals for < 12 versions
- spec: let SLE12 build again (conditional dependency of libreiserfscore)
- Removed patches: sles11-defaults.h (no SLE11 compatibility anymore)
- Added patches: btrfs-progs-kerncompat-add-local-definition-for-alig.patch
(fix build on SLE12/SLE15)
-------------------------------------------------------------------
Wed Jan 12 00:00:01 CET 2022 - dsterba@suse.cz

View File

@ -48,23 +48,26 @@ Source1: boot-btrfs.sh
Source2: module-setup.sh.in
Source3: dracut-fsck-help.txt
Source4: setup-btrfs.sh
Source5: sles11-defaults.h
# Alias that matches the upstream project name
Provides: btrfs-progs = %{version}-%{release}
Provides: btrfs-progs(%_arch) = %{version}-%{release}
Patch1: mkfs-default-features.patch
Patch2: btrfs-progs-kerncompat-add-local-definition-for-alig.patch
%if %build_docs
BuildRequires: asciidoc
%endif
BuildRequires: autoconf
BuildRequires: automake
%if 0%{?suse_version} > 1200
BuildRequires: dracut
%endif
BuildRequires: libattr-devel
BuildRequires: libblkid-devel
BuildRequires: libext2fs-devel
%if 0%{?suse_version} >= 1500
BuildRequires: libreiserfscore-devel >= 3.6.27
Requires: libreiserfscore0 >= 3.6.27
%endif
BuildRequires: libuuid-devel
%if 0%{?suse_version} > 1500
BuildRequires: libzstd-devel
@ -98,6 +101,8 @@ Utilities needed to create and maintain btrfs file systems under Linux.
%package -n btrfsprogs-static
Summary: Static build of utilities for the Btrfs filesystem
Group: System/Filesystems
Provides: btrfs-progs-static = %{version}-%{release}
Provides: btrfs-progs-static(%_arch) = %{version}-%{release}
BuildRequires: glibc-devel-static
BuildRequires: libblkid-devel-static
BuildRequires: libcom_err-devel-static
@ -188,13 +193,10 @@ with Btrfs using libbtrfsutil.
%prep
%setup -q -n btrfs-progs-v%{version}
%patch1 -p1
%patch2 -p1
%build
./autogen.sh
%if 0%{?suse_version} == 1110
cp %{SOURCE5} .
export CFLAGS="%{optflags} -include sles11-defaults.h"
%endif
%configure \
--enable-python \
@ -263,12 +265,10 @@ rm -f %{buildroot}/%{_libdir}/*.a
# bash completion
install -m 0755 -d %{buildroot}/%{_datadir}/bash-completion/completions
install -m 0644 btrfs-completion %{buildroot}/%{_datadir}/bash-completion/completions/btrfs
%if 0%{?suse_version} > 1200
sed -e 's,@@INSTALLDIR@@,%{_datadir}/%{name}/,;' %{SOURCE2} > module-setup.sh
install -m 0755 -D module-setup.sh %{buildroot}/%{_dracutmodulesdir}/95suse-btrfs/module-setup.sh
rm -f module-setup.sh
install -m 0644 -D %{SOURCE3} %{buildroot}/%{_datadir}/%{name}/dracut-fsck-help.txt
%endif
%if 0%{!?for_debugging:1}
DEBUG_FILES="/sbin/btrfs-find-root
@ -302,18 +302,11 @@ done
%files
%defattr(-, root, root)
%if 0%{?suse_version} < 1200
# SLE11 doesn't know about %license
%doc COPYING
%else
%license COPYING
%endif
%if 0%{?suse_version} > 1200
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/dracut-fsck-help.txt
%dir %{_dracutmodulesdir}/95suse-btrfs/
%{_dracutmodulesdir}/95suse-btrfs/module-setup.sh
%endif
%if !0%{?usrmerged}
/sbin/fsck.btrfs
# mkinitrd utils

View File

@ -1,6 +0,0 @@
#ifndef _SLES11_DEFAULTS_H
#define _SLES11_DEFAULTS_H
#define BTRFS_MKFS_DEFAULT_NODE_SIZE sysconf(_SC_PAGESIZE)
#define BTRFS_MKFS_DEFAULT_FEATURES BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF
#define BTRFS_MKFS_DEFAULT_RUNTIME_FEATURES (0)
#endif