From a37838da0eff31e519319bf3e9fbc181868869fecac07fc91d71f0f4168cf853 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 1 Sep 2016 07:27:43 +0000 Subject: [PATCH] Accepting request 424097 from home:jeff_mahoney:branches:filesystems - Add new btrfsprogs-udev-rules package to contain the udev rules. - Fix packaging for udev rules: - btrfs builtin didn't exist prior to udev v190, so the rules must depend on that version. - Added patch: * btrfsprogs-only-install-udev-rules-for-udev-190.patch OBS-URL: https://build.opensuse.org/request/show/424097 OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=248 --- ...only-install-udev-rules-for-udev-190.patch | 32 +++++++++++++ btrfsprogs.changes | 10 ++++ btrfsprogs.spec | 47 +++++++++++++++---- 3 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 btrfsprogs-only-install-udev-rules-for-udev-190.patch diff --git a/btrfsprogs-only-install-udev-rules-for-udev-190.patch b/btrfsprogs-only-install-udev-rules-for-udev-190.patch new file mode 100644 index 0000000..6c7c890 --- /dev/null +++ b/btrfsprogs-only-install-udev-rules-for-udev-190.patch @@ -0,0 +1,32 @@ +From: Jeff Mahoney +Subject: btrfsprogs: only install udev rules for udev >= 190 +Patch-mainline: Submitted, linux-btrfs 30 Aug 2016 + +Prior to udev v190, there was no btrfs builtin helper. Installing it on +systems with an older udev will cause problems. + +Signed-off-by: Jeff Mahoney +--- + + configure.ac | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 97e89f2..8fd8f42 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -161,7 +161,13 @@ PKG_STATIC(UUID_LIBS_STATIC, [uuid]) + PKG_CHECK_MODULES(ZLIB, [zlib]) + PKG_STATIC(ZLIB_LIBS_STATIC, [zlib]) + +-UDEVDIR="$(pkg-config udev --variable=udevdir)" ++# udev v190 introduced the btrfs builtin and a udev rule to use it. ++# Our udev rule gives us the friendly dm names but isn't required (or valid) ++# on earlier releases. ++UDEVDIR= ++if pkg-config udev --atleast-version 190; then ++ UDEVDIR="$(pkg-config udev --variable=udevdir)" ++fi + AC_SUBST(UDEVDIR) + + dnl lzo library does not provide pkg-config, let use classic way diff --git a/btrfsprogs.changes b/btrfsprogs.changes index 7247d78..263dc12 100644 --- a/btrfsprogs.changes +++ b/btrfsprogs.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Aug 30 20:11:10 UTC 2016 - jeffm@suse.com + +- Add new btrfsprogs-udev-rules package to contain the udev rules. +- Fix packaging for udev rules: + - btrfs builtin didn't exist prior to udev v190, so the rules must + depend on that version. +- Added patch: + * btrfsprogs-only-install-udev-rules-for-udev-190.patch + ------------------------------------------------------------------- Mon Aug 29 00:00:00 CEST 2016 - dsterba@suse.cz diff --git a/btrfsprogs.spec b/btrfsprogs.spec index 5f37915..abaea0d 100644 --- a/btrfsprogs.spec +++ b/btrfsprogs.spec @@ -16,6 +16,10 @@ # +%define udev_with_btrfs_builtin 190 +%define udev_version %(rpm -q --queryformat %{VERSION} udev) +%define package_udev_rules %{udev_version} >= %{udev_with_btrfs_builtin} + # enable building of btrfsprogs-static %if 0%{?suse_version} <= 1310 || 0%{?suse_version} == 1315 %define build_static 0 @@ -42,6 +46,7 @@ Patch167: 0167-Btrfs-progs-make-find_and_setup_root-return-an-error.patch Patch168: 0168-Btrfs-progs-don-t-bug-out-if-we-can-t-find-the-last-.patch Patch1000: local-version-override.patch +Patch1001: btrfsprogs-only-install-udev-rules-for-udev-190.patch BuildRequires: asciidoc BuildRequires: autoconf @@ -56,6 +61,9 @@ BuildRequires: pkg-config BuildRequires: suse-module-tools %endif BuildRequires: udev +%if 0%{?suse_version} == 1310 +BuildRequires: libudev-devel +%endif BuildRequires: xmlto BuildRequires: zlib-devel %if 0%{?suse_version} >= 1310 @@ -64,6 +72,9 @@ Requires(postun): coreutils %endif Supplements: filesystem(btrfs) Recommends: btrfsmaintenance +%if %{package_udev_rules} +Requires: btrfsprogs-udev-rules +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -107,12 +118,31 @@ Requires: libbtrfs0 = %{version} This package contains the libraries and headers files for developers to build applications to interface with btrfs. +# rpm < 4.6.0 (SLE11 uses 4.4) doesn't support noarch subpackages. +# Fortunately, it doesn't use systemd either so we can just skip it. +%if %{package_udev_rules} +%package udev-rules +Summary: Udev rules for configuring btrfs file systems +Group: System/Kernel +Conflicts: udev < %{udev_with_btrfs_builtin} +BuildArch: noarch + +%description udev-rules +This package contains the udev rule file for configuring device mapper +devices that are components of btrfs file systems. It is meant to be +used with versions of udev that contain the "built-in" btrfs command +(v190 and newer). Older versions of udev will call the version of +"btrfs ready" contained in the btrfsprogs package, which does the right +thing. +%endif + %prep %setup -q -n btrfs-progs-v%{version} %patch163 -p1 %patch167 -p1 %patch168 -p1 %patch1000 -p1 +%patch1001 -p1 %build ./autogen.sh @@ -168,11 +198,6 @@ rm -f %{buildroot}/%{_libdir}/*.a install -m 0755 -d %{buildroot}/%{_datadir}/bash-completion/completions install -m 0644 btrfs-completion %{buildroot}/%{_datadir}/bash-completion/completions/btrfs -# 13.1 does not have pkg-config but does have rules -%if 0%{?suse_version} == 1310 -install -m 0755 -d %{buildroot}/usr/lib/udev/rules.d/64-btrfs-dm.rules -%endif - %if 0%{!?for_debugging:1} DEBUG_FILES="/sbin/btrfs-find-root %{_sbindir}/btrfs-find-root @@ -262,11 +287,6 @@ done %dir %{_datadir}/bash-completion/completions %{_datadir}/bash-completion/completions/btrfs -%if 0%{?suse_version} >= 1200 -%dir %{_udevrulesdir} -%{_udevrulesdir}/64-btrfs-dm.rules -%endif - %if 0%{?for_debugging:1} /sbin/btrfs-find-root %{_sbindir}/btrfs-find-root @@ -304,4 +324,11 @@ done %{_includedir}/btrfs/* %{_libdir}/libbtrfs.so +%if %{package_udev_rules} +%files udev-rules +%defattr(-, root, root) +%dir %{_udevrulesdir} +%{_udevrulesdir}/64-btrfs-dm.rules +%endif + %changelog