diff --git a/srcpkgs/fsearch/INSTALL.msg b/srcpkgs/fsearch/INSTALL.msg new file mode 100644 index 00000000000000..7567c97d61eb81 --- /dev/null +++ b/srcpkgs/fsearch/INSTALL.msg @@ -0,0 +1,61 @@ +NOTICE: fsearch 0.3.x configuration format changed. + +The old configuration (0.2.x) used fsearch.conf in INI format. +This format is no longer valid. fsearch does NOT +automatically migrate your settings. +You must migrate your settings to the new JSON format BEFORE +launching the new version. + +Before launching the new version: + + 1. Backup your old config (recommended) + mv ~/.config/fsearch/fsearch.conf \ + ~/.config/fsearch/fsearch.conf.bak 2>/dev/null + + 2. Remove legacy database index + rm -f ~/.local/share/fsearch/fsearch.db + + 3. Migrate your settings to the new JSON format. + See the mapping below for common settings. + +Configuration migration (0.2.x -> 0.3.x): + +Old format (fsearch.conf - INI): + + [Database] + folders=/home/void;/media/storage; + exclude_paths=/home/void/.cache;/tmp; + exclude_patterns=*.tmp;*.bak; + + [Interface] + dark_theme=true + show_hidden_files=false + +New format (fsearch.conf - JSON): + + { + "database": { + "indexed_locations": [ + "/home/void", + "/media/storage" + ], + "excluded_locations": [ + "/home/void/.cache", + "/tmp" + ], + "excluded_wildcards": [ + "*.tmp", + "*.bak" + ] + }, + "ui": { + "show_hidden_files": false + } + } + +Once the new configuration is in place: + + 1. Open FSearch. + 2. Go to Database -> Update Database (or press Ctrl+R). + 3. Ensure mounted partitions or secondary drives are listed + under Preferences -> Database -> Included Locations. diff --git a/srcpkgs/fsearch/patches/fsearch-cross-compile.patch b/srcpkgs/fsearch/patches/fsearch-cross-compile.patch new file mode 100644 index 00000000000000..7adf5087cb1d27 --- /dev/null +++ b/srcpkgs/fsearch/patches/fsearch-cross-compile.patch @@ -0,0 +1,54 @@ +--- a/meson.build ++++ b/meson.build +@@ -16,7 +16,7 @@ + cc = meson.get_compiler('c') + + # Check if the build platform supports using malloc_trim +-malloc_trim_support_result = cc.run( ++if cc.compiles( + ''' + #include + +@@ -27,15 +27,13 @@ + ''', + name : 'malloc_trim is supported on the build platform', + ) +- +-if malloc_trim_support_result.compiled() and malloc_trim_support_result.returncode() == 0 + have_malloc_trim = true + else + have_malloc_trim = false + endif + + # Check if the build platform supports using fanotify without the CAP_SYS_ADMIN capability +-fanotify_support_result = cc.run( ++if cc.compiles( + ''' + #include + #include +@@ -47,15 +45,13 @@ + ''', + name : 'fanotify is supported by the build platform and works without CAP_SYS_ADMIN capabilities', + ) +- +-if fanotify_support_result.compiled() and fanotify_support_result.returncode() == 0 + have_fanotify = true + else + have_fanotify = false + endif + + # Check if the build platform supports inotify +-inotify_support_result = cc.run( ++if cc.compiles( + ''' + #include + #include +@@ -67,8 +63,6 @@ + ''', + name : 'inotify is supported by the build platform', + ) +- +-if inotify_support_result.compiled() and inotify_support_result.returncode() == 0 + have_inotify = true + else + have_inotify = false diff --git a/srcpkgs/fsearch/patches/fsearch-fanotify-musl.patch b/srcpkgs/fsearch/patches/fsearch-fanotify-musl.patch new file mode 100644 index 00000000000000..37fe7847af12e6 --- /dev/null +++ b/srcpkgs/fsearch/patches/fsearch-fanotify-musl.patch @@ -0,0 +1,10 @@ +--- a/src/fsearch_folder_monitor_fanotify.c ++++ b/src/fsearch_folder_monitor_fanotify.c +@@ -8,7 +8,6 @@ + #include + #include + #include +-#include + #include + #include + #include diff --git a/srcpkgs/fsearch/patches/fsearch-off64-musl.patch b/srcpkgs/fsearch/patches/fsearch-off64-musl.patch new file mode 100644 index 00000000000000..edd921f6c4dfa6 --- /dev/null +++ b/srcpkgs/fsearch/patches/fsearch-off64-musl.patch @@ -0,0 +1,20 @@ +--- a/src/fsearch_database_file.c ++++ b/src/fsearch_database_file.c +@@ -1073,7 +1073,7 @@ + // now that we know the size of the file/folder block we've written, store it in the file header + // Make also sure to set the cursor checksum again, so folder and file block size are hashed as well + cursor.checksum = checksum; +- if (fseeko(fp, (off64_t)folder_block_size_offset, SEEK_SET) != 0) { ++ if (fseeko(fp, (off_t)folder_block_size_offset, SEEK_SET) != 0) { + goto save_fail; + } + g_debug("[db_save] updating file and folder block size: %" PRIu64 ", %" PRIu64, folder_block_size, file_block_size); +@@ -1081,7 +1081,7 @@ + cursor_write(&cursor, &file_block_size, sizeof(file_block_size)); + + // after writing the folder and file block size, we can +- if (fseeko(fp, (off64_t)checksum_offset, SEEK_SET) != 0) { ++ if (fseeko(fp, (off_t)checksum_offset, SEEK_SET) != 0) { + goto save_fail; + } + gsize checksum_buffer_len = DATABASE_CHECKSUM_SIZE; diff --git a/srcpkgs/fsearch/patches/fsearch-off64.patch b/srcpkgs/fsearch/patches/fsearch-off64.patch new file mode 100644 index 00000000000000..1aa715a5624151 --- /dev/null +++ b/srcpkgs/fsearch/patches/fsearch-off64.patch @@ -0,0 +1,20 @@ +--- a/src/fsearch_database_file.c ++++ b/src/fsearch_database_file.c +@@ -1073,7 +1073,7 @@ + // now that we know the size of the file/folder block we've written, store it in the file header + // Make also sure to set the cursor checksum again, so folder and file block size are hashed as well + cursor.checksum = checksum; +- if (fseeko(fp, (off64_t)folder_block_size_offset, SEEK_SET) != 0) { ++ if (fseeko64(fp, (off64_t)folder_block_size_offset, SEEK_SET) != 0) { + goto save_fail; + } + g_debug("[db_save] updating file and folder block size: %" PRIu64 ", %" PRIu64, folder_block_size, file_block_size); +@@ -1081,7 +1081,7 @@ + cursor_write(&cursor, &file_block_size, sizeof(file_block_size)); + + // after writing the folder and file block size, we can +- if (fseeko(fp, (off64_t)checksum_offset, SEEK_SET) != 0) { ++ if (fseeko64(fp, (off64_t)checksum_offset, SEEK_SET) != 0) { + goto save_fail; + } + gsize checksum_buffer_len = DATABASE_CHECKSUM_SIZE; diff --git a/srcpkgs/fsearch/patches/fsearch-time64.patch b/srcpkgs/fsearch/patches/fsearch-time64.patch new file mode 100644 index 00000000000000..ba83a264a25db8 --- /dev/null +++ b/srcpkgs/fsearch/patches/fsearch-time64.patch @@ -0,0 +1,218 @@ +diff --git fsearch-0.3.1/src/fsearch_database_entry.c fsearch-0.3.1-patched/src/fsearch_database_entry.c +index 882f8da..a42553f 100644 +--- fsearch-0.3.1/src/fsearch_database_entry.c ++++ fsearch-0.3.1-patched/src/fsearch_database_entry.c +@@ -171,9 +171,9 @@ db_entry_append_full_path(FsearchDatabaseEntry *entry, GString *str) { + g_string_append(str, name[0] == '\0' ? G_DIR_SEPARATOR_S : name); + } + +-time_t ++int64_t + db_entry_get_mtime(FsearchDatabaseEntry *entry) { +- time_t mtime = 0; ++ int64_t mtime = 0; + db_entry_get_attribute(entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, &mtime, sizeof(mtime)); + return mtime; + } +@@ -433,8 +433,8 @@ db_entry_compare_entries_by_chain(FsearchDatabaseEntry **a, FsearchDatabaseEntry + + int + db_entry_compare_entries_by_modification_time(FsearchDatabaseEntry **a, FsearchDatabaseEntry **b) { +- const time_t time_a = db_entry_get_mtime(*a); +- const time_t time_b = db_entry_get_mtime(*b); ++ const int64_t time_a = db_entry_get_mtime(*a); ++ const int64_t time_b = db_entry_get_mtime(*b); + if (time_a > time_b) { + return 1; + } +@@ -599,7 +599,7 @@ db_entry_compare_entries_by_name(FsearchDatabaseEntry **a, FsearchDatabaseEntry + } + + void +-db_entry_set_mtime(FsearchDatabaseEntry *entry, time_t mtime) { ++db_entry_set_mtime(FsearchDatabaseEntry *entry, int64_t mtime) { + db_entry_set_attribute(entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, &mtime, sizeof(mtime)); + } + +diff --git fsearch-0.3.1/src/fsearch_database_entry.h fsearch-0.3.1-patched/src/fsearch_database_entry.h +index d2159aa..b47de51 100644 +--- fsearch-0.3.1/src/fsearch_database_entry.h ++++ fsearch-0.3.1-patched/src/fsearch_database_entry.h +@@ -53,7 +53,7 @@ uint32_t + db_entry_folder_get_num_folders(FsearchDatabaseEntry *entry); + + void +-db_entry_set_mtime(FsearchDatabaseEntry *entry, time_t mtime); ++db_entry_set_mtime(FsearchDatabaseEntry *entry, int64_t mtime); + + void + db_entry_set_size(FsearchDatabaseEntry *entry, off_t size); +@@ -103,7 +103,7 @@ db_entry_append_path(FsearchDatabaseEntry *entry, GString *str); + void + db_entry_append_full_path(FsearchDatabaseEntry *entry, GString *str); + +-time_t ++int64_t + db_entry_get_mtime(FsearchDatabaseEntry *entry); + + off_t +diff --git fsearch-0.3.1/src/fsearch_database_entry_info.c fsearch-0.3.1-patched/src/fsearch_database_entry_info.c +index 3e799f0..37dd1e2 100644 +--- fsearch-0.3.1/src/fsearch_database_entry_info.c ++++ fsearch-0.3.1-patched/src/fsearch_database_entry_info.c +@@ -37,7 +37,7 @@ typedef struct { + GHashTable *highlights; + GString *str; + off_t size; +- time_t time; ++ int64_t time; + uint32_t uint; + bool selected; + }; +@@ -286,7 +286,7 @@ fsearch_database_entry_info_get_path_full(FsearchDatabaseEntryInfo *info) { + return val->str; + } + +-time_t ++int64_t + fsearch_database_entry_info_get_mtime(FsearchDatabaseEntryInfo *info) { + g_return_val_if_fail(info, 0); + g_return_val_if_fail(info->flags & FSEARCH_DATABASE_ENTRY_INFO_FLAG_MODIFICATION_TIME, 0); +diff --git fsearch-0.3.1/src/fsearch_database_entry_info.h fsearch-0.3.1-patched/src/fsearch_database_entry_info.h +index f998253..aed8d16 100644 +--- fsearch-0.3.1/src/fsearch_database_entry_info.h ++++ fsearch-0.3.1-patched/src/fsearch_database_entry_info.h +@@ -61,7 +61,7 @@ fsearch_database_entry_info_get_extension(FsearchDatabaseEntryInfo *info); + GString * + fsearch_database_entry_info_get_path_full(FsearchDatabaseEntryInfo *info); + +-time_t ++int64_t + fsearch_database_entry_info_get_mtime(FsearchDatabaseEntryInfo *info); + + off_t +diff --git fsearch-0.3.1/src/fsearch_database_file.c fsearch-0.3.1-patched/src/fsearch_database_file.c +index 337fe99..be7472d 100644 +--- fsearch-0.3.1/src/fsearch_database_file.c ++++ fsearch-0.3.1-patched/src/fsearch_database_file.c +@@ -207,7 +207,7 @@ database_file_load_entry(DatabaseFileReadCursor *cursor, + int64_t mtime = 0; + cursor_read(cursor, &mtime, sizeof(mtime)); + +- db_entry_set_mtime(*entry_out, (time_t)mtime); ++ db_entry_set_mtime(*entry_out, (int64_t)mtime); + } + } + +diff --git fsearch-0.3.1/src/fsearch_database_index.c fsearch-0.3.1-patched/src/fsearch_database_index.c +index 7cf5306..2405382 100644 +--- fsearch-0.3.1/src/fsearch_database_index.c ++++ fsearch-0.3.1-patched/src/fsearch_database_index.c +@@ -577,7 +577,7 @@ process_create_event(FsearchDatabaseIndex *self, FsearchFolderMonitorEvent *even + DATABASE_INDEX_PROPERTY_SIZE, + size, + DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, +- mtime, ++ (int64_t)mtime, + DATABASE_INDEX_PROPERTY_NONE); + fsearch_database_chunked_array_insert(self->file_chunks, entry); + +@@ -642,14 +642,14 @@ process_attrib_event(FsearchDatabaseIndex *self, FsearchFolderMonitorEvent *even + } + + const off_t old_size = db_entry_get_size(entry); +- const time_t old_mtime = db_entry_get_mtime(entry); ++ const int64_t old_mtime = db_entry_get_mtime(entry); + +- if (old_size == size && old_mtime == mtime) { ++ if (old_size == size && old_mtime == (int64_t)mtime) { + return; + } + + FsearchDatabaseIndexPropertyFlags affected_sort_orders = DATABASE_INDEX_PROPERTY_FLAG_NONE; +- if (old_mtime != mtime) { ++ if (old_mtime != (int64_t)mtime) { + affected_sort_orders |= DATABASE_INDEX_PROPERTY_FLAG_MODIFICATION_TIME; + } + +@@ -674,7 +674,7 @@ process_attrib_event(FsearchDatabaseIndex *self, FsearchFolderMonitorEvent *even + } + + propagate_event(self, FSEARCH_DATABASE_INDEX_EVENT_ENTRY_DELETED, folders, files, affected_sort_orders, false); +- db_entry_set_mtime(entry, mtime); ++ db_entry_set_mtime(entry, (int64_t)mtime); + db_entry_set_size(entry, size); + propagate_event(self, FSEARCH_DATABASE_INDEX_EVENT_ENTRY_CREATED, folders, files, affected_sort_orders, false); + num_attrib_changes++; +diff --git fsearch-0.3.1/src/fsearch_database_scan.c fsearch-0.3.1-patched/src/fsearch_database_scan.c +index 5f1628e..33cd199 100644 +--- fsearch-0.3.1/src/fsearch_database_scan.c ++++ fsearch-0.3.1-patched/src/fsearch_database_scan.c +@@ -75,7 +75,7 @@ add_folder(DatabaseWalkContext *walk_context, const char *name, const char *path + parent, + DATABASE_ENTRY_TYPE_FOLDER, + DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, +- mtime, ++ (int64_t)mtime, + DATABASE_INDEX_PROPERTY_NONE); + if (!folder_entry) { + return NULL; +@@ -84,9 +84,9 @@ add_folder(DatabaseWalkContext *walk_context, const char *name, const char *path + if (db_entry_get_attribute_name(folder_entry, &n)) { + g_assert_cmpstr(name, ==, n); + } +- time_t t = 0; +- if (db_entry_get_attribute(folder_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(time_t))) { +- g_assert(t == mtime); ++ int64_t t = 0; ++ if (db_entry_get_attribute(folder_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(t))) { ++ g_assert(t == (int64_t)mtime); + } + watch_folder(walk_context, folder_entry, path); + darray_add_item(walk_context->folders, folder_entry); +@@ -103,7 +103,7 @@ add_file(DatabaseWalkContext *walk_context, const char *name, off_t size, time_t + DATABASE_INDEX_PROPERTY_SIZE, + size, + DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, +- mtime, ++ (int64_t)mtime, + DATABASE_INDEX_PROPERTY_NONE); + if (!file_entry) { + return NULL; +@@ -116,8 +116,8 @@ add_file(DatabaseWalkContext *walk_context, const char *name, off_t size, time_t + if (db_entry_get_attribute(file_entry, DATABASE_INDEX_PROPERTY_SIZE, (void *)&s, sizeof(off_t))) { + g_assert(s == size); + } +- time_t t = 0; +- if (db_entry_get_attribute(file_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(time_t))) { ++ int64_t t = 0; ++ if (db_entry_get_attribute(file_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(t))) { + g_assert(t == mtime); + } + darray_add_item(walk_context->files, file_entry); +diff --git fsearch-0.3.1/src/fsearch_query_matchers.c fsearch-0.3.1-patched/src/fsearch_query_matchers.c +index 3415786..7371c15 100644 +--- fsearch-0.3.1/src/fsearch_query_matchers.c ++++ fsearch-0.3.1-patched/src/fsearch_query_matchers.c +@@ -65,7 +65,7 @@ uint32_t + fsearch_query_matcher_date_modified(FsearchQueryNode *node, FsearchQueryMatchData *match_data) { + FsearchDatabaseEntry *entry = fsearch_query_match_data_get_entry(match_data); + if (entry) { +- const time_t time = db_entry_get_mtime(entry); ++ int64_t time = db_entry_get_mtime(entry); + return cmp_num(time, node); + } + return 0; +diff --git fsearch-0.3.1/src/tests/test_database_file.c fsearch-0.3.1-patched/src/tests/test_database_file.c +index ba49cf6..c608783 100644 +--- fsearch-0.3.1/src/tests/test_database_file.c ++++ fsearch-0.3.1-patched/src/tests/test_database_file.c +@@ -87,7 +87,7 @@ test_save_load_roundtrip_preserves_hierarchy_and_sort_orders(void) { + FsearchDatabaseEntry *files_before_save[3]; + FsearchDatabaseEntry *file_parents_before_save[3]; + off_t file_sizes_before_save[3]; +- time_t file_mtimes_before_save[3]; ++ int64_t file_mtimes_before_save[3]; + for (uint32_t i = 0; i < 3; i++) { + files_before_save[i] = fsearch_database_chunked_array_get_entry(name_sorted_files_before_save, i); + file_parents_before_save[i] = db_entry_get_parent(files_before_save[i]); diff --git a/srcpkgs/fsearch/patches/query.patch b/srcpkgs/fsearch/patches/query.patch deleted file mode 100644 index d8b63aacd51f60..00000000000000 --- a/srcpkgs/fsearch/patches/query.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/src/fsearch_time_utils.c -+++ b/src/fsearch_time_utils.c -@@ -377,7 +377,7 @@ parse_implicit_date_time_constants(const - } - - static bool --parse_date_time_constants(const char *str, time_t *time_start_out, time_t *time_end_out) { -+parse_date_time_constants(const char *str, int64_t *time_start_out, int64_t *time_end_out) { - struct tm tm_start = {}; - struct tm tm_end = {}; - -@@ -469,7 +469,7 @@ round_down_tm_to_reference_with_date_tim - } - - bool --fsearch_date_time_parse_interval(const char *str, time_t *time_start_out, time_t *time_end_out) { -+fsearch_date_time_parse_interval(const char *str, int64_t *time_start_out, int64_t *time_end_out) { - if (parse_date_time_constants(str, time_start_out, time_end_out)) { - return true; - } ---- a/src/fsearch_time_utils.h -+++ b/src/fsearch_time_utils.h -@@ -1,7 +1,7 @@ - #pragma once - - #include --#include -+#include - - bool --fsearch_date_time_parse_interval(const char *str, time_t *time_start_out, time_t *time_end_out); -\ No newline at end of file -+fsearch_date_time_parse_interval(const char *str, int64_t *time_start_out, int64_t *time_end_out); ---- a/src/tests/test_time_utils.c -+++ b/src/tests/test_time_utils.c -@@ -49,8 +49,8 @@ test_parse_time_interval(void) { - - for (gint i = 0; i < G_N_ELEMENTS(strings); ++i) { - FsearchTestTimeIntervalParseContext *ctx = &strings[i]; -- time_t time_start = 0; -- time_t time_end = 0; -+ int64_t time_start = 0; -+ int64_t time_end = 0; - - gboolean res = fsearch_date_time_parse_interval(ctx->string, &time_start, &time_end); - g_assert_true(res == ctx->expected_success); diff --git a/srcpkgs/fsearch/template b/srcpkgs/fsearch/template index fc8cad5aa95202..dedb569fc95f54 100644 --- a/srcpkgs/fsearch/template +++ b/srcpkgs/fsearch/template @@ -1,13 +1,54 @@ # Template file for 'fsearch' pkgname=fsearch -version=0.2.3 +version=0.3.1 revision=1 build_style=meson -hostmakedepends="gettext glib-devel pkg-config" -makedepends="gtk+3-devel pcre2-devel" -short_desc="Fast file search utility based on GTK+3" -maintainer="Orphaned " +hostmakedepends="gettext itstool glib-devel pkg-config" +makedepends="gtk+3-devel" +depends="desktop-file-utils hicolor-icon-theme" +short_desc="Fast file search utility inspired by Everything" +maintainer="RandallFlagg " license="GPL-2.0-or-later" homepage="https://cboxdoerfer.github.io/fsearch/" +changelog="https://github.com/cboxdoerfer/fsearch/releases#release-${version}" distfiles="https://github.com/cboxdoerfer/fsearch/archive/${version}.tar.gz" -checksum=b3c576bf1230da7c374d00bb32d72686b940b4dee80d941495acfdd5437bf117 +checksum=b16ab75556d841bf858633710d71c92f35d34362614b8584b0a5b71690a72c39 + +do_patch() { + # Replace time_t with int64_t for 32-bit time_t compatibility + for f in "$PATCHESDIR"/query.patch; do + [ -f "$f" ] || continue + msg_normal "${pkgver}: patching: ${f##*/}\n" + patch -Np1 < "$f" + done + + # Apply cross-compilation fix + if [ "$CROSS_BUILD" ]; then + for f in "$PATCHESDIR"/*cross*.patch; do + [ -f "$f" ] || continue + msg_normal "${pkgver}: patching: ${f##*/}\n" + patch -Np1 < "$f" + done + fi + + # Apply off64_t and time64 fixes for 32-bit i686 builds + if [[ "$XBPS_TARGET_MACHINE" = i686 ]]; then + for f in "$PATCHESDIR"/fsearch-off64.patch "$PATCHESDIR"/*time64*.patch; do + [ -f "$f" ] || continue + msg_normal "${pkgver}: patching: ${f##*/}\n" + patch -Np1 < "$f" + done + fi + + # Apply musl-specific patches + if [[ "$XBPS_TARGET_LIBC" = musl ]]; then + for f in "$PATCHESDIR"/*musl*.patch; do + [ -f "$f" ] || continue + msg_normal "${pkgver}: patching: ${f##*/}\n" + patch -Np1 < "$f" + done + fi + + # Prevent default patch hook from running + PATCHESDIR=/nonexistent +}