git: c2848657ef8d - main - sysutils/fsearch: update the port to the latest patch release 0.1.2
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Feb 2022 15:06:11 UTC
The branch main has been updated by danfe:
URL: https://cgit.FreeBSD.org/ports/commit/?id=c2848657ef8df23f3a5d515b589c2b33558b2ede
commit c2848657ef8df23f3a5d515b589c2b33558b2ede
Author: Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-02-15 15:04:26 +0000
Commit: Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-02-15 15:04:26 +0000
sysutils/fsearch: update the port to the latest patch release 0.1.2
Switch away from using g_utf8_collate_key_for_filename() for version
sorting because it's way too slow. For comparison, sorting 3 million
files by name takes less than a second (~850ms) with strverscmp() but
more than a minute (~95s) with g_utf8_collate_key_for_filename().
So it's roughly a hundred times slower. Instead, pull strverscmp()
implementation directly from the GNU library sources.
---
sysutils/fsearch/Makefile | 9 ++-
sysutils/fsearch/distinfo | 10 ++-
.../files/patch-src_fsearch__string__utils.c | 94 ++++++++++++++++++++++
sysutils/fsearch/files/patch-src_string__utils.c | 30 -------
sysutils/fsearch/files/patch-src_string__utils.h | 10 ---
sysutils/fsearch/pkg-plist | 11 +++
6 files changed, 119 insertions(+), 45 deletions(-)
diff --git a/sysutils/fsearch/Makefile b/sysutils/fsearch/Makefile
index 7c21fa22efea..1e335dcc54fb 100644
--- a/sysutils/fsearch/Makefile
+++ b/sysutils/fsearch/Makefile
@@ -1,10 +1,12 @@
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
PORTNAME= fsearch
-DISTVERSION= 0.1beta4
-DISTVERSIONPREFIX= v
+PORTVERSION= 0.1.2
CATEGORIES= sysutils
+PATCH_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
+PATCHFILES= 7f602118e0de9f524e71.diff:-p1 f0ee01b40156ddb36651.diff:-p1
+
MAINTAINER= danfe@FreeBSD.org
COMMENT= Fast file search utility for Unix-like systems
@@ -24,5 +26,8 @@ USE_GNOME= cairo gdkpixbuf2 gtk30 intltool
post-patch:
@${REINPLACE_CMD} -e 's,v=UNKNOWN,v=${DISTVERSION},' \
${WRKSRC}/build-aux/git-version-gen
+ @${PRINTF} '\n%s\n%s;\n' int \
+ 'strverscmp(const char *, const char *)' \
+ >> ${WRKSRC}/src/fsearch_string_utils.h
.include <bsd.port.mk>
diff --git a/sysutils/fsearch/distinfo b/sysutils/fsearch/distinfo
index 7f23b98d211d..e468d1fcf2f6 100644
--- a/sysutils/fsearch/distinfo
+++ b/sysutils/fsearch/distinfo
@@ -1,3 +1,7 @@
-TIMESTAMP = 1582545022
-SHA256 (cboxdoerfer-fsearch-v0.1beta4_GH0.tar.gz) = a8664990194e476f7349c68e7c74c3eb56b5091fd6ef4a9f6581c3e408900464
-SIZE (cboxdoerfer-fsearch-v0.1beta4_GH0.tar.gz) = 160390
+TIMESTAMP = 1643482609
+SHA256 (cboxdoerfer-fsearch-0.1.2_GH0.tar.gz) = f80e10922812169e8437476d5fbe6d05249997c49b98f991d382a6d5566551b4
+SIZE (cboxdoerfer-fsearch-0.1.2_GH0.tar.gz) = 504787
+SHA256 (7f602118e0de9f524e71.diff) = cd24cf0cc3f07c3135d0cdb6981784b8bb254c12f8d0d7aabfe068417c17b36b
+SIZE (7f602118e0de9f524e71.diff) = 693
+SHA256 (f0ee01b40156ddb36651.diff) = 75f01513f0c88e61715097495b22f920c5131b2c03956d54d5b94e53e7ec5a7a
+SIZE (f0ee01b40156ddb36651.diff) = 1741
diff --git a/sysutils/fsearch/files/patch-src_fsearch__string__utils.c b/sysutils/fsearch/files/patch-src_fsearch__string__utils.c
new file mode 100644
index 000000000000..d57fb73a7f75
--- /dev/null
+++ b/sysutils/fsearch/files/patch-src_fsearch__string__utils.c
@@ -0,0 +1,94 @@
+--- src/fsearch_string_utils.c.orig 2022-01-29 18:56:49 UTC
++++ src/fsearch_string_utils.c
+@@ -214,3 +214,91 @@ fs_str_split(const char *src) {
+
+ return (char **)g_ptr_array_free(new, FALSE);
+ }
++
++/* Compare strings while treating digits characters numerically.
++ Copyright (C) 1997-2022 Free Software Foundation, Inc.
++ Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>,
++ 1997. */
++
++#include <stdint.h>
++
++/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
++ fractional parts, S_Z: idem but with leading Zeroes only */
++#define S_N 0x0
++#define S_I 0x3
++#define S_F 0x6
++#define S_Z 0x9
++
++/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
++#define CMP 2
++#define LEN 3
++
++/* Compare S1 and S2 as strings holding indices/version numbers,
++ returning less than, equal to or greater than zero if S1 is less than,
++ equal to, or greater than S2. */
++
++int
++strverscmp (const char *s1, const char *s2)
++{
++ const unsigned char *p1 = (const unsigned char *) s1;
++ const unsigned char *p2 = (const unsigned char *) s2;
++
++ /* Symbol(s) 0 [1-9] others
++ Transition (10) 0 (01) d (00) x */
++ static const uint_least8_t next_state[] =
++ {
++ /* state x d 0 */
++ /* S_N */ S_N, S_I, S_Z,
++ /* S_I */ S_N, S_I, S_I,
++ /* S_F */ S_N, S_F, S_F,
++ /* S_Z */ S_N, S_F, S_Z
++ };
++
++ static const int_least8_t result_type[] =
++ {
++ /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */
++
++ /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP,
++ /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN,
++ /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
++ /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP
++ };
++
++ if (p1 == p2)
++ return 0;
++
++ unsigned char c1 = *p1++;
++ unsigned char c2 = *p2++;
++ /* Hint: '0' is a digit too. */
++ int state = S_N + ((c1 == '0') + (isdigit (c1) != 0));
++
++ int diff;
++ while ((diff = c1 - c2) == 0)
++ {
++ if (c1 == '\0')
++ return diff;
++
++ state = next_state[state];
++ c1 = *p1++;
++ c2 = *p2++;
++ state += (c1 == '0') + (isdigit (c1) != 0);
++ }
++
++ state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))];
++
++ switch (state)
++ {
++ case CMP:
++ return diff;
++
++ case LEN:
++ while (isdigit (*p1++))
++ if (!isdigit (*p2++))
++ return 1;
++
++ return isdigit (*p2) ? -1 : diff;
++
++ default:
++ return state;
++ }
++}
diff --git a/sysutils/fsearch/files/patch-src_string__utils.c b/sysutils/fsearch/files/patch-src_string__utils.c
deleted file mode 100644
index b41d4e1e32ea..000000000000
--- a/sysutils/fsearch/files/patch-src_string__utils.c
+++ /dev/null
@@ -1,30 +0,0 @@
---- src/string_utils.c.orig 2020-02-24 11:50:22 UTC
-+++ src/string_utils.c
-@@ -16,6 +16,7 @@
- along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-+#include <glib.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <assert.h>
-@@ -62,3 +63,19 @@ fs_str_copy (char *dest, char *end, const char *src)
- return ptr;
- }
-
-+int
-+strverscmp (const char *s1,
-+ const char *s2)
-+{
-+ gchar *tmp1, *tmp2;
-+ gint ret;
-+
-+ tmp1 = g_utf8_collate_key_for_filename(s1, -1);
-+ tmp2 = g_utf8_collate_key_for_filename(s2, -1);
-+
-+ ret = strcmp(tmp1, tmp2);
-+
-+ g_free(tmp1);
-+ g_free(tmp2);
-+ return ret;
-+}
diff --git a/sysutils/fsearch/files/patch-src_string__utils.h b/sysutils/fsearch/files/patch-src_string__utils.h
deleted file mode 100644
index e8f329e07e9c..000000000000
--- a/sysutils/fsearch/files/patch-src_string__utils.h
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/string_utils.h.orig 2020-02-24 11:50:22 UTC
-+++ src/string_utils.h
-@@ -30,3 +30,7 @@ char *
- fs_str_copy (char *dest,
- char *end,
- const char *src);
-+
-+int
-+strverscmp (const char *s1,
-+ const char *s2);
diff --git a/sysutils/fsearch/pkg-plist b/sysutils/fsearch/pkg-plist
index 371098a772d1..7ab0d448348f 100644
--- a/sysutils/fsearch/pkg-plist
+++ b/sysutils/fsearch/pkg-plist
@@ -1,15 +1,23 @@
bin/fsearch
+man/man1/fsearch.1.gz
share/applications/fsearch.desktop
+share/icons/hicolor/scalable/apps/io.github.cboxdoerfer.FSearch.svg
+share/locale/ar/LC_MESSAGES/fsearch.mo
+share/locale/ber/LC_MESSAGES/fsearch.mo
share/locale/bg/LC_MESSAGES/fsearch.mo
share/locale/ca/LC_MESSAGES/fsearch.mo
share/locale/de/LC_MESSAGES/fsearch.mo
share/locale/el/LC_MESSAGES/fsearch.mo
+share/locale/en_GB/LC_MESSAGES/fsearch.mo
share/locale/es/LC_MESSAGES/fsearch.mo
share/locale/fi/LC_MESSAGES/fsearch.mo
share/locale/fr/LC_MESSAGES/fsearch.mo
share/locale/gl/LC_MESSAGES/fsearch.mo
+share/locale/he/LC_MESSAGES/fsearch.mo
share/locale/hu/LC_MESSAGES/fsearch.mo
share/locale/id/LC_MESSAGES/fsearch.mo
+share/locale/ie/LC_MESSAGES/fsearch.mo
+share/locale/it/LC_MESSAGES/fsearch.mo
share/locale/ja/LC_MESSAGES/fsearch.mo
share/locale/ko/LC_MESSAGES/fsearch.mo
share/locale/lt/LC_MESSAGES/fsearch.mo
@@ -20,6 +28,9 @@ share/locale/pt/LC_MESSAGES/fsearch.mo
share/locale/pt_BR/LC_MESSAGES/fsearch.mo
share/locale/ru/LC_MESSAGES/fsearch.mo
share/locale/sk/LC_MESSAGES/fsearch.mo
+share/locale/sv/LC_MESSAGES/fsearch.mo
+share/locale/te/LC_MESSAGES/fsearch.mo
share/locale/tr/LC_MESSAGES/fsearch.mo
+share/locale/tzm/LC_MESSAGES/fsearch.mo
share/locale/uk/LC_MESSAGES/fsearch.mo
share/locale/zh_CN/LC_MESSAGES/fsearch.mo