9797# according to Requires lines below (in turn according to our declaration
9898# of what is shipped by this or that distro/release), to decide whether we
9999# deliver certain sub-packages - and set NUTPKG_WITH_<DEPNAME> at that time.
100+ # For version-specific checks note that some are directly digited, others
101+ # are off by two or four digits (e.g. 0810 = a "8.10" release), see
102+ # https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
100103
101104# Does this NUT branch have DMF feature code?
102105%define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 )
@@ -136,9 +139,9 @@ Requires: %{_bindir}/pgrep
136139Requires: %{_bindir }/pkill
137140Requires: %{_bindir }/readlink
138141Requires: usbutils
139- %if 0% {?suse_version }
142+ # %if 0 % {?suse_version}
140143Requires(post): udev
141- %endif
144+ # %endif
142145#Requires(post): group(% {NUT_GROUP})
143146#Requires(post): user(% {NUT_USER})
144147Requires(postun): %{_bindir }/sh
@@ -156,14 +159,15 @@ BuildRequires: dos2unix
156159BuildRequires: fdupes
157160%endif
158161
159- %if 0%{?rhel_version }>= 8 || ! 0%{?rhel_version }
162+ %if ( 0%{?rhel_version }>= 800 || ! 0%{?rhel_version } ) && ( 0%{?rhel }>= 8 || ! 0%{?rhel } )
163+ # Not sure why claimed absent in RHEL7 (even with Fedora/EPEL repo layer added)
160164%define NUTPKG_WITH_AVAHI 1
161165BuildRequires: avahi-devel
162166%else
163167%define NUTPKG_WITH_AVAHI 0
164168%endif
165169
166- %if ( 0%{?rhel_version }>= 8 || ! 0%{?rhel_version } ) || ( 0%{?suse_version }> 12 || ! 0%{?suse_version } )
170+ %if ( 0%{?rhel_version }>= 800 || ! 0%{?rhel_version } ) && ( 0%{? rhel } >= 8 || ! 0%{? rhel } ) && ( 0%{?sle_version } >= 150000 || ! 0%{? sle_version } ) && ( 0%{? suse_version }>= 1300 || ! 0%{?suse_version } )
167171%define NUTPKG_WITH_FREEIPMI 1
168172BuildRequires: (libfreeipmi-devel or freeipmi-devel)
169173%else
@@ -200,23 +204,27 @@ BuildRequires: lua-devel
200204# For some platforms we may have to fiddle with distro-named macros like
201205# % if 0 % {?centos_version}
202206# % if 0 % {?suse_version}
203- # % if 0 % {?rhel_version}>=7
207+ # % if 0 % {?rhel_version}>=700
204208# and whatnot
205209
206- %if ( (0%{?rhel_version }> 0 && 0%{?rhel_version }<= 7 ) || ! 0%{?rhel_version } )
210+ %if ( (0%{?rhel_version }> 0 && 0%{?rhel_version }< 800 ) || ! 0%{?rhel_version } ) && ( (0%{? centos_version } > 0 && 0%{? centos_version } != 800) || ! 0%{? centos_version } )
207211# Strange that this is not present in RHEL (even with Fedora EPEL repos attached)
212+ # and that it is resolvable in CentOS 7, 9, 10 but not 8...
208213# We only need this to learn paths from apxs tool, so no NUTPKG_WITH_* toggle
209214BuildRequires: (httpd-devel or apache2-devel)
210215%endif
211216
212217BuildRequires: (dbus-1-glib-devel or dbus-glib-devel)
213218
214- %if 0%{?rhel_version }>= 8 || ! 0%{?rhel_version }
219+ %if ( 0%{?rhel_version }>= 800 || ! 0%{?rhel_version } ) && ( 0%{? rhel } >= 8 || ! 0%{? rhel } )
215220BuildRequires: (libcppunit-devel or cppunit-devel)
216221%endif
217222
218223# Obsoleted/away in newer distros
219- %if ( (0%{?rhel_version }> 0 && 0%{?rhel_version }<= 7) || ! 0%{?rhel_version } ) && ( (0%{?centos_version }> 0 && 0%{?centos_version }<= 7) || ! 0%{?centos_version } ) && ( (0%{?fedora_version }> 0 && 0%{?fedora_version }<= 27) || ! 0%{?fedora_version } )
224+ %if ( (0%{?rhel_version }> 0 && 0%{?rhel_version }< 800) || ! 0%{?rhel_version } ) && ( (0%{?centos_version }> 0 && 0%{?centos_version }< 800) || ! 0%{?centos_version } ) && ( (0%{?fedora_version }> 0 && 0%{?fedora_version }<= 27) || ! 0%{?fedora_version } )
225+ # Note that per https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
226+ # there was "fedora_version" until some time before 36, when the macro became "fedora";
227+ # similarly for "rhel_version <= 700" vs. "rhel == 8"...
220228%define NUTPKG_WITH_TCPWRAP 1
221229BuildRequires: (tcpd-devel or tcp_wrappers-devel)
222230%else
@@ -231,7 +239,7 @@ BuildRequires: (libneon-devel or neon-devel or neon)
231239BuildRequires: (libopenssl-devel or openssl-devel or openssl)
232240#!Prefer: (libopenssl-devel or openssl-devel)
233241
234- %if ( ! 0%{?rhel_version } ) && ( ( 0%{?centos_version }> 0 && 0%{?centos_version }<= 9 ) || ! 0%{?centos_version } ) && ( (0%{?fedora_version }> 0 && 0%{?fedora_version }< 99 ) || ! 0%{?fedora_version } )
242+ %if ( ! 0%{?rhel_version } ) && ( ! 0%{? rhel } ) && ( ( 0%{?centos_version }> 0 && 0%{?centos_version }< 1000 ) || ! 0%{?centos_version } ) && ( (0%{?fedora_version }> 0 && 0%{?fedora_version }< 4200 ) || ! 0%{?fedora_version } ) && ( (0%{? fedora } > 0 && 0%{? fedora } < 42) || ! 0%{? fedora } )
235243# Strange that this is not present in RHEL (even with Fedora EPEL repos attached)
236244# NOTE: fedora_version=99 seems to be rawhide; currently it says this package
237245# is not known (so likely a post-42 release would be more specific later),
@@ -242,16 +250,19 @@ BuildRequires: powerman-devel
242250%define NUTPKG_WITH_POWERMAN 0
243251%endif
244252
245- %if 0%{?suse_version }
253+ %if ( 0%{?suse_version }> 0 || ! %{?suse_version } ) && (0%{?centos_version }>= 800) || ! 0%{?centos_version } ) && ( ! 0%{?rhel_version } ) && ( ! 0%{?rhel } )
254+ # Strange that this is not present in RHEL (even with Fedora EPEL repos attached)
255+ # But it also complains about epel-rpm-macros when this is added though.
246256BuildRequires: systemd-rpm-macros
257+ %endif
258+
247259# Only needed for PDF generation, we do not package that now
248260#BuildRequires: dblatex
249- %endif
250261
251262BuildRequires: (libxslt-tools or libxslt)
252263BuildRequires: asciidoc
253264
254- %if %{defined opensuse_version }
265+ %if 0%{? opensuse_version }
255266# Package provides driver for USB HID UPSes, but people can live with hal addon:
256267Enhances: %{USBHIDDRIVERS }
257268# Package provides the only avalailable driver for other USB UPSes:
0 commit comments