mirror of
git://sourceware.org/git/lvm2.git
synced 2026-01-23 20:32:57 +03:00
spec: improve RPM packaging with backward-compatible fixes
Fix multiple RPM spec file issues while maintaining compatibility with
RHEL 6+ and Fedora 19+:
1. Add missing %{systemd_version} macro definition (set to 219)
Fixes undefined macro warnings in dbusd package requirements
2. Fix %clean section syntax bug and make it conditional
- Replaced buggy: test -n rpm-no-clean (missing quotes)
- Made conditional: only for Fedora < 18 and RHEL < 7
- %clean section deprecated in modern RPM
3. Make ldconfig scriptlets conditional using macro
- Introduce ldconfig_scriptlets macro in macros.inc
- Macro handles -n flag for subpackages (e.g., device-mapper-libs)
- Expands to scriptlets on Fedora < 28 and RHEL < 8, %{nil} otherwise
- Replaces 3 repetitive conditional blocks (18 lines -> 3 lines)
- Affects: libs, device-mapper-libs, device-mapper-event-libs
4. Add conditional BuildRequires for systemd-rpm-macros
- Only for Fedora 30+ and RHEL 8+
- Provides proper dependencies for modern systemd macro usage
This commit is contained in:
@@ -58,6 +58,8 @@ test -e %{_sourcedir}/source.inc || cp source.inc build.inc packages.inc macros.
|
||||
%check
|
||||
%{?check_commands}
|
||||
|
||||
# %clean section deprecated in Fedora 18+, RHEL 7+
|
||||
%if 0%{?fedora} < 18 && 0%{?rhel} < 7
|
||||
%clean
|
||||
pwd
|
||||
test -n rpm-no-clean || rm -rf $RPM_BUILD_ROOT
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
|
||||
@@ -23,6 +23,16 @@
|
||||
%global license_lgpl LGPLv2
|
||||
%endif
|
||||
|
||||
# ldconfig scriptlets (deprecated in Fedora 28+, RHEL 8+)
|
||||
%if 0%{?fedora} < 28 && 0%{?rhel} < 8
|
||||
%global ldconfig_scriptlets(n:) \
|
||||
%%post %{-n:-n} %{-n*} %{!-n:%{1}} -p /sbin/ldconfig \
|
||||
\
|
||||
%%postun %{-n:-n} %{-n*} %{!-n:%{1}} -p /sbin/ldconfig
|
||||
%else
|
||||
%global ldconfig_scriptlets(n:) %{nil}
|
||||
%endif
|
||||
|
||||
%global enableif() \
|
||||
%%global configure_flags %%{?configure_flags} --%%(if test %%1 -gt 0; then echo enable-%%2; else echo disable-%%2; fi)
|
||||
|
||||
|
||||
@@ -235,9 +235,7 @@ Requires: device-mapper-event >= %{device_mapper_version}-%{release}
|
||||
%description libs
|
||||
This package contains shared lvm2 libraries for applications.
|
||||
|
||||
%post libs -p /sbin/ldconfig
|
||||
|
||||
%postun libs -p /sbin/ldconfig
|
||||
%ldconfig_scriptlets libs
|
||||
|
||||
%files libs
|
||||
%defattr(-,root,root,-)
|
||||
@@ -473,9 +471,7 @@ Requires: device-mapper = %{device_mapper_version}-%{release}
|
||||
%description -n device-mapper-libs
|
||||
This package contains the device-mapper shared library, libdevmapper.
|
||||
|
||||
%post -n device-mapper-libs -p /sbin/ldconfig
|
||||
|
||||
%postun -n device-mapper-libs -p /sbin/ldconfig
|
||||
%ldconfig_scriptlets -n device-mapper-libs
|
||||
|
||||
%files -n device-mapper-libs
|
||||
%attr(755,root,root) %{_libdir}/libdevmapper.so.*
|
||||
@@ -539,9 +535,7 @@ License: %{license_lgpl}
|
||||
This package contains the device-mapper event daemon shared library,
|
||||
libdevmapper-event.
|
||||
|
||||
%post -n device-mapper-event-libs -p /sbin/ldconfig
|
||||
|
||||
%postun -n device-mapper-event-libs -p /sbin/ldconfig
|
||||
%ldconfig_scriptlets -n device-mapper-event-libs
|
||||
|
||||
%files -n device-mapper-event-libs
|
||||
%attr(755,root,root) %{_libdir}/libdevmapper-event.so.*
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
# NOTE: Required by fedora 38+, maybe older
|
||||
%global buildreq_udev systemd-devel, systemd-units
|
||||
%global req_udev udev >= 181-1
|
||||
%global systemd_version 219
|
||||
|
||||
|
||||
%if %{fedora} >= 35 || %{rhel} >= 9
|
||||
@@ -203,6 +204,10 @@ BuildRequires: libblkid-devel
|
||||
%maybe BuildRequires: %{?buildreq_python3_setuptools}
|
||||
%maybe BuildRequires: %{?buildreq_python3_dbus}
|
||||
%maybe BuildRequires: %{?buildreq_python3_pyudev}
|
||||
# systemd-rpm-macros needed for systemd macros (Fedora 30+, RHEL 8+)
|
||||
%if 0%{?fedora} >= 30 || 0%{?rhel} >= 8
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%endif
|
||||
|
||||
%description
|
||||
LVM2 includes all of the support for handling read/write operations on
|
||||
|
||||
Reference in New Issue
Block a user