0.187-6 - Add sysuser support for creating the debuginfod user

Resolves: #2095400
[RFE] elfutils use systemd-sysusers

Include:
Use %sysusers_requires_compat to match %sysusers_create_compat
Silence mixed-use-of-spaces-and-tabs
This commit is contained in:
Mark Wielaard 2022-10-01 03:48:56 +02:00
parent abc540d1a9
commit cb53a82200
2 changed files with 32 additions and 3 deletions

View File

@ -0,0 +1 @@
u debuginfod - "elfutils debuginfo server" /var/cache/debuginfod -

View File

@ -1,11 +1,12 @@
Name: elfutils
Version: 0.187
%global baserelease 5
%global baserelease 6
Release: %{baserelease}%{?dist}
URL: http://elfutils.org/
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+) and GFDL
Source: %{?source_url}%{name}-%{version}.tar.bz2
Source1: elfutils-debuginfod.sysusers
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
# Needed for isa specific Provides and Requires.
@ -62,6 +63,12 @@ BuildRequires: gettext-devel
%global provide_yama_scope 1
%endif
%global with_sysusers 0
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
%global with_sysusers 1
%endif
# Patches
# https://bugzilla.redhat.com/show_bug.cgi?id=2080957
Patch1: elfutils-0.187-csh-profile.patch
@ -217,11 +224,18 @@ Requires: elfutils-libs%{depsuffix} = %{version}-%{release}
Requires: elfutils-libelf%{depsuffix} = %{version}-%{release}
Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release}
BuildRequires: systemd
%if %{with_sysusers}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: make
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%if %{with_sysusers}
%{?sysusers_requires_compat}
%else
Requires(pre): shadow-utils
%endif
# To extract .deb files with a bsdtar (= libarchive) subshell
Requires: bsdtar
@ -294,6 +308,10 @@ install -Dm0644 config/debuginfod.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysc
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod
touch ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%if %{with_sysusers}
install -Dm0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/elfutils-debuginfod.conf
%endif
%check
# Record some build root versions in build.log
uname -r; rpm -q binutils gcc glibc || true
@ -409,17 +427,24 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/debuginfod
%{_unitdir}/debuginfod.service
%{_sysconfdir}/sysconfig/debuginfod
%if %{with_sysusers}
%{_sysusersdir}/elfutils-debuginfod.conf
%endif
%{_mandir}/man8/debuginfod.8*
%dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod
%ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%pre debuginfod
%if %{with_sysusers}
%sysusers_create_compat %{SOURCE1}
%else
getent group debuginfod >/dev/null || groupadd -r debuginfod
getent passwd debuginfod >/dev/null || \
useradd -r -g debuginfod -d /var/cache/debuginfod -s /sbin/nologin \
-c "elfutils debuginfo server" debuginfod
exit 0
%endif
%post debuginfod
%systemd_post debuginfod.service
@ -428,6 +453,9 @@ exit 0
%systemd_postun_with_restart debuginfod.service
%changelog
* Fri Sep 30 2022 Mark Wielaard <mjw@redhat.com> - 0.187-6
- Add sysuser support for creating the debuginfod user
* Thu Jun 16 2022 Frank Ch. Eigler <fche@redhat.com> - 0.187-5
- rhbz2088774: ship /etc/profile.d/debuginfod* files even without
default DEBUGINFOD_URLS.