File plocate.spec of Package plocate
#
# spec file for package plocate
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: plocate
Version: @SERVICE@
Release: 0
Summary: A much faster locate(1)
License: GPL-2.0-only
Group: System/Monitoring
URL: https://plocate.sesse.net
Source0: %{name}-%{version}.tar.xz
Source1: %{name}-user.conf
Source2: updatedb.conf
Source3: %{name}.rpmlintrc
BuildRequires: gcc-c++
BuildRequires: meson
BuildRequires: pkgconfig
BuildRequires: pkgconfig(liburing)
BuildRequires: pkgconfig(libzstd)
Requires(pre): permissions
Conflicts: mlocate
%{?systemd_requires}
%description
plocate is a locate based on posting lists, completely replacing mlocate
with a much faster (and smaller) index. It is suitable as a default locate
on your system.
%prep
%autosetup
%build
%meson -Dsystemunitdir=%{_unitdir} -Dinstall_systemd=true -Dlocategroup=plocate
%meson_build
%install
%meson_install
install -Dm644 %{SOURCE1} %{buildroot}%{_sysusersdir}/%{name}.conf
install -Dm644 %{SOURCE2} %{buildroot}%{_sysconfdir}/updatedb.conf
install -dm755 %{buildroot}%{_sbindir}
ln -sf service %{buildroot}%{_sbindir}/rc%{name}-updatedb
%pre
%sysusers_create_package %{name} %{SOURCE1}
%service_add_pre %{name}-updatedb.service %{name}-updatedb.timer
%post
%set_permissions %{_sharedstatedir}/%{name}/%{name}.db %{_bindir}/%{name}
%service_add_post %{name}-updatedb.service %{name}-updatedb.timer
%preun
%service_del_preun %{name}-updatedb.service %{name}-updatedb.timer
%postun
%service_del_postun %{name}-updatedb.service %{name}-updatedb.timer
%verifyscript
%verify_permissions -e %{_sharedstatedir}/%{name}/%{name}.db -e %{_bindir}/%{name}
%files
%doc NEWS README
%verify(not mode) %attr(2755,-,plocate) %{_bindir}/%{name}
%{_sysusersdir}/%{name}.conf
%{_unitdir}/%{name}-updatedb.service
%{_unitdir}/%{name}-updatedb.timer
%{_sbindir}/updatedb
%{_sbindir}/%{name}-build
%{_sbindir}/rc%{name}-updatedb
%{_mandir}/man1/%{name}.1%{?ext_man}
%{_mandir}/man5/updatedb.conf.5%{?ext_man}
%{_mandir}/man8/%{name}-build.8%{?ext_man}
%{_mandir}/man8/updatedb.8%{?ext_man}
%config(noreplace) %{_sysconfdir}/updatedb.conf
%dir %{_sharedstatedir}/%{name}
%{_sharedstatedir}/%{name}/CACHEDIR.TAG
%ghost %verify(not md5 size mtime) %attr(0640,-,plocate) %{_sharedstatedir}/%{name}/%{name}.db
%license COPYING
%changelog