From 38bdf040c4516e1d3de7a65300fe8887e816b2d3c93f842a05f0adfb72620b40 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 20 Jun 2023 15:01:29 +0000 Subject: [PATCH 1/4] - Unlike systemd-tmpfiles call in %tmpfiles_create_package(), systemd-sysusers must always be called by %sysusers_create_package() even on transactional systems since it's part of the macro contract. Writing to /etc is not recommended on such systems but it has to work anyways. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=98 --- macros.systemd | 30 +++++++++++++++++++++--------- systemd-rpm-macros.changes | 8 ++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/macros.systemd b/macros.systemd index cac47b4..28762b5 100644 --- a/macros.systemd +++ b/macros.systemd @@ -217,13 +217,16 @@ fi \ : \ %{nil} +# For cases where the sysusers or tmpfiles data need to be created in advance +# (when a system user needs to be installed in %%pre so proper ownership are +# used when package's files are installed for example) then use the +# '*_create_package()' variants. # -# Since we moved to file triggers the 2 following macros are deprecated. If the -# sysusers or tmpfiles data need to be created in advance (when a system user -# needs to be installed in %%pre so proper ownership are used when package's -# files are installed for example) then use the '*_create_package()' variants. +# FIXME: these macros could be converted to NOPs since we moved to file +# triggers. However some packages might assume that the macros effects are +# effective as soon as the macros return. This reason is actually moot since +# this can't work on transactional systems anyway. # - %tmpfiles_create() \ %{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# tmpfiles_create}} \ [ -z "${TRANSACTIONAL_UPDATE}" ] && [ -x /usr/bin/systemd-tmpfiles ] && \ @@ -232,13 +235,19 @@ fi \ %sysusers_create() \ %{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# sysusers_create}} \ -[ -x /usr/bin/systemd-sysusers ] && /usr/bin/systemd-sysusers %{?*} || : \ +[ -z "${TRANSACTIONAL_UPDATE}" ] && [ -x /usr/bin/systemd-sysusers ] && \ + /usr/bin/systemd-sysusers %{?*} || : \ %{nil} # This may be used by package installation scripts to create files according to # their tmpfiles configuration from a package installation script, even before # the files of that package are installed on disk. # +# FIXME: this macro should be removed because it cannot work on transactional +# systems since directories that systemd-tmpfiles usually operates on (i.e. +# /var, /etc) are not available during (transactional) updates. So packages +# can't rely on the behavior this macro is supposed to provide. +# # Example: # Source1: %{name}-tmpfiles.conf # ... @@ -251,7 +260,7 @@ fi \ # %tmpfiles_create_package() \ %{expand:%%{?!__systemd_twoargs_%#:%%{error:The %%%%tmpfiles_create_package macro requires two arguments}}} \ -[ -d /run/systemd/system ] && \ +[ -d /run/systemd/system ] && [ -x /usr/bin/systemd-tmpfiles ] && \ /usr/bin/systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - < + +- Unlike systemd-tmpfiles call in %tmpfiles_create_package(), systemd-sysusers + must always be called by %sysusers_create_package() even on transactional + systems since it's part of the macro contract. Writing to /etc is not + recommended on such systems but it has to work anyways. + ------------------------------------------------------------------- Fri Jun 16 13:11:34 UTC 2023 - Franck Bui From ca8818405c9b7fd6edad1feabb279034d25fec634abba91c8e2f8f44f3088e4a Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 20 Jun 2023 16:00:45 +0000 Subject: [PATCH 2/4] - Drop %sysusers_create_inline It's deprecated and the only user of this macro is being converted to %sysusers_create_package. So drop it now before the deprecated macro attracts more users. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=99 --- macros.systemd | 7 ------- systemd-rpm-macros.changes | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/macros.systemd b/macros.systemd index 28762b5..994a496 100644 --- a/macros.systemd +++ b/macros.systemd @@ -290,10 +290,3 @@ SYSTEMD_INLINE_EOF\ %(cat %2) \ SYSTEMD_INLINE_EOF\ %{nil} - -# Deprecated. Use %sysusers_create_package instead -%sysusers_create_inline() \ -[ -x /usr/bin/systemd-sysusers ] && /usr/bin/systemd-sysusers - < + +- Drop %sysusers_create_inline + + It's deprecated and the only user of this macro is being converted to + %sysusers_create_package. So drop it now before the deprecated macro attracts + more users. + ------------------------------------------------------------------- Tue Jun 20 14:58:35 UTC 2023 - Franck Bui From f5529978299450195dfdb09f1a1e1720efb98e44e07bb3fd24f9cac16e390c7a Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 20 Jun 2023 16:04:19 +0000 Subject: [PATCH 3/4] - Drop %tmpfiles_create_package It can't work during transactional updates because the paths that systemd-tmpfiles usually operates on (such as /var) can't be changed. It appears that the only user of this macro doesn't really need this macro so let's drop it. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=100 --- macros.systemd | 27 --------------------------- systemd-rpm-macros.changes | 10 ++++++++++ 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/macros.systemd b/macros.systemd index 994a496..0b90a34 100644 --- a/macros.systemd +++ b/macros.systemd @@ -239,33 +239,6 @@ fi \ /usr/bin/systemd-sysusers %{?*} || : \ %{nil} -# This may be used by package installation scripts to create files according to -# their tmpfiles configuration from a package installation script, even before -# the files of that package are installed on disk. -# -# FIXME: this macro should be removed because it cannot work on transactional -# systems since directories that systemd-tmpfiles usually operates on (i.e. -# /var, /etc) are not available during (transactional) updates. So packages -# can't rely on the behavior this macro is supposed to provide. -# -# Example: -# Source1: %{name}-tmpfiles.conf -# ... -# %install -# install -D %SOURCE1 %{buildroot}%{_tmpfilesdir}/%{name}.conf -# %pre -# %tmpfiles_create_package %{name} %SOURCE1 -# %files -# %{_tmpfilesdir}/%{name}.conf -# -%tmpfiles_create_package() \ -%{expand:%%{?!__systemd_twoargs_%#:%%{error:The %%%%tmpfiles_create_package macro requires two arguments}}} \ -[ -d /run/systemd/system ] && [ -x /usr/bin/systemd-tmpfiles ] && \ - /usr/bin/systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - < + +- Drop %tmpfiles_create_package + + It can't work during transactional updates because the paths that + systemd-tmpfiles usually operates on (such as /var) can't be changed. It + appears that the only user of this macro doesn't really need this macro so + let's drop it. + ------------------------------------------------------------------- Tue Jun 20 15:57:37 UTC 2023 - Franck Bui From f946ee27db99f3ab563a50282dcf3f1ae6dd5a8308a55720d35e586afb80e438 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Wed, 21 Jun 2023 08:51:21 +0000 Subject: [PATCH 4/4] - Bump to version 24 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd-rpm-macros?expand=0&rev=101 --- systemd-rpm-macros.changes | 5 +++++ systemd-rpm-macros.spec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/systemd-rpm-macros.changes b/systemd-rpm-macros.changes index 445ba32..33b47bc 100644 --- a/systemd-rpm-macros.changes +++ b/systemd-rpm-macros.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jun 20 16:08:47 UTC 2023 - Franck Bui + +- Bump to version 24 + ------------------------------------------------------------------- Tue Jun 20 16:01:33 UTC 2023 - Franck Bui diff --git a/systemd-rpm-macros.spec b/systemd-rpm-macros.spec index 2b68590..62abdae 100644 --- a/systemd-rpm-macros.spec +++ b/systemd-rpm-macros.spec @@ -17,7 +17,7 @@ Name: systemd-rpm-macros -Version: 23 +Version: 24 Release: 0 Summary: RPM macros for systemd License: LGPL-2.1-or-later