Commit Graph

5 Commits

Author SHA1 Message Date
Ludovic Courtès 69d9a02094
locate: Accept ‘--clear’ without additional arguments.
Fixes a bug whereby ‘guix locate --clear’ would end with the “no files
to search for” error.

Fixes <https://issues.guix.gnu.org/66799>.

* guix/scripts/locate.scm (guix-locate): Do not emit “no files to search
for” error when 'clear? is set in OPTS.
* tests/guix-locate.sh: Test it.

Reported-by: Maciej Kalandyk <m.kalandyk@outlook.com>
Change-Id: Ib8fa125c18481d7f5408bd89df9503713527641d
2023-11-15 18:29:37 +01:00
Ludovic Courtès d0fed2f4df
locate: Do not return the system database when it is too old.
Fixes a bug whereby ‘guix locate’ would pick the system database, then
decide it’s too old, try to update it, and fail because it’s not
writable by unprivileged users.

Fixes <https://issues.guix.gnu.org/66612>.

* guix/scripts/locate.scm (file-age): New procedure.
(suitable-database): Add ‘age-update-threshold’ parameter and honor it.
(guix-locate): Remove ‘file-age’.  Pass ‘age-update-threshold’ to the
‘database’ option.

Reported-by: Matt Wette <matt.wette@gmail.com>
2023-10-18 18:21:04 +02:00
Simon Tournier 55c3776023
scripts: locate: Handle EPIPE errors when displaying help.
* guix/scripts/locate.scm (%options): Handle EPIPE errors when displaying
help.
2023-10-17 14:51:59 +02:00
Ludovic Courtès e1c2c2f042
locate: Ignore unreadable manifests.
Fixes <https://issues.guix.gnu.org/64187>.

* guix/scripts/locate.scm (profiles->manifest-entries): Wrap
'profile-manifest' in 'false-if-exception'.

Reported-by: Ricardo Wurmus <rekado@elephly.net>
2023-07-11 15:47:55 +02:00
Ludovic Courtès 1b7aabbc79
Add 'guix locate'.
* guix/scripts/locate.scm, tests/guix-locate.sh: New files.
* Makefile.am (MODULES): Add 'guix/scripts/locate.scm'.
(SH_TESTS): Add 'tests/guix-locate.sh'.
* po/guix/POTFILES.in: Add it.
* doc/guix.texi (Invoking guix locate): New node.

Co-authored-by: Antoine R. Dumont <antoine.romain.dumont@gmail.com>
2023-06-18 23:44:29 +02:00