[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#62264] [PATCH v2 2/3] Add 'guix locate'.
From: |
Jelle Licht |
Subject: |
[bug#62264] [PATCH v2 2/3] Add 'guix locate'. |
Date: |
Thu, 08 Jun 2023 19:27:40 +0200 |
Hi Ludo,
Thanks for this cool feature. I have only found nitpicks, that should
most definitely not hold up this series.
Ludovic Courtès <ludo@gnu.org> writes:
> * 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.
>
> Co-authored-by: Antoine R. Dumont <antoine.romain.dumont@gmail.com>
> ---
> Makefile.am | 2 +
> doc/guix.texi | 118 ++++++++
> guix/scripts/locate.scm | 657 ++++++++++++++++++++++++++++++++++++++++
> po/guix/POTFILES.in | 1 +
> tests/guix-locate.sh | 72 +++++
> 5 files changed, 850 insertions(+)
> create mode 100644 guix/scripts/locate.scm
> create mode 100755 tests/guix-locate.sh
[snip]
> +@example
> +$ guix locate -g '*.service'
> +man-db@@2.11.1 @dots{}/lib/systemd/system/man-db.service
> +wpa-supplicant@@2.10 @dots{}/system-services/fi.w1.wpa_supplicant1.service
> +@end example
> +
> +The @command{guix locate} command relies on a database that maps file
> +names to package names. By default, it automatically creates that
> +database if it does not exist yet by traversing packages available
> +@emph{locally}, which can take a few minutes (depending on the size of
> +your store and the speed of your storage device).
> +
> +@quotation Warning
nit: Note seems more applicable, ymmv.
[snip]
> diff --git a/guix/scripts/locate.scm b/guix/scripts/locate.scm
> new file mode 100644
> index 0000000000..b5d8671d9c
> --- /dev/null
> +++ b/guix/scripts/locate.scm
> @@ -0,0 +1,657 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2022, 2023 Ludovic Courtès <ludo@gnu.org>
> +;;; Copyright © 2023 Antoine R. Dumont <antoine.romain.dumont@gmail.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (guix scripts locate)
> + #:use-module ((guix config) #:select (%localstatedir))
> + #:use-module (guix i18n)
> + #:use-module ((guix ui)
> + #:select (show-version-and-exit
> + show-bug-report-information
> + with-error-handling
> + string->number*
> + display-hint
> + leave-on-EPIPE))
> + #:use-module (guix diagnostics)
> + #:use-module (guix scripts)
> + #:use-module (sqlite3)
> + #:use-module (ice-9 match)
> + #:use-module (ice-9 format)
> + #:use-module (guix store)
> + #:use-module (guix monads)
> + #:autoload (guix combinators) (fold2)
> + #:autoload (guix grafts) (%graft?)
> + #:autoload (guix store roots) (gc-roots)
> + #:use-module (guix derivations)
> + #:use-module (guix packages)
> + #:use-module (guix profiles)
> + #:autoload (guix progress) (progress-reporter/bar
> + call-with-progress-reporter)
> + #:use-module (guix sets)
> + #:use-module ((guix utils) #:select (cache-directory))
> + #:autoload (guix build utils) (find-files mkdir-p)
> + #:autoload (gnu packages) (fold-packages)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-9)
> + #:use-module (srfi srfi-37) ;; option
nit: if we are already singling out this module and import, why not
#:select as well?
> + #:use-module (srfi srfi-71)
> + #:export (guix-locate))
> +
> +(define application-version 3)
> +
> +;; The following schema is the full schema at the `application-version`. It
> +;; should be modified according to the development required and
> +;; `application-version` should be bumped. If the schema needs modification
> +;; across time, those should be changed directly in the full-schema and the
> +;; incremental changes should be referenced as migration step below for the
> +;; new `application-version` (for the existing dbs to know what to migrate).
> +(define schema-full
> + "
> +create table if not exists SchemaVersion (
> + version integer primary key not null,
> + date date,
^ nit: sqlite does not have a native date type.
We seem to be using it like a timestamp rather than a date.
- Jelle
- [bug#62264] [PATCH core-updates 0/6] Add `guix index` subcommand, Ludovic Courtès, 2023/06/04
- [bug#62264] [PATCH v2 1/3] store: Tolerate non-existent GC root directories., Ludovic Courtès, 2023/06/07
- [bug#62264] [PATCH v2 0/3] Add 'guix locate', Ludovic Courtès, 2023/06/07
- [bug#62264] [PATCH v2 3/3] DRAFT news: Add entry for 'guix locate'., Ludovic Courtès, 2023/06/07
- [bug#62264] [PATCH v2 2/3] Add 'guix locate'., Ludovic Courtès, 2023/06/07
- [bug#62264] [PATCH v2 2/3] Add 'guix locate'.,
Jelle Licht <=
- [bug#62264] [PATCH v2 2/3] Add 'guix locate'., pelzflorian (Florian Pelz), 2023/06/08
- [bug#62264] [PATCH v3 1/3] store: Tolerate non-existent GC root directories., Ludovic Courtès, 2023/06/16
- [bug#62264] [PATCH v3 2/3] Add 'guix locate'., Ludovic Courtès, 2023/06/16
- [bug#62264] [PATCH] Add 'guix locate' command, pelzflorian (Florian Pelz), 2023/06/17
- [bug#62264] [PATCH] Add 'guix locate' command, Ludovic Courtès, 2023/06/18