From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id APnTChpHimPJngAAbAwnHQ (envelope-from ) for ; Fri, 02 Dec 2022 19:42:34 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id KHGxChpHimPCWAEAauVa8A (envelope-from ) for ; Fri, 02 Dec 2022 19:42:34 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C265C1720D for ; Fri, 2 Dec 2022 19:42:33 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1AgH-0002W8-4C; Fri, 02 Dec 2022 13:22:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1AgD-0002RY-TD for guix-devel@gnu.org; Fri, 02 Dec 2022 13:22:34 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1AgB-0003L1-3d for guix-devel@gnu.org; Fri, 02 Dec 2022 13:22:33 -0500 Received: by mail-wm1-x336.google.com with SMTP id n7so4113904wms.3 for ; Fri, 02 Dec 2022 10:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=a0uX9+J727iJtHO+QBj9PHX0SIFqnddk5O2zUxmT2fQ=; b=BxyEqTimKEJLoPD3hj3sDwUNbEboJ5rPmQGvuzJjwn35RdwUe3DY1jxfWWqJJnXVQo 4egyoK/9Ax+coTDQ7MvzS11vscOzV70mR5lxYR9/XqmV8guK0YZFT9HeTA87x5SiDIJ0 XcyJ+0Gd7vsTevotGs5Gte41JTMpfRXIaxcV5/TMepvt5Py43xn6+t3bokXLn8DcYTI3 sgTAQIbsfspQjcp2KyiuqhWb+S5MNz+2KF957oKsO48kR6VWuUiUoKIzODpuPd3maNWZ KuKlXIMbcNlFtYB9L97OiP8G5KMySKnKPY/xZ5EQP786KSbswwnadxEm8gdHHGzjQJhY Jy1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a0uX9+J727iJtHO+QBj9PHX0SIFqnddk5O2zUxmT2fQ=; b=Xi40E4Z4ZpJSWxyPNph/O07ObCBSVagZIH663ZsqTLHQDr5qirpPBbMEq9VgGITcDO Hc7OH/wrALdvdHjP+zOnQMMcPNlE5mv6Lh498wPNWc8KtvEKgLB5gU+Q873rIfxdVY95 BpaUKBuEWeXd+dKOJV4+pg6+wSGIcS8F4+c55jRhqq78nT5zJEqyIEzCbz0qFEPiq9ys yOOaGsFWHmYLtIiX3xDWJJ4EoUe8HFnUAGz3QyL1lJQzlCJglgnRdsEza/7TeXTur/Qf q6Q6CZjLsgcUrBh0CoHx2qbdAGjEVWyJJZLt9lwNmfeJ3FAvPxqEGKXhvzgEdK+bXZ00 IBiw== X-Gm-Message-State: ANoB5pk8ZmKtsESfx5y8FBtrJ8kxndVCjUSnHdcI1K5HczTvAm6TFakY Y6nl2NH8vYKtYeXQQa8r8yjkXvRZ4uU= X-Google-Smtp-Source: AA0mqf4a5/QaJKnCI+nWjTmUg9REaTDk+oLoSruSJRRnIMsu68sNzmLn83K/GwLi0fkpH9uXfo2tCw== X-Received: by 2002:a1c:f712:0:b0:3cc:a9be:d9e9 with SMTP id v18-20020a1cf712000000b003cca9bed9e9mr51824647wmh.173.1670005348892; Fri, 02 Dec 2022 10:22:28 -0800 (PST) Received: from yavin4 ([2a01:e0a:1c8:8a40:2394:a743:1507:85ab]) by smtp.gmail.com with ESMTPSA id h16-20020a05600c2cb000b003c6bbe910fdsm16028855wmc.9.2022.12.02.10.22.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 10:22:28 -0800 (PST) From: "Antoine R. Dumont (@ardumont)" To: guix-devel@gnu.org Subject: Re: File search In-Reply-To: <87pmd1r8kt.fsf@gmail.com> References: <87pmd1r8kt.fsf@gmail.com> Date: Fri, 02 Dec 2022 19:22:27 +0100 Message-ID: <87mt85r7h8.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=antoine.romain.dumont@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1670006554; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=OO7U/+2GTOoDGDqlvBHzTB7klgP6b/AGmyLycvI9fFY=; b=VgfPUswZcX8c0JOErhzUqdNdB/LWaTlHqY6lB/dUDp4SB2NoqAUICux4H3qJ7q3+IOT4D+ WcjRBdt2zdBtNI0ZoRX1s/1+Ej1LOL+CB8S4O1XW7jog4uqbTJzDmwy8tKt6dGkwqNsrhw d0Xueq1t3nKXOxY9NxAm1+Q/FeJYPGlbuzXkGw+FvZI9HqwLn6d/Vk4yOUbJ8QcsN9SYJ/ DNqGji9bhljc9jxH+3ljf2aN1MLfPKuXt4L6W3Lvx2XJI/jth8qomSB965rTxbEEfkdnv+ dWfWkDjtK7vyW1XwUDo6zjwfgcBT9ZxvZVegBcLKXJXM6P/72c3QLLt69j9/aw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670006554; a=rsa-sha256; cv=none; b=YpOm/oQSAEOPzqGVylAys0NkR2d03eKC3/dzBxZ3j43yQ0O9O0/q1w0s4gv6xAhPsMc2Lq 8bxnJu7wZwtsfKmJHKwZGP4RPL4oldIHf/2wKtqQZrwbANK2qYhs3mle5GNRHDHlXeFN4f kSJL5c3LzCHddYXzy3EzJVM62vT4ovsRau0YNwaR3t/JaEByslx7d3ZySPxUwlttc6p4t3 vcXkPwdTrQ2RPdcVbg0FMiTqRy86HgezlMQ6W9zS5KrG2phLt7UqdFngVTtPvrc7I51giM LdJNeDcZDDWi/pUwVmcsIsBejvEA0yHl4lF7djeMf6W6V93B0927NKaFCxo5sw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=BxyEqTim; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.63 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=BxyEqTim; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: C265C1720D X-Spam-Score: 5.63 X-Migadu-Scanner: scn1.migadu.com X-TUID: sNuGeQOApxKR --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello again, As mentioned previously, I have iterated on the work @civodul started. After discussing it a bit over irc, I proposed to try and push a bit forward the discussion and the implementation [2] to see where this goes. After toying a bit with the initial code, I took the liberty to make it a guix extension (we discussed it a bit with @zimoun). It was mostly to get started with Guile (I know some lisp implems but not this one so i had to familiarize myself with tools and whatnot ;). Anyway, that can be reverted if you feel like it can be integrated as a Guix cli directly. Currently, the implementation scans and indexes whatever package is present in the local store of the machine's user. From nix/guix's design, it makes sense to do it that way as it's likely that even though you don't have all the tools locally, it may be already present as a dependency of some high level tools you already use (it's just not exposed because not declared in config.scm or home-configuration.scm). You will find inlines (at the bottom) some cli usage calls [1] and the current implementation [2]. Thanks in advance for any feedback ;) Cheers, =2D- tony / Antoine R. Dumont (@ardumont) =2D---------------------------------------------------------------- gpg fingerprint BF00 203D 741A C9D5 46A8 BE07 52E2 E984 0D10 C3B8 [1] Usage sample: =2D-8<---------------cut here---------------start------------->8--- $ env | grep GUIX_EXTENSION GUIX_EXTENSIONS_PATH=3D$HOME/repo/public/guix/guix/guix/extensions $ guix index ;;; (package 1 "acl") ;;; (package 595 "shepherd") ;;; (package 596 "guile2.2-shepherd") ;;; (package 2 "htop") ;;; (package 7 "shadow") ;;; (package 6 "shepherd") ;;; (package 5 "autojump") ... ^C $ guix index search shepherd guile2.2-shepherd@0.9.3 /gnu/store/cq8r2vzg56ax0iidgs4biz3sv0b9jxp3-guile2.= 2-shepherd-0.9.3/bin/shepherd shepherd@0.9.3 /gnu/store/a9jdd8kgckwlq97yw3pjqs6sy4lqgrfq-shepherd-0= .9.3/bin/shepherd shepherd@0.8.1 /gnu/store/vza48khbaq0fdmcsrn27xj5y5yy76z6l-shepherd-0= .8.1/bin/shepherd shepherd@0.9.1 /gnu/store/gxz67p4gx9g6rpxxpsgmhsybczimdlx5-shepherd-0= .9.1/bin/shepherd guix help | grep -C3 extension repl read-eval-print loop (REPL) for interactive programming extension commands index Index packages to allow searching package for a given filename Report bugs to: bug-guix@gnu.org. $ guix help index # or: guix index [--help|-h] Usage: guix index [OPTIONS...] [search FILE...] Without FILE, index (package, file) relationships in the local store. With 'search FILE', search for packages installing FILE. Note: The internal cache is located at ~/.config/guix/locate-db.sqlite. See --db-path for customization. The valid values for OPTIONS are: -h, --help Display this help and exit -V, --version Display version information and exit --db-path=3DDIR Change default location of the cache db The valid values for ARGS are: search FILE Search for packages installing the FILE (from cache db) Report bugs to: bug-guix@gnu.org. GNU Guix home page: General help using Guix and GNU software: $ guix index --version # or guix index -V guix locate (GNU Guix) 5ccb5837ccfb39af4e3e6399a0124997a187beb1 Copyright (C) 2022 the Guix authors License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. =2D-8<---------------cut here---------------start------------->8--- [2] The code: =2D-8<---------------cut here---------------start------------->8--- ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2022 Ludovic Court=C3=A8s ;;; ;;; 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 . (define-module (guix extensions index) #:use-module (guix config) ;; %guix-package-name, ... #:use-module (guix ui) ;; display G_ #:use-module (guix scripts) #:use-module (sqlite3) #:use-module (ice-9 match) #:use-module (guix describe) #:use-module (guix store) #:use-module (guix monads) #:autoload (guix grafts) (%graft?) #:use-module (guix derivations) #:use-module (guix packages) #:autoload (guix build utils) (find-files) #:autoload (gnu packages) (fold-packages) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:export (guix-index)) (define debug #f) (define schema " create table if not exists Packages ( id integer primary key autoincrement not null, name text not null, version text not null, unique (name, version) -- add uniqueness constraint ); create table if not exists Directories ( id integer primary key autoincrement not null, name text not null, package integer not null, foreign key (package) references Packages(id) on delete cascade, unique (name, package) -- add uniqueness constraint ); create table if not exists Files ( name text not null, basename text not null, directory integer not null, foreign key (directory) references Directories(id) on delete cascade unique (name, basename, directory) -- add uniqueness constraint ); create index if not exists IndexFiles on Files(basename);") (define (call-with-database file proc) (let ((db (sqlite-open file))) (dynamic-wind (lambda () #t) (lambda () (sqlite-exec db schema) (proc db)) (lambda () (sqlite-close db))))) (define (insert-files db package version directories) "Insert files from DIRECTORIES as belonging to PACKAGE at VERSION." (define stmt-select-package (sqlite-prepare db "\ SELECT id FROM Packages WHERE name =3D :name AND version =3D :version;" #:cache? #t)) (define stmt-insert-package (sqlite-prepare db "\ INSERT OR IGNORE INTO Packages(name, version) -- to avoid spurious writes VALUES (:name, :version);" #:cache? #t)) (define stmt-select-directory (sqlite-prepare db "\ SELECT id FROM Directories WHERE name =3D :name AND package =3D :package;" #:cache? #t)) (define stmt-insert-directory (sqlite-prepare db "\ INSERT OR IGNORE INTO Directories(name, package) -- to avoid spurious writes VALUES (:name, :package);" #:cache? #t)) (define stmt-insert-file (sqlite-prepare db "\ INSERT OR IGNORE INTO Files(name, basename, directory) VALUES (:name, :basename, :directory);" #:cache? #t)) (sqlite-exec db "begin immediate;") (sqlite-bind-arguments stmt-insert-package #:name package #:version version) (sqlite-fold (const #t) #t stmt-insert-package) (sqlite-bind-arguments stmt-select-package #:name package #:version version) (match (sqlite-fold cons '() stmt-select-package) ((#(package-id)) (when debug (format #t "(pkg, version, pkg-id): (~a, ~a, ~a)" package version package-id)) (pk 'package package-id package) (for-each (lambda (directory) (define (strip file) (string-drop file (+ (string-length directory) 1))) (sqlite-reset stmt-insert-directory) (sqlite-bind-arguments stmt-insert-directory #:name directory #:package package-id) (sqlite-fold (const #t) #t stmt-insert-directory) (sqlite-reset stmt-select-directory) (sqlite-bind-arguments stmt-select-directory #:name directory #:package package-id) (match (sqlite-fold cons '() stmt-select-directory) ((#(directory-id)) (when debug (format #t "(name, package, dir-id): (~a, ~a, ~a)\n" directory package-id directory-id)) (for-each (lambda (file) ;; If DIRECTORY is a symlink, (find-files ;; DIRECTORY) returns the DIRECTORY singlet= on. (unless (string=3D? file directory) (sqlite-reset stmt-insert-file) (sqlite-bind-arguments stmt-insert-file #:name (strip file) #:basename (basename file) #:directory directory-id) (sqlite-fold (const #t) #t stmt-insert-fi= le))) (find-files directory))))) directories))) (sqlite-exec db "commit;")) (define (insert-package db package) "Insert all the files of PACKAGE into DB." (mlet %store-monad ((drv (package->derivation package #:graft? #f))) (match (derivation->output-paths drv) (((labels . directories) ...) (when (every file-exists? directories) (insert-files db (package-name package) (package-version package) directories)) (return #t))))) (define (filter-public-current-supported package) "Filter supported, not hidden (public) and not superseded (current) packa= ge." (and (not (hidden-package? package)) (not (package-superseded package)) (supported-package? package))) (define (filter-supported-package package) "Filter supported package (package might be hidden or superseded)." (and (supported-package? package))) (define (no-filter package) "No filtering on package" #t) (define* (insert-packages db #:optional (filter-policy filter-public-curren= t-supported)) "Insert all current packages matching `filter-package-policy` into DB." (with-store store (parameterize ((%graft? #f)) (fold-packages (lambda (package _) (run-with-store store (insert-package db package))) #t #:select? filter-policy)))) (define-record-type (package-match name version file) package-match? (name package-match-name) (version package-match-version) (file package-match-file)) (define (matching-packages db file) "Return unique corresponding to packages containing FILE." (define lookup-stmt (sqlite-prepare db "\ SELECT Packages.name, Packages.version, Directories.name, Files.name FROM Packages INNER JOIN Files, Directories ON files.basename =3D :file AND directories.id =3D files.directory AND packages.id =3D directories.package;")) (sqlite-bind-arguments lookup-stmt #:file file) (sqlite-fold (lambda (result lst) (match result (#(package version directory file) (cons (package-match package version (string-append directory "/" file)) lst)))) '() lookup-stmt)) (define (index-packages-with-db db-pathname) "Index packages using db at location DB-PATHNAME." (call-with-database db-pathname (lambda (db) (insert-packages db no-filter)))) (define (matching-packages-with-db db-pathname file) "Compute list of packages referencing FILE using db at DB-PATHNAME." (call-with-database db-pathname (lambda (db) (matching-packages db file)))) (define (print-matching-results matches) "Print the MATCHES matching results." (for-each (lambda (result) (format #t "~20a ~a~%" (string-append (package-match-name result) "@" (package-match-version result)) (package-match-file result))) matches)) (define default-db-path (let ((local-config-path (and=3D> (getenv "HOME") (lambda (home) (string-append home "/.config/guix/"))))) (string-append local-config-path "locate-db.sqlite"))) (define (show-bug-report-information) ;; TRANSLATORS: The placeholder indicates the bug-reporting address for t= his ;; package. Please add another line saying "Report translation bugs to ;; ...\n" with the address for translation bugs (typically your translati= on ;; team's web or email address). (format #t (G_ " Report bugs to: ~a.") %guix-bug-report-address) (format #t (G_ " ~a home page: <~a>") %guix-package-name %guix-home-page-url) (format #t (G_ " General help using Guix and GNU software: <~a>") ;; TRANSLATORS: Change the "/en" bit of this URL appropriately if ;; the web site is translated in your language. (G_ "https://guix.gnu.org/en/help/")) (newline)) (define (show-help) (display (G_ "Usage: guix index [OPTIONS...] [search FILE...] Without FILE, index (package, file) relationships in the local store. With 'search FILE', search for packages installing FILEx;x.\n Note: The internal cache is located at ~/.config/guix/locate-db.sqlite. See --db-path for customization.\n")) (newline) (display (G_ "The valid values for OPTIONS are:")) (newline) (display (G_ " -h, --help Display this help and exit")) (display (G_ " -V, --version Display version information and exit")) (display (G_ " --db-path=3DDIR Change default location of the cache db")) (newline) (newline) (display (G_ "The valid values for ARGS are:")) (newline) (display (G_ " search FILE Search for packages installing the FILE (from cache db)")) (newline) (show-bug-report-information)) (define-command (guix-index . args) (category extension) (synopsis "Index packages to allow searching package for a given filename= ") (define (parse-db-args args) "Parsing of string key=3Dvalue where we are only interested in 'value'" (match (string-split args #\=3D) ((unused db-path) db-path) (_ #f))) (define (display-help-and-exit) (show-help) (exit 0)) (match args ((or ("-h") ("--help")) (display-help-and-exit)) ((or ("-V") ("--version")) (show-version-and-exit "guix locate")) ((db-path-args) (let ((db-path (parse-db-args db-path-args))) (if db-path (index-packages-with-db db-path) (display-help-and-exit)))) (("search" file) (let ((matches (matching-packages-with-db default-db-path file))) (print-matching-results matches) (exit (pair? matches)))) ((db-path-args "search" file) (let ((db-path (parse-db-args db-path-args))) (if db-path (let ((matches (matching-packages-with-db db-path file))) (print-matching-results matches) (exit (pair? matches))) (display-help-and-exit)))) (_ ;; index by default (index-packages-with-db default-db-path)))) =2D-8<---------------cut here---------------start------------->8--- antoine.romain.dumont@gmail.com writes: > Hello Guix! > > Guix is top so thanks for the awesome work! > > Just to give some feedback on this thread. That's a good news that the > file search functionality in the radar. > >> Lately I found myself going several times to >> to look for packages providing a given >> file and I thought it=E2=80=99s time to do something about it. > > I've finally started to set up my machine with Guix system (and > Guix Home). Finding out where such program or cli is packaged is > definitely something that I need to port my existing use (from mainly > nixified debian or nixos machines) to Guix. > > And to answer such question, I used existing "offline" programs in my > machines. I've bounced back and forth between `nix-locate` and `apt-file > search` to determine approximately the packages in Guix (names aren't > usually that different). > > Hence, as a user, it's one of my expectation that the Guix cli provides > some equivalent program to lookup from file to package ;). > >> The script below creates an SQLite database for the current set of >> packages, but only for those already in the store: >> >> Guix repl file-database.scm populate >> >> That creates /tmp/db; it took about 25mn on berlin, for 18K packages. >> Then you can run, say: >> >> Guix repl file-database.scm search boot-9.scm >> >> to find which packages provide a file named =E2=80=98boot-9.scm=E2=80=99= . That part is >> instantaneous. >> >> The database for 18K packages is quite big: >> >> --8<---------------cut here---------------start------------->8--- >> $ du -h /tmp/db* >> 389M /tmp/db >> 82M /tmp/db.gz >> 61M /tmp/db.zst >> --8<---------------cut here---------------end--------------->8--- > > For information, in a most recent implementation (@civodul provided me > in #guix-devel), I noticed multiple calls to the indexation step would > duplicate information (at all levels packages, files, directories). So > that might have had an impact in the extracted values above (if ludo had > triggered multiple times the script at the time). > > Jsyk, I have started iterating a bit over that provided implementation > (and fixed the current caveat mentioned), added some help message... > I'll follow up with it in a bit (same thread) to have some more feedback > on it. > >> How do we expose that information? There are several criteria I can >> think of: accuracy, freshness, privacy, responsiveness, off-line >> operation. >> >> I think accuracy (making sure you get results that correspond precisely >> to, say, your current channel revisions and your current system) is not >> a high priority: some result is better than no result. > > I definitely agree with this. At least from the offline use perspective. > I did not focus at all on the second part of the problematic ("online" > and distribution use). > >> Likewise for freshness: results for an older version of a given >> package may still be valid now. > > Indeed. > > Cheers, > -- > tony / Antoine R. Dumont (@ardumont) > > ----------------------------------------------------------------- > gpg fingerprint BF00 203D 741A C9D5 46A8 BE07 52E2 E984 0D10 C3B8 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJUBAEBCgA+FiEEvwAgPXQaydVGqL4HUuLphA0Qw7gFAmOKQmMgHGFudG9pbmUu cm9tYWluLmR1bW9udEBnbWFpbC5jb20ACgkQUuLphA0Qw7ho1xAAvlzq1m/sM2aZ AG1RkVdZDQJzu5/Ia2s48JZKve+dQvSx8PlISm60BqZpj1bt43zukclknqYDGZho U6JVVIP6DHAKBb2JL6MbXPNTkcCRKcfwGWME0PKY7X2mVNtSAACU7LwJ2pIBQIw6 pEdPvOk+WrHiDIU2cxpYCdRbhQapNs5+KlS84IZ7A6QA2aInIYjKUv+fSsdQocmH GiAnyYBwN9zJqYuK/7l4NMtdexdw6at3hiYQjFNGrqpCpOqqxK6fF8ku+zuvH9q8 3T3tRYMH96gN06CoQnBpFKRC8ZSGeQvqMuvnMmswcME10tTOJ1lpJLGpSXmIcJjp W2GDZfvYHvjc7xasN+1pFz6amljV1Nua9BwZoRliPVnZx93dka+z3vQtIH7kHD57 hS8pqnAOQdFEVmV3b6XB/as65SmT4ftXrhJUSyqqcR9oQ8nOjLRh1XBWSJvocX7b G8FYoYU29QcqGv56iPLz9AbaJ/LvR4MNVFFNBdPMX6TuUlO+aQVGyJ2Gx65Y+GCX +FPX6mq4zlw3qqY2y9cBd9E8dd5zai4FH75WQzMzeQKp3NUiAZzKf6NXU0j7pl7s UEC2d9tNsw97Oc3slu+e+Od0iPqxBX5SFU4RTRoJU7862wNtgcCIoBmtuAhQLxVi qZF53eoYF01qZkhOwFgU6USbmUqDOzk= =hW3a -----END PGP SIGNATURE----- --=-=-=--