3
0

Accepting request 680383 from home:fbui:branches:Base:System

- Fix %_restart_on_update_force: drop one extra trailing '}'
  Thanks Werner for spotting.

- Simplify %_restart_on_update and %_stop_on_removal
  There's no need to spawn sub shells when these macros are used.

- Macros arguments are mandatory
  Especially in %_restart_on_update_never and %_stop_on_removal_never,
  let's assume that they always receive unit names as arguments. This
  allows to make them slightly simpler (less rpm macro black magic).
  Callers will fail earlier if no arguments are passed anyway.

OBS-URL: https://build.opensuse.org/request/show/680383
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=36
This commit is contained in:
Franck Bui 2019-03-01 09:27:15 +00:00 committed by Git OBS Bridge
parent 7b2e3f4d22
commit f337315c0b
2 changed files with 41 additions and 24 deletions

View File

@ -51,33 +51,25 @@ OrderWithRequires(preun): systemd \
OrderWithRequires(postun): systemd \
%{nil}
%_restart_on_update_force() (\
%{?*:/usr/bin/systemctl try-restart %{*}} \
) || : %{nil}
%_restart_on_update_force() /usr/bin/systemctl try-restart %{*} || : %{nil}
%_restart_on_update_never() : # Restart of %{*} skipped %{nil}
%_restart_on_update_never() %{?*: : # Restart of %{*} skipped} %{nil}
%_restart_on_update() \
test -z "$DISABLE_RESTART_ON_UPDATE" -a -f /etc/sysconfig/services &&\\\
. /etc/sysconfig/services \
test "$DISABLE_RESTART_ON_UPDATE" != yes -a "$DISABLE_RESTART_ON_UPDATE" != 1 &&\\\
/usr/bin/systemctl try-restart %{*} || : \
%{nil}
%_restart_on_update() (\
test -f /etc/sysconfig/services -a \\\
-z "$DISABLE_RESTART_ON_UPDATE" && . /etc/sysconfig/services\
test "$DISABLE_RESTART_ON_UPDATE" = yes -o \\\
"$DISABLE_RESTART_ON_UPDATE" = 1 && exit 0\
%{?*:/usr/bin/systemctl try-restart %{*}}\
) || : %{nil}
%_stop_on_removal_force() /usr/bin/systemctl stop %{*} || : %{nil}
%_stop_on_removal_never() : # Stop of %{*} skipped} %{nil}
%_stop_on_removal_force() ( \
%{?*:/usr/bin/systemctl stop %{*}}\
) || : %{nil}
%_stop_on_removal_never() %{?*: : # Stop of %{*} skipped} %{nil}
%_stop_on_removal() (\
test -f /etc/sysconfig/services -a \\\
-z "$DISABLE_STOP_ON_REMOVAL" && . /etc/sysconfig/services\
test "$DISABLE_STOP_ON_REMOVAL" = yes -o \\\
"$DISABLE_STOP_ON_REMOVAL" = 1 && exit 0\
%{?*:/usr/bin/systemctl stop %{*}}\
) || : %{nil}
%_stop_on_removal() \
test -z "$DISABLE_STOP_ON_REMOVAL" -a -f /etc/sysconfig/services &&\\\
. /etc/sysconfig/services \
test "$DISABLE_STOP_ON_REMOVAL" != yes -a "$DISABLE_STOP_ON_REMOVAL" != 1 &&\\\
/usr/bin/systemctl stop %{*} || : \
%{nil}
%service_add_pre() \
test -n "$FIRST_ARG" || FIRST_ARG="$1" \

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Fri Mar 1 08:18:07 UTC 2019 - Franck Bui <fbui@suse.com>
- Fix %_restart_on_update_force: drop one extra trailing '}'
Thanks Werner for spotting.
-------------------------------------------------------------------
Wed Feb 27 17:43:13 UTC 2019 - Franck Bui <fbui@suse.com>
- Simplify %_restart_on_update and %_stop_on_removal
There's no need to spawn sub shells when these macros are used.
-------------------------------------------------------------------
Wed Feb 27 16:57:04 UTC 2019 - Franck Bui <fbui@suse.com>
- Macros arguments are mandatory
Especially in %_restart_on_update_never and %_stop_on_removal_never,
let's assume that they always receive unit names as arguments. This
allows to make them slightly simpler (less rpm macro black magic).
Callers will fail earlier if no arguments are passed anyway.
-------------------------------------------------------------------
Wed Feb 27 14:13:28 UTC 2019 - Franck Bui <fbui@suse.com>