LFS-RPM/SPECS/plocate.spec

132 lines
3.6 KiB
RPMSpec
Raw Permalink Normal View History

2023-05-19 10:54:39 +08:00
%if 0%{?!__meson:1} == 1
%global __meson %{_bindir}/meson
%endif
%if 0%{?!__ninja:1} == 1
%global __ninja %{_bindir}/ninja
%endif
Name: plocate
Version: 1.1.18
2023-05-28 22:38:31 +08:00
Release: %{?repo}0.rc4%{?dist}
2023-05-19 10:54:39 +08:00
Summary: A much faster locate
Group: System Environment/Utilities
License: GPL-2.0-or-later and GPL-2.0-only
URL: https://plocate.sesse.net/
2023-05-19 17:11:38 +08:00
Source0: https://plocate.sesse.net/download/plocate-%{version}.tar.gz
2023-05-21 14:05:09 +08:00
Patch0: plocate-1.1.18-remove-plocate-build.patch
2023-05-19 10:54:39 +08:00
BuildRequires: %{__meson}
BuildRequires: %{__ninja}
BuildRequires: pkgconfig(liburing)
2023-05-20 05:29:29 +08:00
BuildRequires: pkgconfig(libzstd)
BuildRequires: libstdc++-devel
2023-05-28 22:38:31 +08:00
%if 0%{?_yjl_sysusers:1} == 1
Requires(pre): %{_yjl_sysusers}
%endif
2023-05-20 05:29:29 +08:00
2023-05-19 10:54:39 +08:00
%description
plocate is a locate based on posting lists. Compared to mlocate,
it is much faster, and its index is much smaller. updatedb speed
is similar (or you can convert mlocate's index to plocate format
using plocate-build). It supports most mlocate options;
see --help or the man page (man -l plocate.1) for more information.
%prep
%setup -q
2023-05-21 14:05:09 +08:00
%patch 0 -p1
2023-05-19 10:54:39 +08:00
%build
2023-05-21 14:05:09 +08:00
%{__meson} setup \
--prefix=%{_prefix} \
-Dinstall_systemd=false \
2023-05-19 10:54:39 +08:00
obj
cd obj
%{__ninja}
2023-05-21 14:05:09 +08:00
# If systemD files are wanted...
2023-05-19 17:11:38 +08:00
# -Dsystemunitdir=%%_unitdir -Dinstall_systemd=true \
2023-05-19 10:54:39 +08:00
%install
cd obj
DESTDIR=%{buildroot} %{__ninja} install
ln -s plocate %{buildroot}%{_bindir}/locate
2023-05-19 17:11:38 +08:00
#ln -s plocate.1 %{buildroot}%{_mandir}/man1/locate.1
cat > %{buildroot}%{_mandir}/man1/locate.1 << "EOF"
.so man1/plocate.1
EOF
[ ! -d %{buildroot}%{_sysconfdir}/cron.daily ] && \
2023-05-20 05:29:29 +08:00
mkdir -p %{buildroot}%{_sysconfdir}/cron.hourly
2023-05-19 17:11:38 +08:00
2023-05-20 05:29:29 +08:00
cat > %{buildroot}%{_sysconfdir}/cron.hourly/updatedb.sh << "EOF"
2023-05-19 17:11:38 +08:00
#!/bin/bash
# Update the plocate database
2023-05-20 12:32:09 +08:00
# 9900 = two hours, 45 minutes
2023-05-20 05:29:29 +08:00
2023-05-20 12:32:09 +08:00
CURT=`%{_bindir}/date +%s`
MODT=`%{_bindir}/stat -c '%Y' %{_sharedstatedir}/plocate/plocate.db` ||\
MODT=0
DIFF=$(($CURT-$MODT))
if [ $DIFF -gt 9900 ]; then
2023-05-20 05:29:29 +08:00
%{_bindir}/nice -n 19 %{_sbindir}/updatedb
2023-05-20 12:32:09 +08:00
fi
2023-05-19 17:11:38 +08:00
EOF
cat > %{buildroot}%{_sysconfdir}/updatedb.conf << "EOF"
# %{_sysconfdir}/updatedb.conf
# see man 5 updatedb.conf
#
2023-05-21 00:50:09 +08:00
PRUNEPATHS = "/backup /opt/texlive"
2023-05-19 17:11:38 +08:00
EOF
touch %{buildroot}%{_sharedstatedir}/plocate/plocate.db
2023-05-19 10:54:39 +08:00
2023-05-28 22:38:31 +08:00
%pre
%if 0%{?_yjl_sysusers:1} == 1
2023-06-03 06:49:24 +08:00
%{_yjl_sysusers} --onlygroup plocate
2023-05-28 22:38:31 +08:00
%else
getent group plocate >/dev/null 2>&1 ||groupadd -r plocate
%endif
2023-05-19 10:54:39 +08:00
%files
%defattr(-,root,root,-)
2023-05-19 17:11:38 +08:00
%attr(0644,root,root) %config(noreplace,missingok) %{_sysconfdir}/updatedb.conf
2023-05-20 05:29:29 +08:00
%attr(0755,root,root) %{_sysconfdir}/cron.hourly/updatedb.sh
2023-05-19 17:11:38 +08:00
%attr(2755,root,plocate) %{_bindir}/plocate
2023-05-19 10:54:39 +08:00
%{_bindir}/locate
%attr(0755,root,root) %{_sbindir}/updatedb
%attr(0644,root,root) %{_mandir}/man1/plocate.1*
2023-05-19 17:11:38 +08:00
%attr(0644,root,root) %{_mandir}/man1/locate.1*
2023-05-19 10:54:39 +08:00
%attr(0644,root,root) %{_mandir}/man5/updatedb.conf.5*
%attr(0644,root,root) %{_mandir}/man8/updatedb.8*
%dir %{_sharedstatedir}/plocate
%attr(0644,root,root) %{_sharedstatedir}/plocate/CACHEDIR.TAG
2023-05-19 17:11:38 +08:00
%ghost %attr(0640,root,plocate) %verify(not md5 mtime) %{_sharedstatedir}/plocate/plocate.db
%license COPYING
%doc COPYING NEWS README
2023-05-19 10:54:39 +08:00
%changelog
2023-05-28 22:38:31 +08:00
* Sun May 28 2023 Michael A. Peters <anymouseprophet@gmail.com> - 1.1.18-0.rc4
- create the necessary group in %%pre scriptlet
2023-05-21 14:05:09 +08:00
* Sat May 20 2023 Michael A. Peters <anymouseprophet@gmail.com> - 1.1.18-0.rc3
- Don't install plocate-build
2023-05-20 12:32:09 +08:00
* Fri May 19 2023 Michael A. Peters <anymouseprophet@gmail.com> - 1.1.18-0.rc2
- update database via cron.hourly when at least 165 minutes old.
2023-05-20 05:29:29 +08:00
2023-05-19 17:11:38 +08:00
* Fri May 19 2023 Michael A. Peters <anymouseprophet@gmail.com> - 1.1.18-0.dev4
- correct permissions (I hope), cron job until systemd is in use
2023-05-19 10:54:39 +08:00
* Thu May 18 2023 Michael A. Peters <anymouseprophet@gmail.com> - 1.1.18-0.dev1
- Initial spec file for YJL
- Need to setup perms/cronjob (cronjob until systemd)