Accepting request 1094319 from Base:System

- Bump to version 24

- 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.

- 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.

- 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/request/show/1094319
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd-rpm-macros?expand=0&rev=47
This commit is contained in:
Dominique Leuenberger 2023-06-23 19:52:20 +00:00 committed by Git OBS Bridge
commit fa8597b82d
3 changed files with 48 additions and 38 deletions

View File

@ -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,29 +235,8 @@ fi \
%sysusers_create() \
%{expand:%%{?__systemd_someargs_%#:%%__systemd_someargs_%# sysusers_create}} \
[ -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.
#
# 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 ] && \
/usr/bin/systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF || : \
%(cat %2) \
SYSTEMD_INLINE_EOF\
[ -z "${TRANSACTIONAL_UPDATE}" ] && [ -x /usr/bin/systemd-sysusers ] && \
/usr/bin/systemd-sysusers %{?*} || : \
%{nil}
# This should be used by package installation scripts which require users or
@ -271,17 +253,13 @@ SYSTEMD_INLINE_EOF\
# %files
# %{_sysusersdir}/%{name}.conf
#
# Note: writing to /etc is not recommended on transactional systems but the
# sysusers must be created now since by calling this macro the package explicitly
# requests that.
#
%sysusers_create_package() \
%{expand:%%{?!__systemd_twoargs_%#:%%{error:The %%%%sysusers_create_package macro requires two arguments}}} \
[ -z "${TRANSACTIONAL_UPDATE}" ] && [ -x /usr/bin/systemd-tmpfiles ] && \
/usr/bin/systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF || : \
[ -x /usr/bin/systemd-sysusers ] && /usr/bin/systemd-sysusers --replace=%_sysusersdir/%1.conf - <<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 - <<SYSTEMD_INLINE_EOF || : \
%{?*} \
SYSTEMD_INLINE_EOF\
%{nil}

View File

@ -1,3 +1,35 @@
-------------------------------------------------------------------
Tue Jun 20 16:08:47 UTC 2023 - Franck Bui <fbui@suse.com>
- Bump to version 24
-------------------------------------------------------------------
Tue Jun 20 16:01:33 UTC 2023 - Franck Bui <fbui@suse.com>
- 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 <fbui@suse.com>
- 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 <fbui@suse.com>
- 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 <fbui@suse.com>

View File

@ -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