plocate/plocate.spec

92 lines
2.7 KiB
RPMSpec
Raw Normal View History

Name: plocate
Version: 1.1.7
Release: 1%{?dist}
Summary: Much faster locate
2021-02-20 12:06:34 +00:00
License: GPLv2+
URL: https://plocate.sesse.net/
Source0: https://git.sesse.net/?p=plocate;a=snapshot;h=%{version};sf=tgz#/plocate-%{version}.tar.gz
%global shortcommit 877be5c
2021-02-20 12:06:34 +00:00
Source1: plocate.sysusers
BuildRequires: meson
BuildRequires: gcc-c++
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(liburing)
BuildRequires: pkgconfig(libzstd)
BuildRequires: libatomic
2021-02-20 12:06:34 +00:00
%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 -n plocate-%{version}-%{shortcommit}
%build
%meson
2021-02-20 12:06:34 +00:00
%meson_build
%install
%meson_install
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/plocate.conf
# 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
2021-02-20 12:06:34 +00:00
%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
2021-02-20 12:06:34 +00:00
%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
2021-02-20 12:06:34 +00:00
%files
%license COPYING
%doc README
%attr(02755,-,plocate) %_bindir/plocate
%_sbindir/plocate-build
%_sbindir/updatedb
2021-02-20 12:06:34 +00:00
%_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*
2021-02-20 12:06:34 +00:00
%_sysusersdir/plocate.conf
%dir %{_sharedstatedir}/plocate
%{_sharedstatedir}/plocate/CACHEDIR.TAG
2021-02-20 12:06:34 +00:00
%exclude /usr/lib/debug
%changelog
* Wed May 12 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.7-1
- Resolve comments from initial review
- Start the service and timer in %%posttrans
2021-02-20 12:06:34 +00:00
* Fri Feb 19 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.1.4-1
- First version