From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 355AC13835B for ; Sat, 20 Mar 2021 05:43:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3DCB7E0878; Sat, 20 Mar 2021 05:43:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 17A9FE087A for ; Sat, 20 Mar 2021 05:43:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 60E6E34067D for ; Sat, 20 Mar 2021 05:43:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8EBB35C5 for ; Sat, 20 Mar 2021 05:43:07 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1616218418.fb791526ce7bc605f666b2e833962fafaaa317fd.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/plocate/files/, sys-apps/plocate/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-apps/plocate/Manifest sys-apps/plocate/files/plocate-1.1.5-no-systemd-check.patch sys-apps/plocate/files/plocate-cron.conf sys-apps/plocate/files/plocate.cron sys-apps/plocate/files/updatedb.conf sys-apps/plocate/metadata.xml sys-apps/plocate/plocate-1.1.5.ebuild X-VCS-Directories: sys-apps/plocate/files/ sys-apps/plocate/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: fb791526ce7bc605f666b2e833962fafaaa317fd X-VCS-Branch: master Date: Sat, 20 Mar 2021 05:43:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 36d5c766-1a94-4de6-8e34-6822c079e54c X-Archives-Hash: c3eeb1409e3e6725cef8c0c18bd37611 commit: fb791526ce7bc605f666b2e833962fafaaa317fd Author: Jeffrey Lin icurse nl> AuthorDate: Fri Mar 5 15:31:54 2021 +0000 Commit: Sam James gentoo 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 icurse.nl> Closes: https://github.com/gentoo/gentoo/pull/19786 Signed-off-by: Sam James 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 @@ + + + + + sam@gentoo.org + Sam James + + + arsen@aarsen.me + Arsen Arsenović + + + jeffrey@icurse.nl + Jeffrey Lin + + + proxy-maint@gentoo.org + Proxy Maintainers + + + Enable efficient I/O via sys-libs/liburing. + + +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). + + 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 +}