From 8bc3e5eae89e80fa693f03d76a2373618b1af1edee085b4aa6a5989819dcbedb Mon Sep 17 00:00:00 2001 From: Johannes Meixner Date: Fri, 19 Mar 2021 08:01:02 +0000 Subject: [PATCH] Accepting request 879976 from home:olh:branches:Printing - Remove code comments from expanded scriptlets to reduce size - Also run tmpfiles first because service_add_post may exit the script early OBS-URL: https://build.opensuse.org/request/show/879976 OBS-URL: https://build.opensuse.org/package/show/Printing/cups?expand=0&rev=367 --- cups.changes | 5 +++++ cups.spec | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cups.changes b/cups.changes index 42c390e..fd9c370 100644 --- a/cups.changes +++ b/cups.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Mar 18 18:18:18 UTC 2021 - olaf@aepfle.de + +- Remove code comments from expanded scriptlets to reduce size + ------------------------------------------------------------------- Tue Feb 2 14:22:38 CET 2021 - jsmeix@suse.de diff --git a/cups.spec b/cups.spec index 4d48a03..76467aa 100644 --- a/cups.spec +++ b/cups.spec @@ -437,9 +437,11 @@ getent group ntadmin >/dev/null || %{_sbindir}/groupadd -g 71 -o -r ntadmin %service_add_pre cups.service cups-lpd.socket cups.socket %post -p /bin/bash -%service_add_post cups.service cups-lpd.socket cups.socket +%if 0 # Use %%tmpfiles_create when 13.2 is oldest in support scope +%endif /usr/bin/systemd-tmpfiles --create %{_tmpfilesdir}/cups.conf || : +%service_add_post cups.service cups-lpd.socket cups.socket %preun -p /bin/bash %service_del_preun cups.service cups-lpd.socket cups.socket @@ -448,6 +450,7 @@ getent group ntadmin >/dev/null || %{_sbindir}/groupadd -g 71 -o -r ntadmin %service_del_postun cups.service cups-lpd.socket cups.socket %posttrans -p /bin/bash +%if 0 # Use a real bash script with an explicit "exit 0" at the end to be by default fail safe # an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed # see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets @@ -466,17 +469,23 @@ getent group ntadmin >/dev/null || %{_sbindir}/groupadd -g 71 -o -r ntadmin # and http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Scriptlet_Ordering # from the new package only "posttrans of new package" is run after "removal of old package" # so that the new package must do the clean up as RPM posttrans scriptlet. +%endif for u in cups.service cups.socket cups.path; do if systemctl --quiet is-enabled $u 2>/dev/null - then # Refresh still valid enabled systemd units and clean up possibly obsoleted systemd units: + then +%if 0 + # Refresh still valid enabled systemd units and clean up possibly obsoleted systemd units: # Enforce systemd to use the current unit file which is usually the unit file of the new package # but also in case of custom units (that use other unit files) a "reenable" won't hurt because # "reenable" does not implicitly stop a running service which is "the right thing" because # a RPM package installation must not automatically disrupt (restart) a running service. # Using "--force reenable" is essential to clean up possibly conflicting/broken symlinks. # (without "|| :" build fails with "Failed to get D-Bus connection: No connection to service manager. posttrans script ... failed"): +%endif systemctl --quiet --force reenable $u 2>/dev/null || : - else # Refresh still valid disabled systemd units and clean up possibly obsoleted systemd units: + else +%if 0 + # Refresh still valid disabled systemd units and clean up possibly obsoleted systemd units: # First using "--force reenable" is essential to clean up possibly conflicting/broken symlinks # because there is no "--force disable" that would clean up possibly conflicting/broken symlinks # see https://bugzilla.opensuse.org/show_bug.cgi?id=904215#c34 @@ -484,6 +493,7 @@ for u in cups.service cups.socket cups.path; do # If a disabled systemd unit has become obsoleted, "systemctl --force reenable" will clean it up # which means the unit gets removed and the subsequent "systemctl disable" will do nothing. # (without "|| :" build fails with "Failed to get D-Bus connection: No connection to service manager. posttrans script ... failed"): +%endif systemctl --quiet --force reenable $u 2>/dev/null || : systemctl --quiet disable $u 2>/dev/null || : fi