all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jelle Licht <jlicht@fsfe.org>
To: "Ludovic Courtès" <ludo@gnu.org>, 62264@debbugs.gnu.org
Cc: "Antoine R . Dumont" <antoine.romain.dumont@gmail.com>
Subject: [bug#62264] [PATCH v2 2/3] Add 'guix locate'.
Date: Thu, 08 Jun 2023 19:27:40 +0200	[thread overview]
Message-ID: <87cz25n9tf.fsf@fsfe.org> (raw)
In-Reply-To: <60a9dae46ac7531b5dc8ae05c0c4938537017808.1686175352.git.ludo@gnu.org>


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




  reply	other threads:[~2023-06-08 17:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 16:06 [bug#62264] [PATCH core-updates 0/6] Add `guix index` subcommand Antoine R. Dumont (@ardumont)
2023-03-18 16:57 ` [bug#62264] [PATCH core-updates 1-6/6] " Antoine R. Dumont
2023-04-02 21:57 ` [bug#62264] [PATCH core-updates 0/6] " Ludovic Courtès
2023-05-21 21:45   ` Ludovic Courtès
2023-05-22 16:53     ` Simon Tournier
2023-05-24 14:40       ` Ludovic Courtès
2023-05-25 16:20         ` Simon Tournier
2023-05-26 16:44           ` Ludovic Courtès
2023-06-04 22:25     ` Ludovic Courtès
2023-06-07 22:09       ` [bug#62264] [PATCH v2 0/3] Add 'guix locate' Ludovic Courtès
2023-06-09  3:57         ` Ryan Prior
2023-06-15 22:02           ` bug#62264: [PATCH] Add 'guix locate' command Ludovic Courtès
2023-06-07 22:09       ` [bug#62264] [PATCH v2 1/3] store: Tolerate non-existent GC root directories Ludovic Courtès
2023-06-07 22:09       ` [bug#62264] [PATCH v2 2/3] Add 'guix locate' Ludovic Courtès
2023-06-08 17:27         ` Jelle Licht [this message]
2023-06-16 14:20           ` [bug#62264] [PATCH] Add 'guix locate' command Ludovic Courtès
2023-06-08 20:59         ` [bug#62264] [PATCH v2 2/3] Add 'guix locate' pelzflorian (Florian Pelz)
2023-06-09 10:07           ` pelzflorian (Florian Pelz)
2023-06-16 14:25           ` [bug#62264] [PATCH] Add 'guix locate' command Ludovic Courtès
2023-06-16 14:26             ` [bug#62264] [PATCH v3 1/3] store: Tolerate non-existent GC root directories Ludovic Courtès
2023-06-16 14:26             ` [bug#62264] [PATCH v3 2/3] Add 'guix locate' Ludovic Courtès
2023-06-16 14:27             ` [bug#62264] [PATCH v3 3/3] DRAFT news: Add entry for " Ludovic Courtès
2023-06-17 15:35               ` pelzflorian (Florian Pelz)
2023-06-17 15:56             ` [bug#62264] [PATCH] Add 'guix locate' command pelzflorian (Florian Pelz)
2023-06-18 21:51               ` Ludovic Courtès
2023-06-07 22:09       ` [bug#62264] [PATCH v2 3/3] DRAFT news: Add entry for 'guix locate' Ludovic Courtès
2023-06-08 21:19         ` pelzflorian (Florian Pelz)
2023-06-16 14:21           ` [bug#62264] [PATCH] Add 'guix locate' command Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz25n9tf.fsf@fsfe.org \
    --to=jlicht@fsfe.org \
    --cc=62264@debbugs.gnu.org \
    --cc=antoine.romain.dumont@gmail.com \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.