GNU bug report logs - #62264
[PATCH core-updates 0/6] Add `guix index` subcommand

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>; Keywords: patch; dated Sat, 18 Mar 2023 16:38:03 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 62264 <at> debbugs.gnu.org:


Received: (at 62264) by debbugs.gnu.org; 25 May 2023 18:34:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 25 14:34:00 2023
Received: from localhost ([127.0.0.1]:48105 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q2Fmh-0000EB-NA
	for submit <at> debbugs.gnu.org; Thu, 25 May 2023 14:34:00 -0400
Received: from mail-wm1-f46.google.com ([209.85.128.46]:41416)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1q2Fmb-0000D6-S0
 for 62264 <at> debbugs.gnu.org; Thu, 25 May 2023 14:33:54 -0400
Received: by mail-wm1-f46.google.com with SMTP id
 5b1f17b1804b1-3f6e67df911so687135e9.1
 for <62264 <at> debbugs.gnu.org>; Thu, 25 May 2023 11:33:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1685039628; x=1687631628;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=7+cjozpUwxHZ32F0iOEnW2SfjWn/hX+2ko7Keru7ksk=;
 b=I6TtV0TzpKdgPboqseuUIJBi+xGjhSmP8HGkWuUUAS5hFEM1bWgOxzzlHg5DYJ12I6
 PPRKcHFlOnwwDgArEje/wLRjd8pn+Ci03QOjc841M1eusVmYtGttrTIxtXMrN+H333fR
 GLvWbCSgEOLyGtMiggpJvBgj0OEAVPE/uhELKlA/NdE+VBNMB+/hpZbHeBJpuUzWyCPu
 RfbJlaExhzDllQ5x98zeRkA30ZuRAu2B/wAqInYpkP3XnliMPLWU3mltQqQ6dZk2SMR5
 VoXP+oC/r9VNyBFr/uxgMEv5EvLjiFCEVeKfCkZZEM4wqy2NsF81T6m4AWfDlvVJEBXp
 DpVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1685039628; x=1687631628;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=7+cjozpUwxHZ32F0iOEnW2SfjWn/hX+2ko7Keru7ksk=;
 b=awqeaU/QlTUIDaeK5JcfktoEjG+f7/qD3Uh8DirtCXBGmZIGUH+x661drDFs5qzIZk
 zXmmbXFIuP04dvh6F9QPovqobvOJLKEVRK0FRcXA14kmHxYgkBKCmrUFALOXjwFE0vfB
 rMu0aB4IFctlACz85HVGb/bTuINjz1CeMNtjSNeNrx0AfFDHJEdIfPDlF5jy4vb1e1N5
 sCURzmmPgc/RWvMTa9WT9MytHaNp7i3s8Ii+vWxAosgW6AQ3xiTW9egcmU6gle/0xtWt
 BYhbbA/bOjqNbvDcBYZJikEstugJwbmHT1yxpNe8JIRlS0Ty2+GWWkE2uLsyYTzBT4wJ
 ptZw==
X-Gm-Message-State: AC+VfDxSGSb06SJY3nSdyDYQyU0wfAsky3wkfP957zyDFFClqDVUBE9V
 WAfmR8ZItB1dsih9Y2z4eW3/CximCdM=
X-Google-Smtp-Source: ACHHUZ4U4vYTLGSwyzZ/pqw0XGQb3y4tdJHCTgknHAhGZ9WJuD/h5DwArGSedArf2XAFkNZsKEHYKw==
X-Received: by 2002:a05:600c:3c86:b0:3f5:f543:d81f with SMTP id
 bg6-20020a05600c3c8600b003f5f543d81fmr15506293wmb.3.1685039628298; 
 Thu, 25 May 2023 11:33:48 -0700 (PDT)
Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id
 c12-20020a7bc84c000000b003f3e50eb606sm2881106wml.13.2023.05.25.11.33.47
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 25 May 2023 11:33:48 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#62264] [PATCH core-updates 0/6] Add `guix index` subcommand
In-Reply-To: <87lehdkd1u.fsf@HIDDEN>
References: <87v8iy59j1.fsf@HIDDEN> <87cz4mt0ao.fsf@HIDDEN>
 <87jzx1tl34.fsf_-_@HIDDEN> <87edn8xq7c.fsf@HIDDEN>
 <87lehdkd1u.fsf@HIDDEN>
Date: Thu, 25 May 2023 18:20:11 +0200
Message-ID: <877cswwfgk.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62264
Cc: "Antoine R. Dumont \(@ardumont\)" <antoine.romain.dumont@HIDDEN>,
 62264 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Ludo,

On mer., 24 mai 2023 at 16:40, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

>> Well, I have some patches that rename to =E2=80=9Cguix file=E2=80=9D. :-)
>>
>> Well, =E2=80=99guix locale=E2=80=99 appears to me also fine.

I was meaning =E2=80=99locate=E2=80=99 not =E2=80=99locale=E2=80=99, sorry =
for the typo.

> =E2=80=9Clocate=E2=80=9D sounds better to me, notably because it=E2=80=99=
s a verb.

Yeah, =E2=80=99locate=E2=80=99 is better.  Especially when one knows about =
the good ol=E2=80=99
locate program. ;-)


>>>   - [ ] 'search' action removed; option added to force reindexing
>>
>> I have an unpolished stuff that do:
>>
>>     guix file --index=3DTYPE
>>     guix file foo bar
>>
>> Somehow, =E2=80=9Cguix file <terms>=E2=80=9D the default action (=3D sea=
rch).  And then
>> some action with --action (as index or else).
>>
>>>   - [ ] warning printed when database is too old
>>>   - [ ] start anew when database is very old
>>>   - [ ] documentation written
>>
>> I have started=E2=80=A6 but I am not very far. :-)
>
> Could you share what you have?

I will.  Do you prefer a patch?  Or that I push to the branch?


> (I didn=E2=80=99t expect feedback so I thought I=E2=80=99d end up hack on=
 the stuff
> head-down.  Now we need to synchronize.  :-))

There is much to synchronize because I did few. :-)

My concerns were:

 1. about the name =E2=80=9Cguix index=E2=80=9D and now it=E2=80=99s fixed =
by =E2=80=9Cguix locate=E2=80=9D ;-)

 and 2. about the CLI; the default =E2=80=9Cguix locate <term>=E2=80=9D sho=
uld be the
 search action.  The update action should be triggered with an option as
 =E2=80=9C-i/--index=3D=E2=80=9D.


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.

Message received at 62264 <at> debbugs.gnu.org:


Received: (at 62264) by debbugs.gnu.org; 24 May 2023 14:40:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 24 10:40:57 2023
Received: from localhost ([127.0.0.1]:44314 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q1pfd-0003m7-Ft
	for submit <at> debbugs.gnu.org; Wed, 24 May 2023 10:40:57 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37200)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1q1pfa-0003lq-OS
 for 62264 <at> debbugs.gnu.org; Wed, 24 May 2023 10:40:55 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1q1pfV-0000KP-7c; Wed, 24 May 2023 10:40:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=Mmw3iLFHYh0vlE2QGQEHPQ1KUbjgcFP6IufBWFpEAlc=; b=CumhlciN0aMGSQZoIEkL
 /oc3T7Ooye6L821WGMwhNSPjB9jt0JCgMerxWrx9Njs9HG4QTgRAYRe7trCm9fi4f5ql2ypnoyNS6
 m8hwK+w6GpUDqNqFaWv/wLz7A9YEbbG87W1rN/5Mb7Fp0FFmMRcHqkcVT2j6/tArmn7DTsrCa7tPk
 RDFhqpATlKnDggJ8HknupS35JgylUTu0zbdIV82nvPeu9CcU6+nJHkNu770zA1ggNemAq3QYi+FPo
 xbcde10Lz6Oa1G9DzQJJ1oEexQFkfCOJo3aP0X2UCscdG6J8SktLpB7P2CgcAHsx8BxhXpXWzWgc/
 lC+42lh9tR0CWA==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1q1pfT-0001Hx-Bi; Wed, 24 May 2023 10:40:48 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Simon Tournier <zimon.toutoune@HIDDEN>
Subject: Re: [bug#62264] [PATCH core-updates 0/6] Add `guix index` subcommand
References: <87v8iy59j1.fsf@HIDDEN> <87cz4mt0ao.fsf@HIDDEN>
 <87jzx1tl34.fsf_-_@HIDDEN> <87edn8xq7c.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Quintidi 5 Prairial an 231 de la =?utf-8?Q?R=C3=A9vo?=
 =?utf-8?Q?lution=2C?= jour du Canard
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Wed, 24 May 2023 16:40:45 +0200
In-Reply-To: <87edn8xq7c.fsf@HIDDEN> (Simon Tournier's message of "Mon, 22
 May 2023 18:53:43 +0200")
Message-ID: <87lehdkd1u.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62264
Cc: "Antoine R. Dumont \(@ardumont\)" <antoine.romain.dumont@HIDDEN>,
 62264 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Simon Tournier <zimon.toutoune@HIDDEN> skribis:

> On dim., 21 mai 2023 at 23:45, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:
>
>>   - [ ] 'guix index' renamed to 'guix locate'
>
> Well, I have some patches that rename to =E2=80=9Cguix file=E2=80=9D. :-)
>
> Well, =E2=80=99guix locale=E2=80=99 appears to me also fine.=20

=E2=80=9Clocate=E2=80=9D sounds better to me, notably because it=E2=80=99s =
a verb.

>>   - [ ] 'search' action removed; option added to force reindexing
>
> I have an unpolished stuff that do:
>
>     guix file --index=3DTYPE
>     guix file foo bar
>
> Somehow, =E2=80=9Cguix file <terms>=E2=80=9D the default action (=3D sear=
ch).  And then
> some action with --action (as index or else).
>
>>   - [ ] warning printed when database is too old
>>   - [ ] start anew when database is very old
>>   - [ ] documentation written
>
> I have started=E2=80=A6 but I am not very far. :-)

Could you share what you have?

(I didn=E2=80=99t expect feedback so I thought I=E2=80=99d end up hack on t=
he stuff
head-down.  Now we need to synchronize.  :-))

>>   - [ ] '--help' output made more concise
>
> Maybe also remove some =E2=80=9Cdebug=E2=80=9D code, no?

Done already.

Thanks!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.

Message received at 62264 <at> debbugs.gnu.org:


Received: (at 62264) by debbugs.gnu.org; 22 May 2023 17:02:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 22 13:02:24 2023
Received: from localhost ([127.0.0.1]:36140 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q18vQ-0001lJ-8U
	for submit <at> debbugs.gnu.org; Mon, 22 May 2023 13:02:24 -0400
Received: from mail-wr1-f45.google.com ([209.85.221.45]:38134)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1q18vO-0001kt-5g
 for 62264 <at> debbugs.gnu.org; Mon, 22 May 2023 13:02:23 -0400
Received: by mail-wr1-f45.google.com with SMTP id
 ffacd0b85a97d-3093bf6614dso711039f8f.0
 for <62264 <at> debbugs.gnu.org>; Mon, 22 May 2023 10:02:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684774936; x=1687366936;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=s9KjaX891qG8SQVyn3z0w+QrYkt4EkkbetjD9i80auk=;
 b=k2SrOGNPLpVnO8xR2BskcAHq82XPZ51Bgf4s8KMxEUp9CskOaMJ84qycrGi91/QE7s
 oxIWjKxGCITi/zesqowgv/3zVTYT3XFMD568vFXT0TAyJU3T9NnyXQxZeF5MqKh6pAkY
 rOYmcdp/yGzaMPETc+Mn+lXtQfRiAjYnmzkeJ5uePClz+x9ck4n4bO9lltgXko1kVaih
 QVqh4quCnvgs7ErqYhdbd4NNTuPRVK/biuzTT+eQR6relnYMLV2+WezyS7To5PiXaj5L
 vKJA+RSZGlQEBbFeZYd52wgQyd8iRFNuhtqfN1WuYm0FZ7cm5qYGI+xuEkyUxOIs3thV
 jymA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684774936; x=1687366936;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=s9KjaX891qG8SQVyn3z0w+QrYkt4EkkbetjD9i80auk=;
 b=eHtfNWCWYjewVN30hp5Z8jK12AfTRHtmz4fgAIobF6dSyeUyAZsA66ut6LjoKWJbPc
 l/q5mwfEVjIKO6G6Ci8gOBQUJYgLm37N37426yL4OtRXg7KMGf1Ji2Z/zEFycfGG0PWu
 PX6WpJTiTYVHHHWEo0A03bjMoyuoKH/fcAfU4jZUWhRDWDt3OhOM0uWvrSQt6pfUOtEh
 q2ReWiKwU3uPHOkc778taMnZdZWX0VYp0EYBThlCs9Es4pw+/v9Fae+OJCCFurp+F6CY
 fBUeMVtC4tv+UsTks4gNPLnf2yHhefevx7V4kP2TbO189ZO91Tc3wff7vLS2tVatFGiI
 gBdw==
X-Gm-Message-State: AC+VfDzzDM+IWnd8JdkTG0l8hsSThQDjsOImccqte5XFNXwIxBrV+M6d
 gSp9eC8rw5bD728RMXk+0FLBMxvOZyk=
X-Google-Smtp-Source: ACHHUZ6SVsrO3r5nRmz4kBHTzH163eSWMnkDIJs+K3nqu0AwdNnfl/cYHtRJO1ihCvMyJk743Pazfw==
X-Received: by 2002:a5d:595f:0:b0:306:c011:d563 with SMTP id
 e31-20020a5d595f000000b00306c011d563mr6816860wri.3.1684774936359; 
 Mon, 22 May 2023 10:02:16 -0700 (PDT)
Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id
 c11-20020a5d4ccb000000b0030631dcbea6sm8233825wrt.77.2023.05.22.10.02.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 22 May 2023 10:02:16 -0700 (PDT)
From: Simon Tournier <zimon.toutoune@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, "Antoine R. Dumont
 (@ardumont)" <antoine.romain.dumont@HIDDEN>
Subject: Re: [bug#62264] [PATCH core-updates 0/6] Add `guix index` subcommand
In-Reply-To: <87jzx1tl34.fsf_-_@HIDDEN>
References: <87v8iy59j1.fsf@HIDDEN> <87cz4mt0ao.fsf@HIDDEN>
 <87jzx1tl34.fsf_-_@HIDDEN>
Date: Mon, 22 May 2023 18:53:43 +0200
Message-ID: <87edn8xq7c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62264
Cc: 62264 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

On dim., 21 mai 2023 at 23:45, Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:

>   - [ ] 'guix index' renamed to 'guix locate'

Well, I have some patches that rename to =E2=80=9Cguix file=E2=80=9D. :-)

Well, =E2=80=99guix locale=E2=80=99 appears to me also fine.=20

>   - [ ] 'search' action removed; option added to force reindexing

I have an unpolished stuff that do:

    guix file --index=3DTYPE
    guix file foo bar

Somehow, =E2=80=9Cguix file <terms>=E2=80=9D the default action (=3D search=
).  And then
some action with --action (as index or else).

>   - [ ] warning printed when database is too old
>   - [ ] start anew when database is very old
>   - [ ] documentation written

I have started=E2=80=A6 but I am not very far. :-)

>   - [ ] '--help' output made more concise

Maybe also remove some =E2=80=9Cdebug=E2=80=9D code, no?


Cheers,
simon






Information forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.

Message received at 62264 <at> debbugs.gnu.org:


Received: (at 62264) by debbugs.gnu.org; 21 May 2023 21:45:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 21 17:45:46 2023
Received: from localhost ([127.0.0.1]:32943 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q0qs5-0001tk-Sg
	for submit <at> debbugs.gnu.org; Sun, 21 May 2023 17:45:46 -0400
Received: from eggs.gnu.org ([209.51.188.92]:35660)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1q0qs3-0001tV-Ly
 for 62264 <at> debbugs.gnu.org; Sun, 21 May 2023 17:45:44 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1q0qrx-0005lA-N5; Sun, 21 May 2023 17:45:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=JU3EFNZM1W+BUypf+VtmZpoJtcxgIyIeKOsZRaCGM+A=; b=hL3VxeI8Vzd6Q4loX6gW
 5yVc7La/rMP+qbfN6N44n9Y29Z2/ama1t/NFEuvKWpOIBe0fYguifikZs6BU1sneDjaze4GkqsAnZ
 lgzXkHRjI8+oeJrPtGwSDYkmCNpH1zE54y2tEB/c48398/1r3zS31k12sY8Zq8v4fdSvxE7fSu9Px
 oRphhE+M/OJDgF9Qjw4tF5UQMkBy15TW6IETH4LfToBmdw65uXDeZBjTX8LqrtPrpUMF47X5vFRm3
 kWNfZDXV5Os639Nxx4MXVY9kakxbzflP568zJ6ewE1/b80sMCRoV8jdIJMoAJvM8whvuE3qcNaKnz
 qKehqOmTKTrvmA==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1q0qrx-0002pV-5S; Sun, 21 May 2023 17:45:37 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Subject: Re: bug#62264: [PATCH core-updates 0/6] Add `guix index` subcommand
References: <87v8iy59j1.fsf@HIDDEN> <87cz4mt0ao.fsf@HIDDEN>
Date: Sun, 21 May 2023 23:45:35 +0200
In-Reply-To: <87cz4mt0ao.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Sun, 02 Apr 2023 23:57:19 +0200")
Message-ID: <87jzx1tl34.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62264
Cc: 62264 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello!

Ludovic Court=C3=A8s <ludo@HIDDEN> skribis:

> I squashed the =E2=80=98guix index=E2=80=99 patches you posted, followed =
up with
> individual changes on top of that (those will have to be squashed
> eventually), and pushed the result in the =E2=80=98wip-guix-index=E2=80=
=99 branch.
> Lemme know what you think!

I=E2=80=99ve pushed additional changes.  There are a few more things I=E2=
=80=99d like to
do before we can merge it:

  - [ ] 'guix index' renamed to 'guix locate'
  - [ ] 'search' action removed; option added to force reindexing
  - [ ] warning printed when database is too old
  - [ ] start anew when database is very old
  - [ ] documentation written
  - [ ] '--help' output made more concise

We can think about fetching databases in a second iteration.

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.

Message received at 62264 <at> debbugs.gnu.org:


Received: (at 62264) by debbugs.gnu.org; 2 Apr 2023 21:57:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 02 17:57:32 2023
Received: from localhost ([127.0.0.1]:42886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pj5hc-0004Fv-Ih
	for submit <at> debbugs.gnu.org; Sun, 02 Apr 2023 17:57:32 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37714)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1pj5hZ-0004Ff-Qu
 for 62264 <at> debbugs.gnu.org; Sun, 02 Apr 2023 17:57:31 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pj5hT-00030a-TO; Sun, 02 Apr 2023 17:57:23 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=GZ3yhg0KY7Wt/nVscspZSBESvAyw+6jcmXecajN0L5g=; b=CWhdcB2Vbc4CDJcfGNUy
 6VOVHcuLri9X2cobEoyroBbqV3LLoSrIWpnmOwMAGsTbA3nKQpFORX1QL2In2NlgPG/RQvhGRm0TT
 51OcROiOASh5QtMmNK1rzWPMBZtqPa6Ga7ee5gTCN8M7tKDjgHIR47fR1ZM/ruOhLEpxezQzpEbzQ
 XlVJtV7wHtD1OPbXph0Pgu5kWN8KL73XzVzm6vJNHywzNqBfCG2yZ+2X23t2Q88IZ4UGKDaC3IWKz
 krWcFRSd+F/SJcdiNVNq4cLFA2N7Fw2G7VQR+8HkR3qdCaybquW0sCam/5S68PimkWCmKAK309erN
 b8wuyWyPGtafnA==;
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1pj5hT-0008VA-2L; Sun, 02 Apr 2023 17:57:23 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Subject: Re: bug#62264: [PATCH core-updates 0/6] Add `guix index` subcommand
References: <87v8iy59j1.fsf@HIDDEN>
Date: Sun, 02 Apr 2023 23:57:19 +0200
In-Reply-To: <87v8iy59j1.fsf@HIDDEN> (Antoine R. Dumont's message of "Sat, 
 18 Mar 2023 17:06:26 +0100")
Message-ID: <87cz4mt0ao.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62264
Cc: 62264 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Antoine,

"Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
skribis:

> Example of an indexation (fast method by default):
>
> $ guix index
> Registering 133 packages  =E2=96=95=E2=96=88=E2=96=88=E2=96=88=E2=96=88=
=E2=96=88=E2=96=8E                                             =E2=96=8F
>
>
> Example of a search:
>
> $ guix index search sqlite3
> sqlite@HIDDEN        /gnu/store/jd6nn2c8ln5flv4vwl7pp1w804w2i9wj-sqlite-3=
.37.0/bin/sqlite3
> sqlite@HIDDEN        /gnu/store/xmzx5mzv4863yw9kmr2ykndgp37p8if0-sqlite-3=
.36.0/bin/sqlite3

This is really nice!  I finally got around to looking at the patches.
The final version will be a single patch that adds code, tests, and
documentation.

I squashed the =E2=80=98guix index=E2=80=99 patches you posted, followed up=
 with
individual changes on top of that (those will have to be squashed
eventually), and pushed the result in the =E2=80=98wip-guix-index=E2=80=99 =
branch.
Lemme know what you think!

Good news is =E2=80=9Cmake check TESTS=3Dtests/guix-index.sh=E2=80=9D passe=
s.  I disabled
tests for the =E2=80=98store=E2=80=99 method by default because it=E2=80=99=
s too expensive (it
would take several minutes with my SSD).

There were other things I wanted to fiddle with but I ran out of time
:-) so I=E2=80=99ll take another look later.

The main missing bit is a new node in the manual documenting it.

Perhaps one feature that would be nice to have before we publish is
pruning of database entries, so it doesn=E2=80=99t grow endlessly, but I=E2=
=80=99m not
sure how to do that (based on whether a Directory entry actually
exists?).

Thanks!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.

Message received at 62264 <at> debbugs.gnu.org:


Received: (at 62264) by debbugs.gnu.org; 19 Mar 2023 07:23:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 19 03:23:19 2023
Received: from localhost ([127.0.0.1]:49346 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdnNr-0007pW-HG
	for submit <at> debbugs.gnu.org; Sun, 19 Mar 2023 03:23:19 -0400
Received: from mail-wr1-f53.google.com ([209.85.221.53]:33647)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <antoine.romain.dumont@HIDDEN>) id 1pdZrq-00018d-UY
 for 62264 <at> debbugs.gnu.org; Sat, 18 Mar 2023 12:57:21 -0400
Received: by mail-wr1-f53.google.com with SMTP id v16so6933989wrn.0
 for <62264 <at> debbugs.gnu.org>; Sat, 18 Mar 2023 09:57:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679158633;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=+MfSBmJumN+Gt5dgrP/tu2tQ85C211ITTdvats+OcBQ=;
 b=TEw/rJIhNFrFbJ0yFRqPRyfb+uXk+CSt4wm3I7OV2z29BNSU/hhBQgQ4rFmmVK1KTN
 tq9XneEylHsFVMImQSI4Kx+N46+jav2tSkCPU+r/7Q4S2mRNW2+ci6LEdi23WjqNtXgD
 2T2hVcgagVkE6yFmQt0oeCjW3gd17yDgXklXBdzglepkvcd/in4p9RG2kc0qM72Q/zob
 bTq28SFYdWGG0yWLvc6SAoujZ3jrCnPtKk1cJHaeJqA35IuAR0+G9DOulgNhs+IBttAC
 ESt9WVWILrvOWFlBQoq5s4KVjiEg94Lzz2ZswCzNyNyozBTzNQeY6Qkkoy0vcIBYKK/0
 YffA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679158633;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=+MfSBmJumN+Gt5dgrP/tu2tQ85C211ITTdvats+OcBQ=;
 b=szDtybyKuivrIDV1s8kShayFrpREaJJiPBpb0qN2Y7fU3mG1jysJ0kzOjttdgnkOGi
 mUoN5oJ3zvbL7F690z92RGkECIIXl2xKPixSTHxjzF6wlciG8R59gNm1+rhCA6uo6Abb
 0AsCv5pxS84Vo0EyMKxPiKhSpVg6lI1Qnfz+qZoVF0wG00/3TVzLA1WQmoPDoHE5CYKw
 mKdu6NSZX/XqaSPsU0sR1UC1Ucptwb4IEnUBXape8PmZnAJ7lbUjGDI7zMkyFZ9kjTw3
 A5poVu5McJ+nIvFvNE7PSQneWfjSOeZ5A7x9q5PjyMeyhv4MOmIvrfhqj9+YUKxduYjd
 8dQg==
X-Gm-Message-State: AO0yUKVxIv3vslCHBf8xM8uLBNffWbVLEnexoR1a1l1Ar23ZmxlAs7NF
 V24+IH7cxe56kX9R3Qx8x9mdfxfh190=
X-Google-Smtp-Source: AK7set8/gTMWx36DlBf/SVjc+pyXbthjRzGhdQA4o4D1ObBlLMhP0eYjRjEt6C3cagM4ILtSm+gQxg==
X-Received: by 2002:a5d:410e:0:b0:2cf:ee28:5024 with SMTP id
 l14-20020a5d410e000000b002cfee285024mr9345465wrp.42.1679158632582; 
 Sat, 18 Mar 2023 09:57:12 -0700 (PDT)
Received: from yavin4 ([2a01:e0a:1c8:8a40:52d2:ac70:415c:2470])
 by smtp.gmail.com with ESMTPSA id
 n17-20020adff091000000b002c5534db60bsm4741129wro.71.2023.03.18.09.57.11
 for <62264 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 09:57:11 -0700 (PDT)
From: "Antoine R. Dumont" <antoine.romain.dumont@HIDDEN>
To: 62264 <at> debbugs.gnu.org
Subject: [PATCH core-updates 1-6/6] Add `guix index` subcommand
Date: Sat, 18 Mar 2023 17:57:10 +0100
Message-ID: <87r0tm576h.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62264
X-Mailman-Approved-At: Sun, 19 Mar 2023 03:23:14 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain

Hello again,

please find enclosed the remaining patches holding the actual guix
subcommand as described in the introductory email.

Cheers,
--
tony / Antoine R. Dumont (@ardumont)

-----------------------------------------------------------------
gpg fingerprint BF00 203D 741A C9D5 46A8 BE07 52E2 E984 0D10 C3B8

--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline;
 filename=0001-index-Add-initial-implementation-from-civodul.patch
Content-Transfer-Encoding: quoted-printable

From=20869d8b4cc7cefb6d7dbe9cd1374242bf6d7c953d Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?Ludovic=3D20Court=3DC3=3DA8s?=3D <ludo@HIDDEN>
Date: Wed, 30 Nov 2022 15:25:21 +0100
Subject: [PATCH core-updates 1/6] index: Add initial implementation from
 civodul

Related to https://lists.gnu.org/archive/html/guix-devel/2022-01/msg00354.h=
tml
=2D--
 guix/extensions/index.scm | 574 ++++++++++++++++++++++++++++++++++++++
 guix/scripts/home.scm     |   2 +-
 2 files changed, 575 insertions(+), 1 deletion(-)
 create mode 100644 guix/extensions/index.scm

diff --git a/guix/extensions/index.scm b/guix/extensions/index.scm
new file mode 100644
index 0000000000..d9894b213e
=2D-- /dev/null
+++ b/guix/extensions/index.scm
@@ -0,0 +1,574 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =C2=A9 2022 Ludovic Court=C3=A8s <ludo@HIDDEN>
+;;;
+;;; 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 extensions index)
+  #:use-module ((guix i18n) #:select (G_))
+  #:use-module ((guix ui) #:select (show-version-and-exit
+                                    show-bug-report-information
+                                    with-error-handling
+                                    string->number*))
+  #:use-module (guix scripts)
+  #:use-module (sqlite3)
+  #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
+  #:use-module (ice-9 getopt-long)
+  #:use-module (guix describe)
+  #: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)
+  #:use-module ((guix progress) #:select (progress-reporter/bar
+                                          call-with-progress-reporter))
+  #:use-module (guix sets)
+  #:use-module ((guix utils) #:select (cache-directory))
+  #:autoload   (guix build utils) (find-files)
+  #:autoload   (gnu packages) (fold-packages)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-37)  ;; option
+  #:use-module (srfi srfi-71)
+  #:export     (guix-index))
+
+(define debug #f)
+
+(define application-version 2)
+
+;; 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,
+  unique (version)
+);
+
+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);")
+
+;; List of tuple ((version . sqlite schema migration script)). There shoul=
d be
+;; as much version increments as step needed to migrate the db.
+(define schema-to-migrate '((1 . "
+create table if not exists SchemaVersion (
+  version integer primary key not null,
+  unique (version)
+);
+")
+                            (2 . "
+alter table SchemaVersion
+add column date date;
+")))
+
+(define (call-with-database file proc)
+  (let ((db (sqlite-open file)))
+    (dynamic-wind
+      (lambda () #t)
+      (lambda () (proc db))
+      (lambda () (sqlite-close db)))))
+
+(define (insert-version db version)
+  "Insert application VERSION into the DB."
+  (define stmt-insert-version
+    (sqlite-prepare db "\
+INSERT OR IGNORE INTO SchemaVersion(version, date)
+VALUES (:version, CURRENT_TIMESTAMP);"
+                    #:cache? #t))
+  (sqlite-exec db "begin immediate;")
+  (sqlite-bind-arguments stmt-insert-version #:version version)
+  (sqlite-fold (const #t) #t stmt-insert-version)
+  (sqlite-exec db "commit;"))
+
+(define (read-version db)
+  "Read the current application version from the DB."
+
+  (define stmt-select-version (sqlite-prepare db "\
+SELECT version FROM SchemaVersion ORDER BY version DESC LIMIT 1;"
+                                              #:cache? #f))
+  (match (sqlite-fold cons '() stmt-select-version)
+    ((#(version))
+     version)))
+
+(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 writ=
es
+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 sing=
leton.
+                                  (unless (string=3D? file directory)
+                                    (sqlite-reset stmt-insert-file)
+                                    (sqlite-bind-arguments stmt-insert-file
+                                                           #:name (strip f=
ile)
+                                                           #:basename
+                                                           (basename file)
+                                                           #:directory
+                                                           directory-id)
+                                    (sqlite-fold (const #t) #t stmt-insert=
-file)))
+                                (find-files directory)))))
+                 directories)))
+    (sqlite-exec db "commit;"))
+
+
+;;;
+;;; Indexing from local packages.
+;;;
+
+(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 (insert-packages-with-progress db packages insert-package-fn)
+  "Insert PACKAGES into DB with progress bar report."
+  (let* ((nb-packages (length packages))
+         (prefix      (format #f "Registering ~a packages" nb-packages))
+         (progress    (progress-reporter/bar nb-packages prefix)))
+    (call-with-progress-reporter progress
+      (lambda (report)
+        (for-each (lambda (package)
+                    (insert-package-fn db package)
+                    (report))
+                  packages)))))
+
+
+;;;
+;;; Indexing from local profiles.
+;;;
+
+(define (all-profiles)
+  "Return the list of system profiles."
+  (delete-duplicates
+   (filter-map (lambda (root)
+                 (if (file-exists? (string-append root "/manifest"))
+                     root
+                     (let ((root (string-append root "/profile")))
+                       (and (file-exists? (string-append root "/manifest"))
+                            root))))
+               (gc-roots))))
+
+(define (profiles->manifest-entries profiles)
+  "Return deduplicated manifest entries across all PROFILES."
+  (let loop ((visited (set))
+             (profiles profiles)
+             (entries '()))
+    (match profiles
+      (()
+       entries)
+      ((profile . rest)
+       (let* ((manifest (profile-manifest profile))
+              (entries visited
+                       (fold2 (lambda (entry lst visited)
+                                (let ((item (manifest-entry-item entry)))
+                                  (if (set-contains? visited item)
+                                      (values lst visited)
+                                      (values (cons entry lst)
+                                              (set-insert item
+                                                          visited)))))
+                              entries
+                              visited
+                              (manifest-transitive-entries manifest))))
+         (loop visited rest entries))))))
+
+(define (insert-manifest-entry db entry)
+  "Insert a manifest ENTRY into DB."
+  (insert-files db (manifest-entry-name entry)
+                (manifest-entry-version entry)
+                (list (manifest-entry-item entry)))) ;FIXME: outputs?
+
+(define (index-packages-from-manifests-with-db db-pathname)
+  "Index packages entries into DB-PATHNAME from the system manifests."
+  (call-with-database db-pathname
+    (lambda (db)
+      (let ((entries (profiles->manifest-entries (all-profiles))))
+        (insert-packages-with-progress db entries insert-manifest-entry)))=
))
+
+
+;;;
+;;; Search.
+;;;
+
+(define-record-type <package-match>
+  (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 <package-match> 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))
+
+
+
+;;;
+;;; CLI
+;;;
+
+(define (index-packages-from-store-with-db db-pathname)
+  "Index local store packages using db at location DB-PATHNAME."
+  (call-with-database db-pathname
+    (lambda (db)
+      (with-store store
+        (parameterize ((%graft? #f))
+          (define (insert-package-from-store db package)
+            (run-with-store store (insert-package db package)))
+          (let ((packages (fold-packages
+                           cons
+                           '()
+                           #:select? (lambda (package)
+                                       (and (not (hidden-package? package))
+                                            (not (package-superseded packa=
ge))
+                                            (supported-package? package)))=
)))
+            (insert-packages-with-progress
+             db packages insert-package-from-store))))
+      (index-packages-from-store db))))
+
+(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 (read-version-from-db db-pathname)
+  (call-with-database db-pathname
+    (lambda (db) (read-version db))))
+
+(define (migrate-schema-to-version db-pathname)
+  (call-with-database db-pathname
+    (lambda (db)
+      (catch #t
+        (lambda ()
+          ;; Migrate from the current version to the full migrated schema
+          ;; This can raise sqlite-error if the db is not properly configu=
red yet
+          (let* ((current-db-version (read-version db))
+                 (next-db-version (+ 1 current-db-version)))
+            (when (< current-db-version application-version)
+              ;; when the current db version is older than the current app=
lication
+              (let ((schema-migration-at-version (assoc-ref schema-to-migr=
ate next-db-version)))
+                (when schema-migration-at-version
+                  ;; migrate the schema to the next version (if it exists)
+                  (sqlite-exec db schema-migration-at-version)
+                  ;; insert current version
+                  (insert-version db next-db-version)
+                  ;; iterate over the next migration if any
+                  (migrate-schema-to-version db))))))
+        (lambda (key . arg)
+          ;; exception handler in case failure to read an inexisting db
+          ;; Fallback to boostrap the schema
+          (sqlite-exec db schema-full)
+          (insert-version db application-version))))))
+
+(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
+  (string-append (cache-directory #:ensure? #f)
+                 "/index/db.sqlite"))
+
+(define (show-help)
+  (display (G_ "Usage: guix index [OPTIONS...] [search FILE...]
+Without argument, indexes (package, file) relationships from the machine.
+This allows indexation with 2 methods, out of the local:
+
+- manifests: This is the fastest implementation with the caveat of indexing
+less packages. That'd be typically the use case of user local indexation.
+
+- store: This is slowest implementation. It discusses with the store
+daemon. That'd be typically the use case of building the largest db in one=
 of
+the build farm node.
+
+With 'search FILE', search for packages installing FILE.\n
+Note: Internal cache is located at ~/.cache/guix/index/db.sqlite by defaul=
t.
+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)
+  (display (G_ "
+  --method=3DMETH       Change default indexation method. By default it us=
es the
+                      local \"manifests\" (faster). It can also uses the l=
ocal
+                      \"store\" (slower, typically on the farm build ci)."=
))
+  (newline)
+  (display (G_ "The valid values for ARGS are:"))
+  (newline)
+  (display (G_ "
+  search FILE     Search for packages installing the FILE (from cache db)"=
))
+  (newline)
+  (display (G_ "
+  <EMPTY>         Without any argument, it index packages. This fills in t=
he
+                  db cache using whatever indexation method is defined."))
+  (show-bug-report-information))
+
+(define %options
+  (list
+   (option '(#\h "help") #f #f
+           (lambda args (show-help) (exit 0)))
+   (option '(#\V "version") #f #f
+           (lambda (opt name arg result)
+             (catch 'sqlite-error
+               (lambda ()
+                 (let ((db-path (assoc-ref result 'db-path)))
+                   (simple-format
+                    #t
+                    "Extension local cache database:\n- path: ~a\n- versio=
n: ~a\n\n"
+                    db-path (read-version-from-db db-path))))
+               (lambda (key . arg) 'no-db-yet-so-nothing-to-display))
+             (show-version-and-exit "guix index")))
+   ;; index data out of the method (store or package)
+   (option '(#\d "db-path") #f #t
+           (lambda (opt name arg result)
+             (when debug
+               (format #t "%options: --db-path: opt ~a\n" opt)
+               (format #t "%options: --db-path: name ~a\n" name)
+               (format #t "%options: --db-path: arg ~a\n" arg)
+               (format #t "%options: --db-path: result ~a\n" result))
+             (alist-cons 'db-path arg
+                         (alist-delete 'db-path result))))
+
+   ;; index data out of the method (store or package)
+   (option '(#\m "method") #f #t
+           (lambda (opt name arg result)
+             (when debug
+               (format #t "%options: --method: opt ~a\n" opt)
+               (format #t "%options: --method: name ~a\n" name)
+               (format #t "%options: --method: arg ~a\n" arg)
+               (format #t "%options: --method: result ~a\n" result))
+             (match arg
+               ((or "manifests" "store")
+                (alist-cons 'with-method arg
+                            (alist-delete 'with-method result)))
+               (_
+                (G_ "guix index: Wrong indexation method, either manifests
+ (fast) or store (slow)~%")))))))
+
+(define %default-options
+  `((db-path . ,default-db-path)
+    (with-method . "manifests")))
+
+(define-command (guix-index . args)
+  (category extension)
+  (synopsis "Index packages to search package for a given filename")
+
+  (define (parse-sub-command arg result)
+    ;; Parse sub-command ARG and augment RESULT accordingly.
+    (when debug
+      (format #t "parse-sub-command: arg: ~a\n" arg)
+      (format #t "parse-sub-command: result: ~a\n" result)
+      (format #t "parse-sub-command: (assoc-ref result 'action): ~a\n" (as=
soc-ref result 'action))
+      (format #t "parse-sub-command: (assoc-ref result 'argument): ~a\n" (=
assoc-ref result 'argument)))
+    (if (assoc-ref result 'action)
+        (alist-cons 'argument arg result)
+        (let ((action (string->symbol arg)))
+          (case action
+            ((search)
+             (alist-cons 'action action result))
+            (else (leave (G_ "~a: unknown action~%") action))))))
+
+  (define (match-pair car)
+    ;; Return a procedure that matches a pair with CAR.
+    (match-lambda
+      ((head . tail)
+       (and (eq? car head) tail))
+      (_ #f)))
+
+  (define (option-arguments opts)
+    ;; Extract the plain arguments from OPTS.
+    (let* ((args   (reverse (filter-map (match-pair 'argument) opts)))
+           (count  (length args))
+           (action (or (assoc-ref opts 'action) 'index)))
+
+      (when debug
+        (format #t "option-arguments: args: ~a\n" args)
+        (format #t "option-arguments: count: ~a\n" count)
+        (format #t "option-arguments: action: ~a\n" action))
+
+      (define (fail)
+        (leave (G_ "wrong number of arguments for action '~a'~%")
+               action))
+
+      (unless action
+        (format (current-error-port)
+                (G_ "guix index: missing command name~%"))
+        (format (current-error-port)
+                (G_ "Try 'guix index --help' for more information.~%"))
+        (exit 1))
+      (alist-cons 'argument (string-concatenate args)
+                  (alist-delete 'argument
+                                (alist-cons 'action action
+                                            (alist-delete 'action opts))))=
))
+
+  (with-error-handling
+    (let* ((opts        (parse-command-line args %options
+                                            (list %default-options)
+                                            #:argument-handler
+                                            parse-sub-command))
+           (args        (option-arguments opts))
+           (action      (assoc-ref args 'action))
+           (db-path     (assoc-ref args 'db-path))
+           (with-method (assoc-ref args 'with-method)))
+      (when debug
+        (format #t "main: opts: ~a\n" opts)
+        (format #t "main: args: ~a\n" args)
+        (format #t "main: action: ~a\n" action)
+        (format #t "main: db-path: ~a\n" db-path)
+        (format #t "main: with-method: ~a\n" with-method))
+
+      (match action
+        ('search
+         (unless (file-exists? db-path)
+           (format (current-error-port)
+                   (G_ "guix index: The local cache db does not exist yet.
+You need to index packages first.\nTry 'guix index --help' for more inform=
ation.~%"))
+           (exit 1))
+         (let* ((file (assoc-ref args 'argument))
+                (matches (matching-packages-with-db db-path file)))
+           (print-matching-results matches)
+           (exit (pair? matches))))
+        ('index
+         (let ((db-dirpath (dirname db-path)))
+           (unless (file-exists? db-dirpath)
+             (mkdir db-dirpath)))
+         ;; Migrate/initialize db to schema at version application-version
+         (migrate-schema-to-version db-path)
+         ;; Finally index packages
+         (if (string=3D with-method "manifests")
+             (index-packages-from-manifests-with-db db-path)
+             (index-packages-from-store-with-db db-path)))))))
diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index 8ff8182a79..9a6ddae271 100644
=2D-- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -69,7 +69,7 @@ (define-module (guix scripts home)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-35)
=2D  #:use-module (srfi srfi-37)
+  #:use-module ((srfi srfi-37) #:select (option))
   #:use-module (srfi srfi-71)
   #:use-module (ice-9 match)
   #:export (guix-home))
=2D-=20
2.36.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0002-scripts-index-Transform-guix-index-extension-into-a-.patch
Content-Transfer-Encoding: quoted-printable

From=20434b27de6227f5077505c1a1688a6ae500bbe56f Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Date: Tue, 20 Dec 2022 16:05:50 +0100
Subject: [PATCH core-updates 2/6] scripts-index: Transform `guix index`
 extension into a Guix script

=2D--
 guix/{extensions =3D> scripts}/index.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename guix/{extensions =3D> scripts}/index.scm (99%)

diff --git a/guix/extensions/index.scm b/guix/scripts/index.scm
similarity index 99%
rename from guix/extensions/index.scm
rename to guix/scripts/index.scm
index d9894b213e..8d68a63847 100644
=2D-- a/guix/extensions/index.scm
+++ b/guix/scripts/index.scm
@@ -16,7 +16,7 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
=20
=2D(define-module (guix extensions index)
+(define-module (guix scripts index)
   #:use-module ((guix i18n) #:select (G_))
   #:use-module ((guix ui) #:select (show-version-and-exit
                                     show-bug-report-information
@@ -484,7 +484,7 @@ (define %default-options
     (with-method . "manifests")))
=20
 (define-command (guix-index . args)
=2D  (category extension)
+  (category packaging)
   (synopsis "Index packages to search package for a given filename")
=20
   (define (parse-sub-command arg result)
=2D-=20
2.36.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0003-scripts-index-Store-outputs-alongside-packages.patch
Content-Transfer-Encoding: quoted-printable

From=208799fcfb9f6238abe0e19ce650ee7f1e2b7e0d90 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Date: Thu, 22 Dec 2022 15:53:43 +0100
Subject: [PATCH core-updates 3/6] scripts-index: Store outputs alongside
 packages

=2D--
 guix/scripts/index.scm | 207 ++++++++++++++++++++++-------------------
 1 file changed, 112 insertions(+), 95 deletions(-)

diff --git a/guix/scripts/index.scm b/guix/scripts/index.scm
index 8d68a63847..d1478042ab 100644
=2D-- a/guix/scripts/index.scm
+++ b/guix/scripts/index.scm
@@ -50,7 +50,7 @@ (define-module (guix scripts index)
=20
 (define debug #f)
=20
=2D(define application-version 2)
+(define application-version 3)
=20
 ;; The following schema is the full schema at the `application-version`.  =
It
 ;; should be modified according to the development required and
@@ -70,6 +70,7 @@ (define schema-full
   id        integer primary key autoincrement not null,
   name      text not null,
   version   text not null,
+  output    text,
   unique    (name, version) -- add uniqueness constraint
 );
=20
@@ -102,6 +103,10 @@ (define schema-to-migrate '((1 . "
                             (2 . "
 alter table SchemaVersion
 add column date date;
+")
+                            (3 . "
+alter table Packages
+add column output text;
 ")))
=20
 (define (call-with-database file proc)
@@ -133,85 +138,90 @@ (define stmt-select-version (sqlite-prepare db "\
     ((#(version))
      version)))
=20
=2D(define (insert-files db package version directories)
=2D    "Insert files from DIRECTORIES as belonging to PACKAGE at VERSION."
=2D    (define stmt-select-package
=2D      (sqlite-prepare db "\
=2DSELECT id FROM Packages WHERE name =3D :name AND version =3D :version;"
=2D                      #:cache? #t))
=2D
=2D    (define stmt-insert-package
=2D      (sqlite-prepare db "\
=2DINSERT OR IGNORE INTO Packages(name, version) -- to avoid spurious writes
=2DVALUES (:name, :version);"
=2D                      #:cache? #t))
=2D
=2D    (define stmt-select-directory
=2D      (sqlite-prepare db "\
+(define (insert-files db package version outputs directories)
+  "Insert DIRECTORIES files belonging to VERSION PACKAGE (with OUTPUTS)."
+  (define stmt-select-package
+    (sqlite-prepare db "\
+SELECT id FROM Packages WHERE name =3D :name AND version =3D :version LIMI=
T 1;"
+                    #:cache? #t))
+
+  (define stmt-insert-package
+    (sqlite-prepare db "\
+INSERT OR REPLACE INTO Packages(name, version, output)
+VALUES (:name, :version, :output);"
+                    #:cache? #t))
+
+  (define stmt-select-directory
+    (sqlite-prepare db "\
 SELECT id FROM Directories WHERE name =3D :name AND package =3D :package;"
=2D                      #:cache? #t))
+                    #:cache? #t))
=20
=2D    (define stmt-insert-directory
=2D      (sqlite-prepare db "\
+  (define stmt-insert-directory
+    (sqlite-prepare db "\
 INSERT OR IGNORE INTO Directories(name, package) -- to avoid spurious writ=
es
 VALUES (:name, :package);"
=2D                      #:cache? #t))
+                    #:cache? #t))
=20
=2D    (define stmt-insert-file
=2D      (sqlite-prepare db "\
+  (define stmt-insert-file
+    (sqlite-prepare db "\
 INSERT OR IGNORE INTO Files(name, basename, directory)
 VALUES (:name, :basename, :directory);"
=2D                      #:cache? #t))
=2D
=2D    (sqlite-exec db "begin immediate;")
=2D    (sqlite-bind-arguments stmt-insert-package
=2D                           #:name package
=2D                           #:version version)
=2D    (sqlite-fold (const #t) #t stmt-insert-package)
=2D
=2D    (sqlite-bind-arguments stmt-select-package
=2D                           #:name package
=2D                           #:version version)
=2D    (match (sqlite-fold cons '() stmt-select-package)
=2D      ((#(package-id))
=2D       (when debug
=2D         (format #t "(pkg, version, pkg-id): (~a, ~a, ~a)"
=2D                 package version package-id)
=2D         (pk 'package package-id package))
=2D       (for-each (lambda (directory)
=2D                   (define (strip file)
=2D                     (string-drop file (+ (string-length directory) 1)))
=2D
=2D                   (sqlite-reset stmt-insert-directory)
=2D                   (sqlite-bind-arguments stmt-insert-directory
=2D                                          #:name directory
=2D                                          #:package package-id)
=2D                   (sqlite-fold (const #t) #t stmt-insert-directory)
=2D
=2D                   (sqlite-reset stmt-select-directory)
=2D                   (sqlite-bind-arguments stmt-select-directory
=2D                                          #:name directory
=2D                                          #:package package-id)
=2D                   (match (sqlite-fold cons '() stmt-select-directory)
=2D                     ((#(directory-id))
=2D                      (when debug
=2D                        (format #t "(name, package, dir-id): (~a, ~a, ~a=
)\n"
=2D                                directory package-id directory-id))
=2D                      (for-each (lambda (file)
=2D                                  ;; If DIRECTORY is a symlink, (find-fi=
les
=2D                                  ;; DIRECTORY) returns the DIRECTORY si=
ngleton.
=2D                                  (unless (string=3D? file directory)
=2D                                    (sqlite-reset stmt-insert-file)
=2D                                    (sqlite-bind-arguments stmt-insert-f=
ile
=2D                                                           #:name (strip=
 file)
=2D                                                           #:basename
=2D                                                           (basename fil=
e)
=2D                                                           #:directory
=2D                                                           directory-id)
=2D                                    (sqlite-fold (const #t) #t stmt-inse=
rt-file)))
=2D                                (find-files directory)))))
=2D                 directories)))
=2D    (sqlite-exec db "commit;"))
+                    #:cache? #t))
+
+  (sqlite-exec db "begin immediate;")
+  ;; 1 record per output
+  (for-each (lambda (output)
+              (let ((out (if (string=3D? "out" output) "" output)))
+                (sqlite-reset stmt-insert-package)
+                (sqlite-bind-arguments stmt-insert-package
+                                       #:name package
+                                       #:version version
+                                       #:output out)
+                (sqlite-fold (const #t) #t stmt-insert-package)))
+            outputs)
+  (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 single=
ton.
+                                (unless (string=3D? file directory)
+                                  (sqlite-reset stmt-insert-file)
+                                  (sqlite-bind-arguments stmt-insert-file
+                                                         #:name (strip fil=
e)
+                                                         #:basename
+                                                         (basename file)
+                                                         #:directory
+                                                         directory-id)
+                                  (sqlite-fold (const #t) #t stmt-insert-f=
ile)))
+                              (find-files directory)))))
+               directories)))
+  (sqlite-exec db "commit;"))
=20
 
 ;;;
@@ -224,8 +234,9 @@ (define (insert-package db package)
     (match (derivation->output-paths drv)
       (((labels . directories) ...)
        (when (every file-exists? directories)
=2D         (insert-files db (package-name package) (package-version packag=
e)
=2D                       directories))
+         (insert-files
+          db (package-name package) (package-version package) (package-out=
puts package)
+          directories))
        (return #t)))))
=20
 (define (insert-packages-with-progress db packages insert-package-fn)
@@ -283,6 +294,7 @@ (define (insert-manifest-entry db entry)
   "Insert a manifest ENTRY into DB."
   (insert-files db (manifest-entry-name entry)
                 (manifest-entry-version entry)
+                (list (manifest-entry-output entry))
                 (list (manifest-entry-item entry)))) ;FIXME: outputs?
=20
 (define (index-packages-from-manifests-with-db db-pathname)
@@ -298,28 +310,29 @@ (define (index-packages-from-manifests-with-db db-pat=
hname)
 ;;;
=20
 (define-record-type <package-match>
=2D  (package-match name version file)
+  (package-match name version output file)
   package-match?
=2D  (name      package-match-name)
=2D  (version   package-match-version)
=2D  (file      package-match-file))
+  (name    package-match-name)
+  (version package-match-version)
+  (output  package-match-output)
+  (file    package-match-file))
=20
 (define (matching-packages db file)
   "Return unique <package-match> corresponding to packages containing FILE=
."
   (define lookup-stmt
     (sqlite-prepare db "\
=2DSELECT Packages.name, Packages.version, Directories.name, Files.name
=2DFROM Packages
=2DINNER JOIN Files, Directories
=2DON files.basename =3D :file
=2D  AND directories.id =3D files.directory
=2D  AND packages.id =3D directories.package;"))
+SELECT p.name, p.version, p.output, d.name, f.name
+FROM Packages p
+INNER JOIN Files f, Directories d
+ON f.basename =3D :file
+  AND d.id =3D f.directory
+  AND p.id =3D d.package;"))
=20
   (sqlite-bind-arguments lookup-stmt #:file file)
   (sqlite-fold (lambda (result lst)
                  (match result
=2D                   (#(package version directory file)
=2D                    (cons (package-match package version
+                   (#(package version output directory file)
+                    (cons (package-match package version output
                                          (string-append directory "/" file=
))
                           lst))))
                '() lookup-stmt))
@@ -346,14 +359,12 @@ (define (insert-package-from-store db package)
                                             (not (package-superseded packa=
ge))
                                             (supported-package? package)))=
)))
             (insert-packages-with-progress
=2D             db packages insert-package-from-store))))
=2D      (index-packages-from-store db))))
+             db packages insert-package-from-store)))))))
=20
 (define (matching-packages-with-db db-pathname file)
   "Compute list of packages referencing FILE using db at DB-PATHNAME."
   (call-with-database db-pathname
=2D    (lambda (db)
=2D      (matching-packages db file))))
+    (lambda (db) (matching-packages db file))))
=20
 (define (read-version-from-db db-pathname)
   (call-with-database db-pathname
@@ -387,10 +398,16 @@ (define (migrate-schema-to-version db-pathname)
 (define (print-matching-results matches)
   "Print the MATCHES matching results."
   (for-each (lambda (result)
=2D              (format #t "~20a ~a~%"
=2D                      (string-append (package-match-name result)
=2D                                     "@" (package-match-version result))
=2D                      (package-match-file result)))
+              (let ((name    (package-match-name result))
+                    (version (package-match-version result))
+                    (output  (package-match-output result))
+                    (file    (package-match-file result)))
+                (format #t "~20a ~a~%"
+                        (string-append name "@" version
+                                       (if (string-null? output)
+                                           ""
+                                           (string-append ":" output)))
+                        file)))
             matches))
=20
 (define default-db-path
=2D-=20
2.36.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0004-Makefile.am-Reference-new-script-to-compile.patch
Content-Transfer-Encoding: quoted-printable

From=20ecea57fd4b46a8da5b78db17ceb7d8225a9e68e6 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Date: Fri, 24 Feb 2023 13:54:05 +0100
Subject: [PATCH core-updates 4/6] Makefile.am: Reference new script to comp=
ile

=2D--
 Makefile.am | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 23b939b674..6edd5eb900 100644
=2D-- a/Makefile.am
+++ b/Makefile.am
@@ -302,6 +302,7 @@ MODULES =3D					\
   guix/scripts/archive.scm			\
   guix/scripts/import.scm			\
   guix/scripts/package.scm			\
+  guix/scripts/index.scm			\
   guix/scripts/install.scm			\
   guix/scripts/remove.scm			\
   guix/scripts/upgrade.scm			\
@@ -589,6 +590,7 @@ SH_TESTS =3D					\
   tests/guix-gc.sh				\
   tests/guix-git-authenticate.sh		\
   tests/guix-hash.sh				\
+  tests/guix-index.sh				\
   tests/guix-pack.sh				\
   tests/guix-pack-localstatedir.sh		\
   tests/guix-pack-relocatable.sh		\
=2D-=20
2.36.1


--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline;
 filename=0005-Bootstrap-tests-for-guix-index-subcommand.patch
Content-Transfer-Encoding: quoted-printable

From=20ae756e5add599fe0bb07547b5ff43ffa22f47da0 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Date: Fri, 24 Feb 2023 13:54:17 +0100
Subject: [PATCH core-updates 5/6] Bootstrap tests for guix index subcommand

=2D--
 guix/scripts/index.scm |  4 +++
 tests/guix-index.sh    | 73 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100755 tests/guix-index.sh

diff --git a/guix/scripts/index.scm b/guix/scripts/index.scm
index d1478042ab..adf0f31269 100644
=2D-- a/guix/scripts/index.scm
+++ b/guix/scripts/index.scm
@@ -555,6 +555,10 @@ (define (fail)
   (with-error-handling
     (let* ((opts        (parse-command-line args %options
                                             (list %default-options)
+                                            ;; ignore $GUIX_BUILD_OPTIONS
+                                            ;; otherwise, subcommand is not
+                                            ;; detected in the tests conte=
xt
+                                            #:build-options? #f
                                             #:argument-handler
                                             parse-sub-command))
            (args        (option-arguments opts))
diff --git a/tests/guix-index.sh b/tests/guix-index.sh
new file mode 100755
index 0000000000..2c21d45a6b
=2D-- /dev/null
+++ b/tests/guix-index.sh
@@ -0,0 +1,73 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright =C2=A9 2013, 2014, 2015, 2019, 2020, 2023 Ludovic Court=C3=A8s=
 <ludo@HIDDEN>
+#
+# 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/>.
+
+#
+# Test the 'guix index' command-line utility.
+#
+
+set -x
+
+tmpdir=3D"guix-index-$$"
+trap 'rm -rf "$tmpdir"' EXIT
+
+guix index --version
+
+# Basic application to install and lookup through the index subcommand
+APPLICATION=3Dguile-bootstrap
+
+# The subcommand exposes two indexation methods so far:
+# - manifests: fast and less exhaustive
+# - store: slow, exhaustive
+
+# In the following tests, we will store in 2 different dbs for both indexa=
tion
+# methods
+tmpdb_manifests=3D"$tmpdir/manifests/db.sqlite"
+tmpdb_store=3D"$tmpdir/store/db.sqlite"
+
+echo "### Preparing db locations for both indexation methods"
+mkdir -p `dirname $tmpdb_manifests` `dirname $tmpdb_store`
+
+cmd_manifests=3D"guix index --db-path=3D$tmpdb_manifests --method=3Dmanife=
sts"
+cmd_store=3D"guix index --db-path=3D$tmpdb_store --method=3Dstore"
+
+echo "### Lookup without any db should fail"
+! $cmd_manifests search "$APPLICATION"
+! $cmd_store search "$APPLICATION"
+
+echo "### Initializing db with bare guix store should work"
+$cmd_manifests
+# ! $cmd_store
+
+echo "### lookup without anything in db should yield no result"
+! test `$cmd_manifests search "$APPLICATION"`
+# ! test `$cmd_store search "$APPLICATION"`
+
+echo "### Add some package to the temporary store"
+guix package --bootstrap \
+     --install $APPLICATION \
+     --profile=3D$tmpdir/profile
+
+echo "### Both both indexation call should work"
+# Testing indexation should work for both method
+test `$cmd_manifests`
+# test `$cmd_store`
+
+echo "### lookup indexed '$APPLICATION' should yield result"
+
+test `$cmd_manifests search "$APPLICATION"`
+# test `$cmd_store search "$APPLICATION"`
=2D-=20
2.36.1


--=-=-=
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: inline;
 filename=0006-Allow-gcroot-function-to-exceptionally-ignore-error.patch
Content-Transfer-Encoding: quoted-printable

From=20372b2b9660b8293eebd6280bb46a4ec07d4192a7 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Date: Mon, 13 Mar 2023 13:52:38 +0100
Subject: [PATCH core-updates 6/6] Allow gcroot function to exceptionally
 ignore error
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

Co-authored with Ludovic Court=C3=A8s <ludo@HIDDEN>
=2D--
 guix/store/roots.scm  | 10 +++++++++-
 tests/store-roots.scm |  7 ++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/guix/store/roots.scm b/guix/store/roots.scm
index 222f69c5c0..c2b15c33f0 100644
=2D-- a/guix/store/roots.scm
+++ b/guix/store/roots.scm
@@ -105,7 +105,15 @@ (define canonical-root
                                      (map (match-lambda
                                             ((file . properties)
                                              (cons (scope file) properties=
)))
=2D                                          (scandir* directory regular?))=
)))
+                                          (catch 'system-error
+                                            (lambda ()
+                                              (scandir* directory regular?=
))
+                                            (lambda args
+                                              (if (=3D ENOENT
+                                                     (system-error-errno
+                                                      args))
+                                                  '()
+                                                  (apply throw args))))))))
              (loop (append rest (map first sub-directories))
                    (append (map canonical-root (filter symlink? files))
                            roots)
diff --git a/tests/store-roots.scm b/tests/store-roots.scm
index 5bcf1bc87e..00a4fe7931 100644
=2D-- a/tests/store-roots.scm
+++ b/tests/store-roots.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
=2D;;; Copyright =C2=A9 2019 Ludovic Court=C3=A8s <ludo@HIDDEN>
+;;; Copyright =C2=A9 2019, 2023 Ludovic Court=C3=A8s <ludo@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +21,7 @@ (define-module (test-store-deduplication)
   #:use-module (guix store)
   #:use-module (guix store roots)
   #:use-module ((guix utils) #:select (call-with-temporary-directory))
+  #:use-module ((guix config) #:select (%state-directory))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-64))
=20
@@ -29,6 +30,10 @@ (define %store
=20
 (test-begin "store-roots")
=20
+(test-equal "gc-roots, initial"
+  (list (string-append %state-directory "/profiles"))
+  (gc-roots))
+
 (test-assert "gc-roots, regular root"
   (let* ((item (add-text-to-store %store "something"
                                   (random-text)))
=2D-=20
2.36.1


--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJUBAEBCgA+FiEEvwAgPXQaydVGqL4HUuLphA0Qw7gFAmQV7WcgHGFudG9pbmUu
cm9tYWluLmR1bW9udEBnbWFpbC5jb20ACgkQUuLphA0Qw7gQmg//atg37DoXGnRe
YJBPmGHmnGnL+IGxKJKsRWaxVDqXTAyFZFWFth4UfeLNQBy63frEBWEUQwKs/8l3
cnDBJ6W9/pyv6mLsd5tDePxLN9wm9OPRlBm6QPdzqt7S+7Xl/BP/Elb1dyvzzRC7
WX4fmqJSpT6EUR5CKoNb4V/yO4clb+bgvsz2v1KK1qdPbH2ikgEKrD2cKkt7m3uQ
vebA4h4BXkdzwpdvxLT60cfGq+xXRjrVW6SrhrW8fJP8AEs1k4bKgFTFjx038ebv
8YLiHpuwYXzj1xBDiwhpHOSE6Y999psovb11Bd3Fvyf0xMf+Z8rZ78G5JhFwCZIR
jtGFWtM9uXTC+4VwBiR62/10fFhMkRtllqQRMkJCTTxqHMDFk8zEhKuiGckXM1bn
6qe5idCn8UW/y/GhDYjcIE9Fco7ClCft8C93iEpzp6gBB+Bm61xDreBm5MGkyp5R
Iv3AHFNTJEpOA4TQBovXE473rWiQscWhaVhbK4bS8VWRZLQvCRz2zUci6w6zykjh
nR+53WczL7z/pY8AhB6HuXcQvdpGNRodj5Fk44gxZaDO6g04FMxPC4251H4H51yr
Tyez8uT61HrREjThuGF/ET61Z/jSHEVdkpn4qHVKRIUSZjKOovXCjhDhcekvq1z/
A/nzaY3gIORKAoFZ8oIIfdg7to2LVsc=
=WV38
-----END PGP SIGNATURE-----
--==-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Mar 2023 16:37:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 18 12:37:10 2023
Received: from localhost ([127.0.0.1]:48947 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pdZYL-0000a2-8u
	for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 12:37:10 -0400
Received: from lists.gnu.org ([209.51.188.17]:59860)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <antoine.romain.dumont@HIDDEN>) id 1pdZ4o-0008C3-Ui
 for submit <at> debbugs.gnu.org; Sat, 18 Mar 2023 12:06:42 -0400
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 <antoine.romain.dumont@HIDDEN>)
 id 1pdZ4k-0006VO-A7
 for guix-patches@HIDDEN; Sat, 18 Mar 2023 12:06:38 -0400
Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <antoine.romain.dumont@HIDDEN>)
 id 1pdZ4h-00080u-EI
 for guix-patches@HIDDEN; Sat, 18 Mar 2023 12:06:33 -0400
Received: by mail-wr1-x42f.google.com with SMTP id j2so6833660wrh.9
 for <guix-patches@HIDDEN>; Sat, 18 Mar 2023 09:06:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679155588;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=/PYaswrXzxrlV7ws67YhOl6jMgMmfz9b0lbTlIU89x4=;
 b=hZBWjkeX8nA8ZDRyVe5+W8angGIa6pv1ihohVfenIsamSh9mRrcTYtbaW+oS85zCtA
 LkuJ8iU+zESYU+bXRHCqeVi2VXi2g4maBplzwUQAjDM4giC+DDk2OYfbTUXVK81tY1tL
 kMj9+Hp4onAHdLnE4XOinJrXgKHgMvtqoMKzof6r1YKc81zcgJHXWIKCDIdItDj7IfUj
 KOWUcaJmymALfrXprs2qSe5ImP8oDnBSyw3gNBhw0U8eLwxF9wxQkB9QfGoEXnnReXhQ
 ke76svYoRA5A+zwYysKxPWkV/bsht0wU0p9S52k0Cy03LaFnoae9vrv3EsHMy2Q/MM1T
 JPwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679155588;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=/PYaswrXzxrlV7ws67YhOl6jMgMmfz9b0lbTlIU89x4=;
 b=2UT9ns3piuAxv3oaRubKztMRHhIbyp4eWp97VIXmxV0cSKhLs/OKM4bJm1oXYB1ZfB
 MJ9SfLIvZ2iOaevcvgl5hXAa5Y+j8F/cg3mZ1LKQM9bs73ZKfPX9wPvaJL0HbxMgu3In
 Xyi+Tv693pFvHypPUr90RL1UkvgNZJRphmebJa5WnFudkdj5t9zQTzPNFIF88ieAuuQc
 X3SfBshjxanW2a9Nh8mjhLsDycujdOXIwRhfWqQUAEitP6/7+cCxcCInzSMmC+7wz/6p
 i89gKp51FcujKQn7i9bf7NxsB6cDS9hZY/aBJHxJ68WOd2TGzzbfedRHAYchaJAVpFMR
 4jZw==
X-Gm-Message-State: AO0yUKUfqD4vb2557gfloXGFF96dMYdZLTvPp2odZMqdyhLdKf8LUkAM
 BnBiK6Yf6fAr2iL6q/c0Q/qnXXqN1Z0=
X-Google-Smtp-Source: AK7set959LvqT+R8hxV3272UM8imcZy8FMSYkhsJk95x4kCuVc1aKht08atELyYSx/MKBkQC+7a0eg==
X-Received: by 2002:a5d:5549:0:b0:2d4:d74d:fc83 with SMTP id
 g9-20020a5d5549000000b002d4d74dfc83mr1538751wrw.25.1679155588282; 
 Sat, 18 Mar 2023 09:06:28 -0700 (PDT)
Received: from yavin4 ([2a01:e0a:1c8:8a40:52d2:ac70:415c:2470])
 by smtp.gmail.com with ESMTPSA id
 t11-20020a05600001cb00b002c54241b4fesm4596978wrx.80.2023.03.18.09.06.27
 for <guix-patches@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 18 Mar 2023 09:06:27 -0700 (PDT)
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH core-updates 0/6] Add `guix index` subcommand
Date: Sat, 18 Mar 2023 17:06:26 +0100
Message-ID: <87v8iy59j1.fsf@HIDDEN>
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::42f;
 envelope-from=antoine.romain.dumont@HIDDEN; helo=mail-wr1-x42f.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 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 18 Mar 2023 12:37:07 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello,

This introduces a new `guix index` subcommand (initiated by
civodul). This is in charge of indexing guix packages to ease user
lookups. There are 2 indexation methods:
=2D `manifest`: fast but less efficient, expected to be used by local
  users
=2D `store`: slow but more efficient, expected to be used on a guix build
  machine. Another service could be in charge of exposing a search
  package service to ease remote search of packages.

** Impact (positive)

tl;dr This is an equivalent of `nix-index/nix-locate` or `apt-file
search` cli we can find respectively in Nix or Debian's toolbox
(unbeknownst of their implementation).

This should help users transitioning from other distributions. Usually,
people will want to look up for files or packages they are already
using. They'd expect an easy way to find those back in guix. And we
currently cannot do so easily. We can ask on #guix-devel irc (as someone
mentions to me there) though that's not scalable nor really practical
for non-irc users.

** How did I test/run it?

I've been running both the:
=2D `guix index` subcommand to index packages (with both methods in
  separated or not dbs).
=2D `guix index search FILE` to actually search for packages present in
  the db

I've inspected time and again the db through the `sqlite3` program after
multiple runs too to ensure data were consistent. Data are consistent.

** Build?

The makefile routine will build that subcommand too.

** Development details

The backend technology is sqlite3. The command is in charge of migrating
the data model (if any). That data model migration process is
transparent for users. The data model is currently at version 3 because
it underwent some migrations during its development process
already. It's kept for dogfooding and examples reasons.

The --version flag mentions the default backend locations and data model
version:
=2D-8<---------------cut here---------------end--------------->8---
$ guix index --version
Extension local cache database:
=2D path: /home/tony/.cache/guix/index/db.sqlite
=2D version: 3

guix index (GNU Guix) 1.4.0.3874-372b2
Copyright (C) 2023 the Guix authors
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm=
l>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ git log | head -1
commit 372b2b9660b8293eebd6280bb46a4ec07d4192a7
=2D-8<---------------cut here---------------end--------------->8---

** Current caveat ("help needed on test")

The code works but...

I can't make the integration test i wrote work. Hence my delay to send
the overall patch (as the subcommand has been ready for a while). As
it's been way too long already, I've posted it in the hope someone
interested enough sees what's missing. Thanks in advance.

What's happening during the test is that somehow the execution of the
`guix index` subcommand triggers an exit code > 0 (error). Which,
expectedly, stops the test immediately. I don't get why the subcommand
exits that way and I don't see how to dig further unfortunately. Any
clues would be very much appreciated.

** Use

The subcommand is documented exhaustively.

=2D-8<---------------cut here---------------end--------------->8---
$ guix index --help
Usage: guix index [OPTIONS...] [search FILE...]
Without argument, indexes (package, file) relationships from the machine.
This allows indexation with 2 methods, out of the local:

=2D manifests: This is the fastest implementation with the caveat of indexi=
ng
less packages. That'd be typically the use case of user local indexation.

=2D store: This is slowest implementation. It discusses with the store
daemon. That'd be typically the use case of building the largest db in one =
of
the build farm node.

With 'search FILE', search for packages installing FILE.

Note: Internal cache is located at ~/.cache/guix/index/db.sqlite by default.
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

  --method=3DMETH       Change default indexation method. By default it use=
s the
                      local "manifests" (faster). It can also uses the local
                      "store" (slower, typically on the farm build ci).
The valid values for ARGS are:

  search FILE     Search for packages installing the FILE (from cache db)

  <EMPTY>         Without any argument, it index packages. This fills in the
                  db cache using whatever indexation method is defined.
Report bugs to: bug-guix@HIDDEN
GNU Guix home page: <https://www.gnu.org/software/guix/>
General help using Guix and GNU software: <https://guix.gnu.org/en/help/>
=2D-8<---------------cut here---------------end--------------->8---

Example of an indexation (fast method by default):

=2D-8<---------------cut here---------------end--------------->8---
$ guix index
Registering 133 packages  =E2=96=95=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=
=96=88=E2=96=8E                                             =E2=96=8F
=2D-8<---------------cut here---------------end--------------->8---

Example of a search:

=2D-8<---------------cut here---------------end--------------->8---
$ guix index search sqlite3
sqlite@HIDDEN        /gnu/store/jd6nn2c8ln5flv4vwl7pp1w804w2i9wj-sqlite-3.3=
7.0/bin/sqlite3
sqlite@HIDDEN        /gnu/store/xmzx5mzv4863yw9kmr2ykndgp37p8if0-sqlite-3.3=
6.0/bin/sqlite3
=2D-8<---------------cut here---------------end--------------->8---

Note: inspired from zimoun's way of quoting (/me like those, thx ;)

** Development process (optional read)

Note that this started as a subcommand (again from civodul's bootstrap
code).  Then as a good proposal from zimoun, this got simplified into a
guix extension (awesome work zimoun ;). Fwiw, developing it as an
extension felt way simpler for dev and run. Versus, having to setup my
machines to develop with guix. It continued as a guix subcommand in the
end as civodul proposed it that way instead.

Sent from my MUA as git-send-email would not work...
=2D-8<---------------cut here---------------end--------------->8---

$ git send-email outgoing/0000-cover-letter.patch -a \
      --to=3Dguix-patches@HIDDEN
outgoing/0000-cover-letter.patch
Can't exec "sh": No such file or directory at
/gnu/store/xsj89hs359iblyxxi74pw6pyprdfbm5m-git-2.36.1-send-email/libexec/g=
it-core/.git-send-email-real
line 231.
the editor exited uncleanly, aborting everything at
/gnu/store/xsj89hs359iblyxxi74pw6pyprdfbm5m-git-2.36.1-send-email/libexec/g=
it-core/.git-send-email-real
line 252.
=2D-8<---------------cut here---------------end--------------->8---

Hoping this finds you well nonetheless.

Cheers,
=2D-
tony / Antoine R. Dumont (@ardumont)

=2D----------------------------------------------------------------
gpg fingerprint BF00 203D 741A C9D5 46A8 BE07 52E2 E984 0D10 C3B8


=3D=3D=3DFile ~/repo/public/guix/guix/outgoing/0000-cover-letter.patch=3D=
=3D=3D
From=20372b2b9660b8293eebd6280bb46a4ec07d4192a7 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>
Date: Sat, 18 Mar 2023 16:27:22 +0100
Subject: [PATCH core-updates 0/6] Add `guix index` subcommand
MIME-Version: 1.0
Content-Type: text/plain; charset=3DUTF-8
Content-Transfer-Encoding: 8bit

*** BLURB HERE ****

Antoine R. Dumont (@ardumont) (5):
  scripts-index: Transform `guix index` extension into a Guix script
  scripts-index: Store outputs alongside packages
  Makefile.am: Reference new script to compile
  Bootstrap tests for guix index subcommand
  Allow gcroot function to exceptionally ignore error

Ludovic Court=C3=A8s (1):
  index: Add initial implementation from civodul

 Makefile.am            |   2 +
 guix/scripts/home.scm  |   2 +-
 guix/scripts/index.scm | 595 +++++++++++++++++++++++++++++++++++++++++
 guix/store/roots.scm   |  10 +-
 tests/guix-index.sh    |  73 +++++
 tests/store-roots.scm  |   7 +-
 6 files changed, 686 insertions(+), 3 deletions(-)
 create mode 100644 guix/scripts/index.scm
 create mode 100755 tests/guix-index.sh


base-commit: 962277fd4313f20c0e0333effbd88352c0a7d461
=2D-=20
2.36.1

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJUBAEBCgA+FiEEvwAgPXQaydVGqL4HUuLphA0Qw7gFAmQV4YIgHGFudG9pbmUu
cm9tYWluLmR1bW9udEBnbWFpbC5jb20ACgkQUuLphA0Qw7i3DBAAx/QDdyBGSKd5
fowy1gAbb3two+K3jAO5LK1WYdffyse5+I26T2j1sUupPeo8LAM7dK/J4Qnp9AON
hvc18/4zzge/lw5O7MmEOcMZLUFtrT7dtRFrT2B1n9GhdQVddLgfte8oH42hcxNu
cJphYpre96xb58lCh4v8JCvj28csPdY4kh37Xv5XaQ8fqqIEJsmNcDkN2bMpQZCj
3T4rzpyH7YBvZ0PBFwB2/XuFkvn0IKJVcMGjjHXM6XtaJqccV6dzsUYS+KGrTnbN
nN/AawTkXomBCQfrvXIk+LM6OMNsxA97dye/nKcfFfKvHyeA9oJ75pPnNUURVuXt
aeXoC7XXvNRYaliHDYKdXe2jrUnTdhOq0SXhI2O6W/wZBrhqDPmXjoOB9cosazhL
ZA0CFgQNfylB8BKIZc8gYnUyR7ldGg5ybvQ4NKhnzgJySAHpznvSTTGgOYFgUDVg
FLk3s95bI6CkKSSJ2ldSkva5Xl61SDxNTUIm/RTLJr3a3Ou36tVkzdlCo73wiw2N
9szvWNojOJnzxyqHFXPWQp99w/AxMz69Pnlu5FEp+trrCo3BgGZ7ZgcWcTCHRhft
UGkrIWPG3WVxcuxAn9l6zckJ6J3bB3xG+2C8vtleLCPTuQkhh7XoWFfcCvdQOeaC
ObL/YM1n6Yi/FDrTkad9x46O6PUyS2w=
=nK7i
-----END PGP SIGNATURE-----
--=-=-=--




Acknowledgement sent to "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#62264; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 25 May 2023 18:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.