From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: 02/09: guix: store: Make register-items transactional, register drv outputs Date: Wed, 06 Mar 2019 14:14:08 +0100 Message-ID: <877edcjgbj.fsf@gnu.org> References: <20190204192241.15758.66035@vcs0.savannah.gnu.org> <20190204192243.D1BD820B84@vcs0.savannah.gnu.org> <87wom8pqbi.fsf@gnu.org> <87o97gcc3w.fsf@cune.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:59968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1WNB-0007wF-Qs for guix-devel@gnu.org; Wed, 06 Mar 2019 08:14:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1WNA-0007LD-Lq for guix-devel@gnu.org; Wed, 06 Mar 2019 08:14:13 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:32962) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h1WNA-0007KU-AJ for guix-devel@gnu.org; Wed, 06 Mar 2019 08:14:12 -0500 In-Reply-To: <87o97gcc3w.fsf@cune.org> (Caleb Ristvedt's message of "Wed, 13 Feb 2019 02:43:31 -0600") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Caleb Ristvedt Cc: guix-devel@gnu.org Hi reepca! Caleb Ristvedt skribis: > Changes made, though I'm not quite sure about this part: > >> Could you add a test in tests/store-database.scm for this bit? >> >>> + (when (derivation-path? real-file-name) >>> + (register-derivation-outputs)) > > Should that be a separate test or an extension of "register-path"? > Currently I'm doing the latter. And it looks ugly. It=E2=80=99s part of =E2=80=98register-path=E2=80=99, so it=E2=80=99s a tes= t of =E2=80=98register-path=E2=80=99, sure. If you think it=E2=80=99s nicer to test it separately, you can write a sepa= rate test. >> Could you send updated patches? > > From 5ae8c31826f06f4ad0b52a4d7b0cd6c4abc64a20 Mon Sep 17 00:00:00 2001 > From: Caleb Ristvedt > Date: Wed, 30 Jan 2019 17:03:38 -0600 > Subject: [PATCH 1/2] guix: store: Make register-items transactional. > > * guix/store/database.scm (SQLITE_BUSY, register-output-sql): new variabl= es > (add-references): don't try finalizing after each use, only after all t= he > uses (otherwise a finalized statement would be used if #:cache? was #f). > (call-with-transaction): New procedure. > (register-items): Use call-with-transaction to prevent broken intermedi= ate > states from being visible. > > * .dir-locals.el (call-with-transaction): indent it. I applied this one (I updated the copyright year for you and tweaked the commit log.) > From adba9061739cd9afff9d404f871f66ce36147dd2 Mon Sep 17 00:00:00 2001 > From: Caleb Ristvedt > Date: Wed, 13 Feb 2019 02:19:42 -0600 > Subject: [PATCH 2/2] guix: store: Register derivation outputs. > > * guix/store/database.scm (register-output-sql, derivation-outputs-sql): = new > variables. > (registered-derivation-outputs): new procedure. > ((guix derivations), (guix store)): used for and > derivation-path?, respectively. > (register-items): if item is a derivation, also register its outputs. > > * tests/store-database.scm (register-path): first register a dummy deriva= tion > for the test file, and check that its outputs are registered in the > DerivationOutputs table and are equal to what was specified in the dummy > derivation. > --- > guix/store/database.scm | 41 ++++++++++++++++++++++++++++++++++++++++ > tests/store-database.scm | 30 ++++++++++++++++++++++++++++- > 2 files changed, 70 insertions(+), 1 deletion(-) > > diff --git a/guix/store/database.scm b/guix/store/database.scm > index af7f82b049..b89d81d770 100644 > --- a/guix/store/database.scm > +++ b/guix/store/database.scm > @@ -21,6 +21,8 @@ > #:use-module (sqlite3) > #:use-module (guix config) > #:use-module (guix serialization) > + #:use-module (guix derivations) > + #:use-module (guix store) A problem is that we should not pull in these two modules here, because they are conceptually at a higher level (they have to do with talking to a separate daemon process.) So perhaps a first step would be to re-arrange things, probably along these lines: =E2=80=A2 Move the .drv parsing code and the record type from (guix derivations) to, say, (guix store derivations). =E2=80=A2 Re-export all these bindings from (guix derivations). =E2=80=A2 Move =E2=80=98store-path?=E2=80=99, =E2=80=98derivation-path?= =E2=80=99 & co. (everything below line 1745 in guix/store.scm) to, say, (guix store files). Re-export appropriately so the API remains unchanged. At this point, (guix store =E2=80=A6) modules won=E2=80=99t have to use (gu= ix store) and (guix derivations) at all. How does that sound? Thanks, Ludo=E2=80=99.