diff --git a/mock-core-configs/mock-core-configs.spec b/mock-core-configs/mock-core-configs.spec index 9bcd700f1..93d87bd48 100644 --- a/mock-core-configs/mock-core-configs.spec +++ b/mock-core-configs/mock-core-configs.spec @@ -50,8 +50,6 @@ Rocky Linux and various other specific or combined chroots. %install -mkdir -p %{buildroot}%{_sysusersdir} - mkdir -p %{buildroot}%{_sysconfdir}/mock/eol/templates mkdir -p %{buildroot}%{_sysconfdir}/mock/templates cp -a etc/mock/*.cfg %{buildroot}%{_sysconfdir}/mock diff --git a/mock-core-configs/mock.conf b/mock/mock.conf similarity index 100% rename from mock-core-configs/mock.conf rename to mock/mock.conf diff --git a/mock/mock.spec b/mock/mock.spec index ecec76ce7..af03db076 100644 --- a/mock/mock.spec +++ b/mock/mock.spec @@ -1,9 +1,6 @@ %bcond_with lint %bcond_without tests -# mock group id allocate for Fedora -%global mockgid 135 - %global __python %{__python3} %global python_sitelib %{python3_sitelib} @@ -146,6 +143,9 @@ Mock plugin that preprocesses spec files using rpmautospec. %package filesystem Summary: Mock filesystem layout Requires(pre): shadow-utils +BuildRequires: systemd-rpm-macros + +%{?sysusers_requires_compat} %description filesystem Filesystem layout and group for Mock. @@ -169,6 +169,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 + %install #base filesystem mkdir -p %{buildroot}%{_sysconfdir}/mock/eol/templates @@ -213,13 +216,15 @@ install -d %{buildroot}/var/cache/mock mkdir -p %{buildroot}%{_pkgdocdir} install -p -m 0644 docs/site-defaults.cfg %{buildroot}%{_pkgdocdir} +mkdir -p %{buildroot}%{_sysusersdir} +install -p -D -m 0644 %{name}.conf %{buildroot}%{_sysusersdir} + sed -i 's/^_MOCK_NVR = None$/_MOCK_NVR = "%name-%version-%release"/' \ %{buildroot}%{_libexecdir}/mock/mock -%pre filesystem -# check for existence of mock group, create it if not found -getent group mock > /dev/null || groupadd -f -g %mockgid -r mock -exit 0 + +%pre filesystem -f sysusers_script + %check %if %{with lint} @@ -292,6 +297,7 @@ pylint-3 py/mockbuild/ py/*.py py/mockbuild/plugins/* || : %dir %{_sysconfdir}/mock/eol/templates %dir %{_sysconfdir}/mock/templates %dir %{_datadir}/cheat +%config(noreplace) %{_sysusersdir}/mock.conf %changelog * Tue May 14 2024 Jakub Kadlcik 5.6-1 diff --git a/releng/release-notes-next/sysusers-handled-by-rpm.feature b/releng/release-notes-next/sysusers-handled-by-rpm.feature new file mode 100644 index 000000000..7c163b740 --- /dev/null +++ b/releng/release-notes-next/sysusers-handled-by-rpm.feature @@ -0,0 +1,3 @@ +New Mock RPM package provides the systemd-sysusers drop-in configuration file for automatic +`mock 135` group ID allocation. +https://rpm-software-management.github.io/rpm/manual/users_and_groups.html