From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: New =?utf-8?Q?=E2=80=98--list-generations=E2=80=99?= and =?utf-8?Q?=E2=80=98--delete-generations=E2=80=99?= options Date: Mon, 16 Sep 2013 14:16:40 +0200 Message-ID: <87ob7tm05z.fsf@gnu.org> References: <87vc2o4qwc.fsf@gnu.org> <87bo4dspl2.fsf@gnu.org> <87a9jxeh05.fsf@gnu.org> <87r4d9r2lv.fsf@gnu.org> <874na4jfp4.fsf_-_@karetnikov.org> <87eh97616m.fsf@gnu.org> <87bo48xdgb.fsf@karetnikov.org> <87hadz9gze.fsf@gnu.org> <87fvtjdl7y.fsf@karetnikov.org> <87bo444e9q.fsf@gnu.org> <87fvtfzihg.fsf@karetnikov.org> <87ioybxdun.fsf@gnu.org> <877geq9wx6.fsf@karetnikov.org> <87zjrmgcjh.fsf@gnu.org> <87ob80os3c.fsf@karetnikov.org> <87li336ofs.fsf@gnu.org> <87wqmmxutb.fsf@karetnikov.org> <87zjrins47.fsf@gnu.org> <87zjrgok6l.fsf@karetnikov.org> <8738p8wgun.fsf@gnu.org> <87k3ihyq8a.fsf@karetnikov.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLXoK-0000YK-FU for guix-devel@gnu.org; Mon, 16 Sep 2013 08:21:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLXoF-0001d4-0p for guix-devel@gnu.org; Mon, 16 Sep 2013 08:21:48 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:33678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLXoE-0001d0-Ll for guix-devel@gnu.org; Mon, 16 Sep 2013 08:21:42 -0400 In-Reply-To: <87k3ihyq8a.fsf@karetnikov.org> (Nikita Karetnikov's message of "Mon, 16 Sep 2013 15:12:53 +0400") List-Id: 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Nikita Karetnikov Cc: guix-devel@gnu.org Nikita Karetnikov skribis: >> Cool. The diff looks great... but it lacks tests. > > Yes, I wanted to finish the recutils part first. I think it=E2=80=99s reasonable to have a first milestone without recutils output. > I=E2=80=99ve been thinking about that, and I don=E2=80=99t like that we= =E2=80=99d have to use > two record sets. It=E2=80=99d be necessary to post-process the output ne= arly > every time. Then why bother? We can already filter the output using > regexps. Not sure what you mean by =E2=80=9Ctwo record sets=E2=80=9D. I see two use cases: one where you just want human-friendly output, for when one is glancing at the available generations, and one that is more amenable to Unix pipelines for post-processing. Recutils output is for the latter case. > I still think that someone may benefit from the recutils format. So > let=E2=80=99s allow the =E2=80=98recutils=E2=80=99 argument that would li= st all generations in > that format [1] and use the following format [2] for everything else: > > generation 1 Dec 16 2013 > guile 2.0.7 out,debug gnu/packages/guile.scm > hello 2.8 out gnu/packages/base.scm > > generation 2 May 7 2013 > guile 2.0.9 out gnu/packages/guile.scm > > Is it OK? Yes. > Should it point to the store instead of (gnu packages =E2=80=A6)? Yes, I think so. > Also, why did you propose to use =E2=80=98object->fields=E2=80=99? Shoul= d I create an > SRFI-9 record representing the recutils fields? =E2=80=98object->fields=E2=80=99 is just a convenient way to serialize an o= bject in recutils format. So no, you don=E2=80=99t need a new record type for the recutils field. In= stead you would just serialize the objects that represent a profile/manifest using that (currently there=E2=80=99s no distinct record type for those, bu= t the idea is the same.) >> What you could do is add the test cases you already have to >> tests/profile.scm, say (or tests/ui.scm for =E2=80=98string->duration=E2= =80=99, and then >> put that one in (guix ui)?), along with a simple test in >> tests/guix-package.sh. > > Why do you suggest to put =E2=80=98string->duration=E2=80=99 into (guix u= i)? Because it=E2=80=99s a user-interface function. > I think we should try to write all tests in Scheme, so we could switch > to property-based testing at some point (see [3], for instance). We still want to test the command-line user interface too. That=E2=80=99s = why there=E2=80=99s tests/packages.scm *and* tests/guix-package.sh, for instanc= e. Besides, I=E2=80=99m all for QuickCheck-style tests, there just wasn=E2=80= =99t any ready-to-use lib for Guile at the time (I think Ian Price has written/ported one in the meantime, though.) >>> (Is it necessary to mention that =E2=80=98maybe-comma-separated-integer= s=E2=80=99 accepts >>> something like =E2=80=981,2,3,=E2=80=99 or =E2=80=981,,,2=E2=80=99. Or= should I change the function?) > >> That=E2=80=99s OK. > > Hmmm, it feels sloppy, so I=E2=80=99ve changed the function: Even better. :-) >>> +(define (string->generations str) >>> + "Return a list of generations matching a pattern in STR. This funct= ion > >> Return *the* list of... > > Done. > > I never know which article should be used in such cases; the docstring > talks about it for the first time=E2=80=A6 On the other hand, it talks a= bout a > particular object. How do you distinguish these cases? Here we=E2=80=99re using Scheme lists to represent a set, and there can be = only one set of generations matching the given pattern; that=E2=80=99s why I suggested =E2=80=98the=E2=80=99 instead of =E2=80=98a=E2=80=99. In general I like to remove any ambiguity, and using =E2=80=98a=E2=80=99 is= often a source of ambiguity. >>> guix package: error: build failed: getting attributes of path `/nix/sto= re/fcwh19ljibqjfx0c3cwnwcc7p31aq227-glibc-2.17-locales': No such file or di= rectory > >> Arf, what have you dooooone? > > I don=E2=80=99t knooooow! > >> Maybe you can try =E2=80=98nix-store --verify=E2=80=99 > > I installed Nix 1.5.3. and ran the command: > > error: setting synchronous mode: unable to open database file Problem with permissions on the SQLite database, I guess. Thanks, Ludo=E2=80=99.