From a82a5bef0b3d53b0e8989734c1f1f86ebf611e0e Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Oct 21 2021 17:00:57 +0000 Subject: Tweak form of systemd dependency macros Recommend %{?systemd_requires} and such instead of %systemd_requires so the specfile will still parse if systemd-rpm-macros is not installed. Fixes #1023 --- diff --git a/guidelines/modules/ROOT/pages/Scriptlets.adoc b/guidelines/modules/ROOT/pages/Scriptlets.adoc index 53087d6..61c906d 100644 --- a/guidelines/modules/ROOT/pages/Scriptlets.adoc +++ b/guidelines/modules/ROOT/pages/Scriptlets.adoc @@ -448,7 +448,7 @@ BuildRequires: systemd-rpm-macros If package scriptlets call other systemd tools, for example `systemd-tmpfiles`, the package SHOULD declare appropriate dependencies. -The `%systemd_requires` macro is a shortcut to require systemd for the +The `+%{?systemd_requires}+` macro is a shortcut to require systemd for the `%pre`, `%post`, and `%postun` scriptlets. Note that those dependencies are **not** required for the `%systemd_{post,preun,postun_with_restart,user_post,user_preun}` @@ -456,10 +456,14 @@ macros listed above. If the package wants to use systemd tools if they are available, but does not want to declare a dependency, -then the `%systemd_ordering` macro MAY be used -as a weaker form of `%systemd_requires` +then the `+%{?systemd_ordering}+` macro MAY be used +as a weaker form of `+%{?systemd_requires}+` that only declares an ordering during an RPM transaction. +NOTE: The macros take the form `+%{?systemd_requires}+` +instead of `+%systemd_requires+` to allow the specfile to parse properly +in the case where the systemd macros have yet to be installed. + ===== Macro details For details on what these macros evaluate to, refer to the following sources: