Skip to content

Commit

Permalink
Enable RPM sysusers integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nikromen committed Jul 25, 2024
1 parent b9d77f4 commit 30bfd4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 0 additions & 2 deletions mock-core-configs/mock-core-configs.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
17 changes: 10 additions & 7 deletions mock/mock.spec
Original file line number Diff line number Diff line change
@@ -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}

Expand All @@ -17,7 +14,8 @@ License: GPL-2.0-or-later
# cd mock
# git reset --hard %%{name}-%%{version}
# tito build --tgz
Source: %{name}-%{version}.tar.gz
Source0: %{name}-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/rpm-software-management/mock/main/mock-core-configs/mock.conf
URL: https://github.com/rpm-software-management/mock/
BuildArch: noarch
Requires: tar
Expand Down Expand Up @@ -146,6 +144,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.
Expand Down Expand Up @@ -213,13 +214,14 @@ 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 mock.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
%sysusers_create_compat %{SOURCE1}

%check
%if %{with lint}
Expand Down Expand Up @@ -257,6 +259,7 @@ pylint-3 py/mockbuild/ py/*.py py/mockbuild/plugins/* || :
%config(noreplace) %{_sysconfdir}/%{name}/*.ini
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
%config(noreplace) %{_sysconfdir}/security/console.apps/%{name}
%{_sysusersdir}/mock.conf

# directory for personal gpg keys
%dir %{_sysconfdir}/pki/mock
Expand Down

0 comments on commit 30bfd4c

Please sign in to comment.