diff --git a/mock/mock.spec b/mock/mock.spec index 77e0e416e..063431630 100644 --- a/mock/mock.spec +++ b/mock/mock.spec @@ -1,6 +1,22 @@ %bcond_with lint %bcond_without tests +# In modern distributions with RPM v4.19+ (e.g., Fedora 39+), the %%pre +# scriptlet for creating users/groups is no longer necessary due to the built-in +# sysusers feature. To enable it, we simply include the `mock.conf` file in the +# package payload so that RPM knows what actions to take. For older +# distributions, however, the %%sysusers_requires_compat macro is typically +# used. This macro isn't ideal for Mock's packaging style (tito) because it +# requires mock.conf to be an additional SourceN file rather than within +# `Source0` tarball. Instead of using that macro, we manually generate the +# scriptlet content for older distributions using the `sysusers.generate-pre.sh` +# script (which is the `%%sysusers_requires_compat` "internal"). +%if 0%{?rhel} && 0%{?rhel} <= 9 +%bcond_without sysusers_compat +%else +%bcond_with sysusers_compat +%endif + %global __python %{__python3} %global python_sitelib %{python3_sitelib} @@ -171,8 +187,9 @@ done ./precompile-bash-completion "mock.complete" -# this is what %%sysusers_create_compat will expand to -%{_rpmconfigdir}/sysusers.generate-pre.sh mock.conf > sysusers_script +%if %{with sysusers_compat} +%{_rpmconfigdir}/sysusers.generate-pre.sh mock.conf > sysusers_script || : +%endif argparse-manpage --pyfile ./py/mock-hermetic-repo.py --function _argparser > mock-hermetic-repo.1 @@ -230,7 +247,9 @@ sed -i 's/^_MOCK_NVR = None$/_MOCK_NVR = "%name-%version-%release"/' \ %{buildroot}%{_libexecdir}/mock/mock +%if %{with sysusers_compat} %pre filesystem -f sysusers_script +%endif %check diff --git a/releng/release-notes-next/sysusers-on-mageia.bugfix b/releng/release-notes-next/sysusers-on-mageia.bugfix new file mode 100644 index 000000000..10583fabd --- /dev/null +++ b/releng/release-notes-next/sysusers-on-mageia.bugfix @@ -0,0 +1,2 @@ +The %pre scriptlet is not generated for modern distributions like Fedora 39+ or +Mageia (group/user additions are handled by an RPM built-in feature).