summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Lin <jeffrey@icurse.nl>2021-03-05 10:31:54 -0500
committerSam James <sam@gentoo.org>2021-03-20 05:33:38 +0000
commitfb791526ce7bc605f666b2e833962fafaaa317fd (patch)
treed390db80fefd7142650e037c1fa83b37d6f56184 /sys-apps/plocate
parentdev-go/act: add -x for verbose Go build (diff)
downloadgentoo-fb791526ce7bc605f666b2e833962fafaaa317fd.tar.gz
gentoo-fb791526ce7bc605f666b2e833962fafaaa317fd.tar.bz2
gentoo-fb791526ce7bc605f666b2e833962fafaaa317fd.zip
sys-apps/plocate: new package
Package-Manager: Portage-3.0.16, Repoman-3.0.2 Signed-off-by: Jeffrey Lin <jeffrey@icurse.nl> Closes: https://github.com/gentoo/gentoo/pull/19786 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-apps/plocate')
-rw-r--r--sys-apps/plocate/Manifest1
-rw-r--r--sys-apps/plocate/files/plocate-1.1.5-no-systemd-check.patch21
-rw-r--r--sys-apps/plocate/files/plocate-cron.conf9
-rw-r--r--sys-apps/plocate/files/plocate.cron51
-rw-r--r--sys-apps/plocate/files/updatedb.conf16
-rw-r--r--sys-apps/plocate/metadata.xml33
-rw-r--r--sys-apps/plocate/plocate-1.1.5.ebuild77
7 files changed, 208 insertions, 0 deletions
diff --git a/sys-apps/plocate/Manifest b/sys-apps/plocate/Manifest
new file mode 100644
index 000000000000..17237dc8ed47
--- /dev/null
+++ b/sys-apps/plocate/Manifest
@@ -0,0 +1 @@
+DIST plocate-1.1.5.tar.gz 69090 BLAKE2B 70b398eb1a5d7b36294188966ef5f46843d9db9f41021a294d88795944412b4ef3819771082955a74a9945296fa14c59461a4ab4af197691f7085a40eeb7f0ef SHA512 6169ea7b3587e12e555a42e0c70e149626810f5e6f9f1f03ca1b069d7892d45bc52cabf072324eaa6f14055943dd680a71642914c0218a770e2b00a22c75efbc
diff --git a/sys-apps/plocate/files/plocate-1.1.5-no-systemd-check.patch b/sys-apps/plocate/files/plocate-1.1.5-no-systemd-check.patch
new file mode 100644
index 000000000000..b54eda0ec38e
--- /dev/null
+++ b/sys-apps/plocate/files/plocate-1.1.5-no-systemd-check.patch
@@ -0,0 +1,21 @@
+diff -aur a/meson.build b/meson.build
+--- a/meson.build 2021-03-05 16:35:00.411781507 -0500
++++ b/meson.build 2021-03-05 16:35:41.641782317 -0500
+@@ -76,17 +76,9 @@
+ configuration: conf_data)
+ install_man(updatedb_conf_man)
+
+-if get_option('install_systemd')
+- systemd = dependency('systemd', required: false)
+- if systemd.found()
+- unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ updatedb_service = configure_file(input: 'plocate-updatedb.service.in',
+ output: 'plocate-updatedb.service',
+ configuration: conf_data)
+- install_data(updatedb_service, install_dir: unitdir)
+- install_data('plocate-updatedb.timer', install_dir: unitdir)
+- endif
+-endif
+
+ # Requires having TurboPFor checked out, so not built by default.
+ # Unless you have a recent Meson, there's no apparently good way
diff --git a/sys-apps/plocate/files/plocate-cron.conf b/sys-apps/plocate/files/plocate-cron.conf
new file mode 100644
index 000000000000..f207344a9e6c
--- /dev/null
+++ b/sys-apps/plocate/files/plocate-cron.conf
@@ -0,0 +1,9 @@
+# nice value to run at: see -n in nice(1)
+NICE="19"
+
+# ionice class to run at: see -c in ionice(1)
+# you have to install sys-apps/util-linux manually
+IONICE_CLASS="2"
+
+# ionice priority to run at: see -n in ionice(1)
+IONICE_PRIORITY="7"
diff --git a/sys-apps/plocate/files/plocate.cron b/sys-apps/plocate/files/plocate.cron
new file mode 100644
index 000000000000..ebcfcbffe7b0
--- /dev/null
+++ b/sys-apps/plocate/files/plocate.cron
@@ -0,0 +1,51 @@
+#! /bin/sh
+set -e
+
+# check if we run on battery and if so then don't run
+if which on_ac_power >/dev/null 2>&1; then
+ ON_BATTERY=0
+ on_ac_power >/dev/null 2>&1 || ON_BATTERY=$?
+ if [ "${ON_BATTERY}" -eq 1 ]; then
+ exit 0
+ fi
+fi
+
+# check if we are already running (lockfile)
+LOCKFILE="/var/lock/plocate.daily.lock"
+if [ -e "${LOCKFILE}" ]; then
+ echo >&2 "Warning: \"${LOCKFILE}\" already present, not running updatedb."
+ exit 1
+fi
+touch "${LOCKFILE}"
+# trap the lockfile only if we really run the updatedb
+trap "rm -f ${LOCKFILE}" EXIT
+
+# source the user specified variables
+if [ -f /etc/plocate-cron.conf ]; then
+ . /etc/plocate-cron.conf
+fi
+
+# check the config file
+NODEVS=""
+if [ ! -f /etc/updatedb.conf ]; then
+ NODEVS=$(awk '$1 == "nodev" && $2 != "rootfs" { print $2 }' /proc/filesystems)
+fi
+
+# alter the priority of the updatedb process
+if [ -x /usr/bin/renice ]; then
+ /usr/bin/renice +${NICE:-19} -p $$ > /dev/null 2>&1
+fi
+if [ -x /usr/bin/ionice ] && /usr/bin/ionice -c3 true 2>/dev/null; then
+ /usr/bin/ionice -c${IONICE_CLASS:-2} -n${IONICE_PRIORITY:-7} -p $$ > /dev/null 2>&1
+fi
+
+# Cleanup old temp files from previous unsuccessful runs
+rm -f /var/lib/plocate/plocate.db.*
+
+# run the updatedb if possible
+if [ -x /usr/sbin/updatedb ]; then
+ /usr/sbin/updatedb -f "${NODEVS}"
+else
+ echo >&2 "Warning: \"/usr/sbin/updatedb\" is not executable, unable to run updatedb."
+ exit 0
+fi
diff --git a/sys-apps/plocate/files/updatedb.conf b/sys-apps/plocate/files/updatedb.conf
new file mode 100644
index 000000000000..6a00d3aa2b94
--- /dev/null
+++ b/sys-apps/plocate/files/updatedb.conf
@@ -0,0 +1,16 @@
+# /etc/updatedb.conf: config file for slocate
+
+# This file sets variables that are used by updatedb.
+# For more info, see the updatedb.conf(5) manpage.
+
+# Filesystems that are pruned from updatedb database
+PRUNEFS="afs anon_inodefs auto autofs bdev binfmt binfmt_misc cgroup cifs coda configfs cramfs cpuset debugfs devfs devpts devtmpfs ecryptfs eventpollfs exofs futexfs ftpfs fuse fusectl gfs gfs2 hostfs hugetlbfs inotifyfs iso9660 jffs2 lustre misc mqueue ncpfs nfs NFS nfs4 nfsd nnpfs ocfs ocfs2 pipefs proc ramfs rpc_pipefs securityfs selinuxfs sfs shfs smbfs sockfs spufs sshfs subfs supermount sysfs tmpfs ubifs udf usbfs vboxsf vperfctrfs"
+
+# Paths which are pruned from updatedb database
+PRUNEPATHS="/tmp /var/tmp /var/cache /var/lock /var/run /var/spool"
+
+# Folder names that are pruned from updatedb database
+PRUNENAMES=".git .hg .svn CVS"
+
+# Skip bind mounts.
+PRUNE_BIND_MOUNTS="yes"
diff --git a/sys-apps/plocate/metadata.xml b/sys-apps/plocate/metadata.xml
new file mode 100644
index 000000000000..1920c0fd8497
--- /dev/null
+++ b/sys-apps/plocate/metadata.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>arsen@aarsen.me</email>
+ <name>Arsen Arsenović</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>jeffrey@icurse.nl</email>
+ <name>Jeffrey Lin</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <use>
+ <flag name="io-uring">Enable efficient I/O via <pkg>sys-libs/liburing</pkg>.</flag>
+ </use>
+ <longdescription>
+plocate works by creating an inverted index over trigrams (combinations of
+three bytes) in the search strings, which allows it to rapidly narrow down the
+set of candidates to a very small list, instead of linearly scanning through
+every entry. It does nearly all I/O asynchronously using io_uring if available
+(Linux 5.1+), which reduces the impact of seek latency on systems without SSDs.
+Like mlocate and slocate, the returned file set is user-dependent, ie. a user
+will only see a file if find(1) would list it (all directories from the root
+have +rx permissions).
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-apps/plocate/plocate-1.1.5.ebuild b/sys-apps/plocate/plocate-1.1.5.ebuild
new file mode 100644
index 000000000000..ca1701e89c20
--- /dev/null
+++ b/sys-apps/plocate/plocate-1.1.5.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit linux-info meson systemd
+
+DESCRIPTION="Posting locate is a much faster locate"
+HOMEPAGE="https://plocate.sesse.net/"
+SRC_URI="https://plocate.sesse.net/download/${P}.tar.gz"
+
+LICENSE="GPL-2 GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="io-uring"
+
+RDEPEND="
+ acct-group/locate
+ app-arch/zstd:=
+ io-uring? ( sys-libs/liburing:= )
+ !sys-apps/mlocate
+"
+DEPEND="${RDEPEND}"
+
+CONFIG_CHECK="~IO_URING"
+ERROR_IO_URING="required for USE=io-uring"
+
+PATCHES=(
+ "${FILESDIR}/${PN}"-1.1.5-no-systemd-check.patch
+)
+
+src_prepare() {
+ # pretend liburing dep doesn't exist when USE flag off
+ if ! use io-uring; then
+ sed -i "s/dependency('liburing/dependency('/" meson.build || die
+ fi
+
+ # we'll install the manpage ourself to locate.1
+ sed -i "/install_man('plocate.1')/d" meson.build || die
+
+ default
+}
+
+src_configure() {
+ local emesonargs=(
+ -Dlocategroup=locate
+ )
+ meson_src_configure
+}
+
+src_install() {
+ meson_src_install
+ dodoc README NEWS
+ newman "${S}/${PN}.1" locate.1
+ dosym plocate /usr/bin/locate
+
+ insinto /etc
+ doins "${FILESDIR}"/updatedb.conf
+ doins "${FILESDIR}"/plocate-cron.conf
+ fperms 0644 /etc/{updatedb,plocate-cron}.conf
+
+ insinto /etc/cron.daily
+ newins "${FILESDIR}"/plocate.cron plocate
+ fperms 0755 /etc/cron.daily/plocate
+
+ systemd_dounit "${BUILD_DIR}/${PN}"-updatedb.service "${S}/${PN}"-updatedb.timer
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]]; then
+ elog "The database for the locate command is generated daily by a cron job,"
+ elog "if you install for the first time you can run the updatedb command manually now."
+ elog
+ elog "Note that the /etc/updatedb.conf file is generic,"
+ elog "please customize it to your system requirements."
+ fi
+}