Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
3
-
9223372036854775807
Description
LU-9439 (change 26925) introduced some issues in the spec file that should be cleaned up before 2.10.
First of all, the patch added:
%bcond_with systemd
That is right and good. But then the spec files goes on to almost completely avoid using that, and that part is bad.
There is already a perfect example of how to unset a bcond when another setting overrides the bcond early in the file:
%if %{without servers} # --without servers overrides --with {ldiskfs|zfs} # so undefine the internal variables set by bcond_* %undefine with_ldiskfs %undefine with_zfs %endif
If you want to set a bcond, do the opposite. So setting the internal variable for the systemd bcond would look like this:
#define with_systemd
That's it! Now you can use the %{with systemd} and %{without systemd} macros instead of introducing a second systemd variable (_systemd).
So the main change needed is to eliminate the _systemd macro.
This block can be removed entirely:
# Generic enable switch for systemd %if %{with systemd} %define _systemd 1 %endif
Then change each instance of:
%define _systemd 1
into:
%define with_systemd
Change each instance of:
%if 0%{?_systemd}
into:
%if %{with systemd}
Change:
%if 0%{!?_systemd:1}
into:
%if %{without systemd}
And finally, instead of introducing a third systemd macro here:
%if 0%{?_systemd} %define systemd --with-systemdsystemunitdir=%{_unitdir} %else %define systemd --with-systemdsystemunitdir=no %endif
You can just inline the options in eval_configure like so:
%{?with_systemd:--with-systemdsystemunitdir=%{_unitdir}} \ %{!?with_systemd:--with-systemdsystemunitdir=no} \
I would think that when systemd is not detected, I would have thought that "--with-systemdsystemunitdir=no" would already be the default. Perhaps that line can be dropped?