public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/plocate/files/, sys-apps/plocate/
Date: Sat, 20 Mar 2021 05:43:07 +0000 (UTC)	[thread overview]
Message-ID: <1616218418.fb791526ce7bc605f666b2e833962fafaaa317fd.sam@gentoo> (raw)

commit:     fb791526ce7bc605f666b2e833962fafaaa317fd
Author:     Jeffrey Lin <jeffrey <AT> icurse <DOT> nl>
AuthorDate: Fri Mar  5 15:31:54 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 20 05:33:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb791526

sys-apps/plocate: new package

Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Jeffrey Lin <jeffrey <AT> icurse.nl>
Closes: https://github.com/gentoo/gentoo/pull/19786
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/plocate/Manifest                          |  1 +
 .../files/plocate-1.1.5-no-systemd-check.patch     | 21 ++++++
 sys-apps/plocate/files/plocate-cron.conf           |  9 +++
 sys-apps/plocate/files/plocate.cron                | 51 ++++++++++++++
 sys-apps/plocate/files/updatedb.conf               | 16 +++++
 sys-apps/plocate/metadata.xml                      | 33 ++++++++++
 sys-apps/plocate/plocate-1.1.5.ebuild              | 77 ++++++++++++++++++++++
 7 files changed, 208 insertions(+)

diff --git a/sys-apps/plocate/Manifest b/sys-apps/plocate/Manifest
new file mode 100644
index 00000000000..17237dc8ed4
--- /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 00000000000..b54eda0ec38
--- /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 00000000000..f207344a9e6
--- /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 00000000000..ebcfcbffe7b
--- /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 00000000000..6a00d3aa2b9
--- /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 00000000000..1920c0fd849
--- /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 00000000000..ca1701e89c2
--- /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
+}


             reply	other threads:[~2021-03-20  5:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-20  5:43 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-08-19  2:24 [gentoo-commits] repo/gentoo:master commit in: sys-apps/plocate/files/, sys-apps/plocate/ Sam James
2021-08-25  7:52 Florian Schmaus
2022-07-15  1:26 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1616218418.fb791526ce7bc605f666b2e833962fafaaa317fd.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox