Skip to content

Commit 6b25525

Browse files
authored
Merge pull request #1255 from jnpkrn/spec-systemd
spec: fix broken reliance on systemd_requires defined in SRPM build time
2 parents b222ea8 + c410af8 commit 6b25525

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

resource-agents.spec.in

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
%global numcomm @numcomm@
1515
%global dirty @dirty@
1616

17+
# Whether this platform defaults to using systemd as an init system
18+
# (needs to be evaluated prior to BuildRequires being enumerated and
19+
# installed as it's intended to conditionally select some of these, and
20+
# for that there are only few indicators with varying reliability:
21+
# - presence of systemd-defined macros (when building in a full-fledged
22+
# environment, which is not the case with ordinary mock-based builds)
23+
# - systemd-aware rpm as manifested with the presence of particular
24+
# macro (rpm itself will trivially always be present when building)
25+
# - existence of /usr/lib/os-release file, which is something heavily
26+
# propagated by systemd project
27+
# - when not good enough, there's always a possibility to check
28+
# particular distro-specific macros (incl. version comparison)
29+
%define systemd_native (%{?_unitdir:1}%{!?_unitdir:0}%{nil \
30+
} || %{?__transaction_systemd_inhibit:1}%{!?__transaction_systemd_inhibit:0}%{nil \
31+
} || %(test -f /usr/lib/os-release; test $? -ne 0; echo $?))
32+
1733
#
1834
# Since this spec file supports multiple distributions, ensure we
1935
# use the correct group for each.
@@ -162,10 +178,10 @@ Requires: perl-Net-IMAP-Simple-SSL
162178
Requires(post): /sbin/chkconfig
163179
Requires(preun):/sbin/chkconfig
164180
%endif
165-
%if %{defined systemd_requires}
181+
%if %{systemd_native}
166182
BuildRequires: systemd
167-
%{?systemd_requires}
168183
%endif
184+
%{?systemd_requires}
169185

170186
%description -n ldirectord
171187
The Linux Director Daemon (ldirectord) was written by Jacob Rief.

0 commit comments

Comments
 (0)