FreeBSD Bugzilla – Attachment 241965 Details for
Bug 270657
[NEW PORT] sysutils/plocate - locate that can find all files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated port
0001-updated-verision.patch (text/plain), 16.42 KB, created by
sec
on 2023-05-04 09:09:06 UTC
(
hide
)
Description:
Updated port
Filename:
MIME Type:
Creator:
sec
Created:
2023-05-04 09:09:06 UTC
Size:
16.42 KB
patch
obsolete
>From 4b39f5beaa6f2ccc0c507e32aa15717270054899 Mon Sep 17 00:00:00 2001 >From: Stefan `Sec` Zehl <sec@42.org> >Date: Thu, 4 May 2023 10:59:49 +0200 >Subject: [PATCH] updated verision > >--- > plocate/Makefile | 34 +++++ > plocate/distinfo | 3 + > plocate/files/315.plocate.in | 32 +++++ > plocate/files/mntent.h | 62 +++++++++ > plocate/files/mntent_compat.c++ | 177 ++++++++++++++++++++++++ > plocate/files/patch-conf.cpp | 11 ++ > plocate/files/patch-io__uring__engine.h | 10 ++ > plocate/files/patch-meson.build | 56 ++++++++ > plocate/files/patch-updatedb.cpp | 11 ++ > plocate/files/updatedb.conf.sample | 1 + > plocate/pkg-descr | 5 + > plocate/pkg-plist | 8 ++ > 12 files changed, 410 insertions(+) > create mode 100644 plocate/Makefile > create mode 100644 plocate/distinfo > create mode 100644 plocate/files/315.plocate.in > create mode 100644 plocate/files/mntent.h > create mode 100644 plocate/files/mntent_compat.c++ > create mode 100644 plocate/files/patch-conf.cpp > create mode 100644 plocate/files/patch-io__uring__engine.h > create mode 100644 plocate/files/patch-meson.build > create mode 100644 plocate/files/patch-updatedb.cpp > create mode 100644 plocate/files/updatedb.conf.sample > create mode 100644 plocate/pkg-descr > create mode 100644 plocate/pkg-plist > >diff --git a/plocate/Makefile b/plocate/Makefile >new file mode 100644 >index 0000000..9eeb58f >--- /dev/null >+++ b/plocate/Makefile >@@ -0,0 +1,34 @@ >+PORTNAME= plocate >+DISTVERSION= 1.1.18 >+CATEGORIES= sysutils >+MASTER_SITES= https://plocate.sesse.net/download/ >+ >+MAINTAINER= sec@42.org >+COMMENT= Fast & privacy-respecting locate utility >+WWW= https://plocate.sesse.net/ >+ >+LICENSE= GPLv2 >+LICENSE_FILE= ${WRKSRC}/COPYING >+ >+BUILD_DEPENDS= meson:devel/meson >+LIB_DEPENDS= libzstd.so:archivers/zstd >+ >+USES= meson >+MESON_ARGS= --sharedstatedir=/var/db >+ >+SUB_FILES= 315.plocate >+ >+GROUPS= plocate >+ >+post-patch: >+ ${CP} ${FILESDIR}/mntent_compat.c++ ${FILESDIR}/mntent.h ${WRKSRC} >+ >+post-install: >+ @${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily >+ ${INSTALL_SCRIPT} ${WRKDIR}/315.plocate \ >+ ${STAGEDIR}${PREFIX}/etc/periodic/daily >+ ${INSTALL_DATA} ${FILESDIR}/updatedb.conf.sample \ >+ ${STAGEDIR}${PREFIX}/etc >+ ${MKDIR} ${STAGEDIR}/var/db/plocate >+ >+.include <bsd.port.mk> >diff --git a/plocate/distinfo b/plocate/distinfo >new file mode 100644 >index 0000000..9e8a1ad >--- /dev/null >+++ b/plocate/distinfo >@@ -0,0 +1,3 @@ >+TIMESTAMP = 1680026625 >+SHA256 (plocate-1.1.18.tar.gz) = 939657050b70719b01ce04fc1c8b64270062a0d53da2c72eafbe036a1964e12c >+SIZE (plocate-1.1.18.tar.gz) = 73906 >diff --git a/plocate/files/315.plocate.in b/plocate/files/315.plocate.in >new file mode 100644 >index 0000000..d02f915 >--- /dev/null >+++ b/plocate/files/315.plocate.in >@@ -0,0 +1,32 @@ >+#!/bin/sh - >+# >+# $FreeBSD$ >+# >+ >+# If there is a global system configuration file, suck it in. >+# >+if [ -r /etc/defaults/periodic.conf ] >+then >+ . /etc/defaults/periodic.conf >+ source_periodic_confs >+fi >+ >+case "$daily_plocate_enable" in >+ [Yy][Ee][Ss]) >+ echo "" >+ echo "Rebuilding plocate database:" >+ >+ SBINDIR=%%PREFIX%%/sbin >+ LOCATEGROUP=plocate >+ DBFILE=/var/db/plocate/plocate.db >+ >+ touch $DBFILE && rc=0 || rc=3 >+ >+ cd / >+ nice -n 5 $SBINDIR/updatedb >+ ;; >+ >+ *) rc=0;; >+esac >+ >+exit $rc >diff --git a/plocate/files/mntent.h b/plocate/files/mntent.h >new file mode 100644 >index 0000000..e61cddd >--- /dev/null >+++ b/plocate/files/mntent.h >@@ -0,0 +1,62 @@ >+/* >+ * mntent >+ * mntent.h - compatability header for FreeBSD >+ * >+ * Copyright (c) 2001 David Rufino <daverufino@btinternet.com> >+ * All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ */ >+ >+#if defined(HAVE_MNTENT_H) >+#include <mntent.h> >+#else >+#ifndef _MNTENT_H >+#define _MNTENT_H >+#include <stdio.h> >+ >+#define MOUNTED "dummy" >+ >+#define MNTTYPE_NFS "nfs" >+ >+struct mntent { >+ char *mnt_fsname; >+ char *mnt_dir; >+ char *mnt_type; >+ char *mnt_opts; >+ int mnt_freq; >+ int mnt_passno; >+}; >+ >+#define setmntent(x,y) ((FILE *)0x1) >+#ifdef __cplusplus >+extern "C" { >+#endif >+struct mntent *getmntent __P ((FILE *fp)); >+char *hasmntopt __P ((const struct mntent *mnt, const char *option)); >+#ifdef __cplusplus >+}; // extern "C" >+#endif >+#define endmntent(x) ((int)1) >+ >+#endif /* _MNTENT_H */ >+#endif /* HAVE_MNTENT_H */ >diff --git a/plocate/files/mntent_compat.c++ b/plocate/files/mntent_compat.c++ >new file mode 100644 >index 0000000..4ca1a55 >--- /dev/null >+++ b/plocate/files/mntent_compat.c++ >@@ -0,0 +1,177 @@ >+/* >+ * Copyright (c) 1980, 1989, 1993, 1994 >+ * The Regents of the University of California. All rights reserved. >+ * Copyright (c) 2001 >+ * David Rufino <daverufino@btinternet.com> >+ * Copyright (c) 2006 >+ * Stanislav Sedov <ssedov@mbsd.msk.ru> >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * 3. All advertising materials mentioning features or use of this software >+ * must display the following acknowledgement: >+ * This product includes software developed by the University of >+ * California, Berkeley and its contributors. >+ * 4. Neither the name of the University nor the names of its contributors >+ * may be used to endorse or promote products derived from this software >+ * without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ */ >+ >+/* most of this was ripped from the mount(3) source */ >+ >+//#include "config.h" >+#include "mntent.h" >+#include <stdlib.h> >+#include <string.h> >+#include <sys/param.h> >+#include <sys/ucred.h> >+#include <sys/mount.h> >+ >+static int pos = -1; >+static int mntsize = -1; >+static struct mntent _mntent; >+ >+struct { >+ int m_flag; >+ const char *m_option; >+} mntoptions[] = { >+ { MNT_ASYNC, "async" }, >+ { MNT_NOATIME, "noatime"}, >+ { MNT_NOEXEC, "noexec"}, >+ { MNT_NOSUID, "nosuid"}, >+ { MNT_NOSYMFOLLOW, "nosymfollow"}, >+ { MNT_SYNCHRONOUS, "sync"}, >+ { MNT_UNION, "union"}, >+ { MNT_NOCLUSTERR, "noclusterr"}, >+ { static_cast<int>(MNT_NOCLUSTERW), "noclusterw"}, >+ { MNT_SUIDDIR, "suiddir"}, >+#ifdef MNT_SNAPSHOT >+ { MNT_SNAPSHOT, "snapshot"}, >+#endif >+#ifdef MNT_MULTILABEL >+ { MNT_MULTILABEL, "multilabel"}, >+#endif >+#ifdef MNT_ACLS >+ { MNT_ACLS, "acls"}, >+#endif >+#ifdef MNT_NODEV >+ { MNT_NODEV, "nodev"}, >+#endif >+}; >+ >+#define N_OPTS (sizeof(mntoptions) / sizeof(*mntoptions)) >+ >+ >+extern "C" { >+ >+char * >+hasmntopt (const struct mntent *mnt, const char *option) >+{ >+ char *opt, *optbuf; >+ >+ optbuf = strdup(mnt->mnt_opts); >+ for (opt = optbuf; (opt = strtok(opt, " ")) != NULL; opt = NULL) { >+ if (!strcasecmp(opt, option)) { >+ opt = opt - optbuf + mnt->mnt_opts; >+ free (optbuf); >+ return (opt); >+ } >+ } >+ free (optbuf); >+ return (NULL); >+} >+ >+static char * >+catopt (char *s0, const char *s1) >+{ >+ size_t newlen; >+ char *cp; >+ >+ if (s1 == NULL || *s1 == '\0') >+ return s0; >+ >+ if (s0 != NULL) { >+ newlen = strlen(s0) + strlen(s1) + 1 + 1; >+ if ((cp = (char *)realloc(s0, newlen)) == NULL) >+ return (NULL); >+ >+ (void)strcat(cp, " "); >+ (void)strcat(cp, s1); >+ } else >+ cp = strdup(s1); >+ >+ return (cp); >+} >+ >+ >+static char * >+flags2opts (int flags) >+{ >+ char *res = NULL; >+ int i; >+ >+ res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw"); >+ >+ for (i = 0; i < N_OPTS; i++) >+ if (flags & mntoptions[i].m_flag) >+ res = catopt(res, mntoptions[i].m_option); >+ return res; >+} >+ >+static struct mntent * >+statfs_to_mntent (struct statfs *mntbuf) >+{ >+ static char opts_buf[40], *tmp; >+ >+ _mntent.mnt_fsname = mntbuf->f_mntfromname; >+ _mntent.mnt_dir = mntbuf->f_mntonname; >+ _mntent.mnt_type = mntbuf->f_fstypename; >+ tmp = flags2opts (mntbuf->f_flags); >+ if (tmp) { >+ opts_buf[sizeof(opts_buf) - 1] = '\0'; >+ strncpy (opts_buf, tmp, sizeof(opts_buf)-1); >+ free (tmp); >+ } else { >+ *opts_buf = '\0'; >+ } >+ _mntent.mnt_opts = opts_buf; >+ _mntent.mnt_freq = _mntent.mnt_passno = 0; >+ return (&_mntent); >+} >+ >+struct mntent * >+getmntent (FILE *fp) >+{ >+ static struct statfs *mntbuf; >+ >+ if (pos == -1 || mntsize == -1) >+ mntsize = getmntinfo (&mntbuf, MNT_NOWAIT); >+ >+ ++pos; >+ if (pos == mntsize) { >+ pos = mntsize = -1; >+ return (NULL); >+ } >+ >+ return (statfs_to_mntent (&mntbuf[pos])); >+} >+ >+}; // extern "C" >diff --git a/plocate/files/patch-conf.cpp b/plocate/files/patch-conf.cpp >new file mode 100644 >index 0000000..019bf4b >--- /dev/null >+++ b/plocate/files/patch-conf.cpp >@@ -0,0 +1,11 @@ >+--- conf.cpp.orig 2023-05-04 07:34:30 UTC >++++ conf.cpp >+@@ -35,6 +35,8 @@ any later version. >+ #include <string.h> >+ #include <unistd.h> >+ >++#define program_invocation_name getprogname() >++ >+ using namespace std; >+ >+ /* true if locate(1) should check whether files are visible before reporting >diff --git a/plocate/files/patch-io__uring__engine.h b/plocate/files/patch-io__uring__engine.h >new file mode 100644 >index 0000000..6ae7512 >--- /dev/null >+++ b/plocate/files/patch-io__uring__engine.h >@@ -0,0 +1,10 @@ >+--- io_uring_engine.h.orig 2023-05-04 07:33:59 UTC >++++ io_uring_engine.h >+@@ -7,7 +7,6 @@ >+ #include <string_view> >+ #include <sys/socket.h> >+ #include <sys/types.h> >+-#include <linux/stat.h> >+ >+ struct io_uring_sqe; >+ #ifndef WITHOUT_URING >diff --git a/plocate/files/patch-meson.build b/plocate/files/patch-meson.build >new file mode 100644 >index 0000000..091386c >--- /dev/null >+++ b/plocate/files/patch-meson.build >@@ -0,0 +1,56 @@ >+--- meson.build.orig 2023-05-04 07:34:20 UTC >++++ meson.build >+@@ -1,7 +1,7 @@ >+ project('plocate', 'cpp', default_options: ['buildtype=debugoptimized','cpp_std=c++17'], version: '1.1.18') >+ >+ add_project_arguments('-DGROUPNAME="' + get_option('locategroup') + '"', language: 'cpp') >+-add_project_arguments('-DUPDATEDB_CONF="/etc/updatedb.conf"', language: 'cpp') >++add_project_arguments('-DUPDATEDB_CONF= "' + get_option('prefix') + '/etc/updatedb.conf"', language: 'cpp') >+ dbfile = join_paths(get_option('sharedstatedir'), get_option('dbpath')) >+ add_project_arguments('-DDBFILE="' + dbfile + '"', language: 'cpp') >+ add_project_arguments('-DPACKAGE_NAME="plocate"', language: 'cpp') >+@@ -30,16 +30,12 @@ if cxx.compiles(code, name: 'function multiversioning' >+ add_project_arguments('-DHAS_FUNCTION_MULTIVERSIONING', language: 'cpp') >+ endif >+ >+-executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'parse_trigrams.cpp', 'serializer.cpp', 'access_rx_cache.cpp', 'needle.cpp', 'complete_pread.cpp'], >++executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'parse_trigrams.cpp', 'serializer.cpp', 'access_rx_cache.cpp', 'needle.cpp', 'complete_pread.cpp', 'mntent_compat.c++'], >+ dependencies: [uringdep, zstddep, threaddep, atomicdep], >+ install: true, >+ install_mode: ['rwxr-sr-x', 'root', get_option('locategroup')]) >+-executable('plocate-build', ['plocate-build.cpp', 'database-builder.cpp'], >+- dependencies: [zstddep], >+- install: true, >+- install_dir: get_option('sbindir')) >+ updatedb_progname = get_option('updatedb_progname') >+-executable(updatedb_progname, ['updatedb.cpp', 'database-builder.cpp', 'conf.cpp', 'lib.cpp', 'bind-mount.cpp', 'complete_pread.cpp'], >++executable(updatedb_progname, ['updatedb.cpp', 'database-builder.cpp', 'conf.cpp', 'lib.cpp', 'bind-mount.cpp', 'complete_pread.cpp', 'mntent_compat.c++'], >+ dependencies: [zstddep, threaddep], >+ install: true, >+ install_dir: get_option('sbindir')) >+@@ -49,7 +45,7 @@ conf_data.set('PROCESSED_BY_MESON', '1') >+ conf_data.set('sbindir', join_paths(get_option('prefix'), get_option('sbindir'))) >+ conf_data.set('groupname', get_option('locategroup')) >+ conf_data.set('dbfile', dbfile) >+-conf_data.set('updatedb_conf', '/etc/updatedb.conf') >++conf_data.set('updatedb_conf',get_option('prefix')+'/etc/updatedb.conf') >+ conf_data.set('updatedb_progname', updatedb_progname) >+ update_script = configure_file(input: 'update-plocate.sh', >+ output: 'update-plocate.sh', >+@@ -64,7 +60,6 @@ if get_option('install_cron') >+ rename: 'plocate') >+ endif >+ install_man('plocate.1') >+-install_man('plocate-build.8') >+ >+ updatedb_man = configure_file(input: 'updatedb.8.in', >+ output: updatedb_progname + '.8', >+@@ -102,7 +97,7 @@ if run_command('[', '-r', pfordir + '/libic.a', ']', c >+ turbopfordep = declare_dependency( >+ include_directories: include_directories('TurboPFor-Integer-Compression'), >+ dependencies: meson.get_compiler('cpp').find_library('ic', dirs: pfordir)) >+- executable('bench', ['bench.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'complete_pread.cpp'], >++ executable('bench', ['bench.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'complete_pread.cpp', 'mntent_compat.c++'], >+ dependencies: [uringdep, turbopfordep], >+ build_by_default: false, >+ install: false) >diff --git a/plocate/files/patch-updatedb.cpp b/plocate/files/patch-updatedb.cpp >new file mode 100644 >index 0000000..65f5b46 >--- /dev/null >+++ b/plocate/files/patch-updatedb.cpp >@@ -0,0 +1,11 @@ >+--- updatedb.cpp.orig 2023-05-04 07:34:10 UTC >++++ updatedb.cpp >+@@ -44,7 +44,7 @@ any later version. >+ #include <memory> >+ #include <mntent.h> >+ #include <random> >+-#include <stdint.h> >++#include <cinttypes> >+ #include <stdio.h> >+ #include <stdlib.h> >+ #include <string.h> >diff --git a/plocate/files/updatedb.conf.sample b/plocate/files/updatedb.conf.sample >new file mode 100644 >index 0000000..9bbf446 >--- /dev/null >+++ b/plocate/files/updatedb.conf.sample >@@ -0,0 +1 @@ >+PRUNEFS = "devfs fdescfs nullfs procfs linsysfs" >diff --git a/plocate/pkg-descr b/plocate/pkg-descr >new file mode 100644 >index 0000000..04e074d >--- /dev/null >+++ b/plocate/pkg-descr >@@ -0,0 +1,5 @@ >+plocate is a locate(1) based on posting lists, completely replacing mlocate >+with a much faster (and smaller) index. It is suitable as a default locate on >+your system. 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/plocate/pkg-plist b/plocate/pkg-plist >new file mode 100644 >index 0000000..f7d18b4 >--- /dev/null >+++ b/plocate/pkg-plist >@@ -0,0 +1,8 @@ >+@(,plocate,2755) bin/plocate >+sbin/updatedb >+man/man1/plocate.1.gz >+man/man8/updatedb.8.gz >+man/man5/updatedb.conf.5.gz >+etc/periodic/daily/315.plocate >+@sample etc/updatedb.conf.sample >+@dir /var/db/plocate >-- >2.40.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
sec:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 270657
:
241313
|
241965
|
242160
|
242198