From f337315c0b5a579c6b14c5d001381b48bdf4051ff27b6fe7c97ce6a51ddfd8e6 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Fri, 1 Mar 2019 09:27:15 +0000 Subject: [PATCH] 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 --- macros.systemd | 40 +++++++++++++++----------------------- systemd-rpm-macros.changes | 25 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/macros.systemd b/macros.systemd index 41cdf4c..be35537 100644 --- a/macros.systemd +++ b/macros.systemd @@ -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" \ diff --git a/systemd-rpm-macros.changes b/systemd-rpm-macros.changes index 8e1bd71..0b42340 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +Fri Mar 1 08:18:07 UTC 2019 - Franck Bui + +- Fix %_restart_on_update_force: drop one extra trailing '}' + + Thanks Werner for spotting. + +------------------------------------------------------------------- +Wed Feb 27 17:43:13 UTC 2019 - Franck Bui + +- 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 + +- 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