plocate/plocate.spec

96 lines
2.7 KiB
RPMSpec

Name: plocate
Version: 1.1.8
Release: %autorelease
Summary: Much faster locate
License: GPLv2+
URL: https://plocate.sesse.net/
Source0: https://plocate.sesse.net/download/plocate-%{version}.tar.gz
Source1: plocate.sysusers
# Submitted upstream via mail
Patch1: meson-patch1.diff
BuildRequires: meson
BuildRequires: gcc-c++
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(liburing)
BuildRequires: pkgconfig(libzstd)
BuildRequires: libatomic
# The plan is to provide both mlocate and plocate for one or two
# Fedora releases, and then retire mlocate when the bugs in plocate
# have been ironed out. Thus, we only allow one or the other to be
# installed.
Conflicts: mlocate
%description
plocate is a locate(1) based on posting lists, giving much faster
searches on a much smaller index. It is a drop-in replacement for
mlocate in nearly all aspects, and is fast on SSDs and non-SSDs alike.
%prep
%autosetup -p1
%build
%meson -Dsystemdunitdir=%_unitdir
%meson_build
%install
%meson_install
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/plocate.conf
ln -s plocate %{buildroot}%{_bindir}/locate
# A state file to carry information from %%post to %%posttrans. See
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_saving_state_between_scriptlets.
%global plocate_start_now %{_localstatedir}/lib/rpm-state/plocate_start_now
%pre
%sysusers_create_compat %{SOURCE1}
%post
%systemd_post plocate-updatedb.service plocate-updatedb.timer
if [ $1 == 1 ] && [ -d /run/systemd ]; then
touch %{plocate_start_now} || :
fi
%preun
%systemd_preun plocate-updatedb.service plocate-updatedb.timer
%postun
%systemd_postun_with_restart plocate-updatedb.service plocate-updatedb.timer
%posttrans
# The timer runs once per day. On new installs, let's start both the
# timer and the service immediately in the background, so that the db
# becomes populated. When people install this package onto a running
# system, it's reasonable to assume that they want to use the database.
if [ -f %{plocate_start_now} ]; then
rm %{plocate_start_now} || :
if systemctl is-enabled plocate-updatedb.timer &>/dev/null; then
systemctl start --no-block plocate-updatedb.timer plocate-updatedb.service || :
fi
fi
%files
%license COPYING
%doc README
%attr(02755,-,plocate) %_bindir/plocate
%_bindir/locate
%_sbindir/plocate-build
%_sbindir/updatedb
%_unitdir/plocate-updatedb.service
%_unitdir/plocate-updatedb.timer
%_mandir/man1/plocate.1*
%_mandir/man5/updatedb.conf.5*
%_mandir/man8/plocate-build.8*
%_mandir/man8/updatedb.8*
%_sysusersdir/plocate.conf
%dir %{_sharedstatedir}/plocate
%{_sharedstatedir}/plocate/CACHEDIR.TAG
%changelog
%autochangelog