From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Karetnikov 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 15:12:53 +0400 Message-ID: <87k3ihyq8a.fsf@karetnikov.org> References: <87vc2o4qwc.fsf@gnu.org> <877gf1yftq.fsf@karetnikov.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> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLWfC-0005IX-Pc for guix-devel@gnu.org; Mon, 16 Sep 2013 07:08:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLWf7-00049K-Nw for guix-devel@gnu.org; Mon, 16 Sep 2013 07:08:18 -0400 In-Reply-To: <8738p8wgun.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Fri, 13 Sep 2013 23:29:20 +0200") 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: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > Cool. The diff looks great... but it lacks tests. Yes, I wanted to finish the recutils part first. 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 near= ly every time. Then why bother? We can already filter the output using regexps. 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 list= 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? Should it point to the store instead of (gnu packages =E2=80=A6)? Also, why did you propose to use =E2=80=98object->fields=E2=80=99? Should = I create an SRFI-9 record representing the recutils fields? > 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 ui)= ? I don=E2=80=99t think that it could be reused anywhere. 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). >> (Is it necessary to mention that =E2=80=98maybe-comma-separated-integers= =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: (define (maybe-comma-separated-integers) (let ((lst (delete-duplicates (map string->number (string-split str #\,))))) (and (every integer? lst) lst))) It shouldn=E2=80=99t be a problem since the code returns an error message: $ ./pre-inst-env guix package -l 1,2, guix package: error: invalid syntax: 1,2, $ ./pre-inst-env guix package -l 1,,,2 guix package: error: invalid syntax: 1,,,2 >> +(define (string->generations str) >> + "Return a list of generations matching a pattern in STR. This functi= on > 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 abo= ut a particular object. How do you distinguish these cases? (I=E2=80=99ve also changed other comments and docstrings.) >> +(define* (available-generations str #:optional (profile %current-profil= e)) > Perhaps =E2=80=98matching-generations=E2=80=99? Done. >> guix package: error: build failed: getting attributes of path `/nix/stor= e/fcwh19ljibqjfx0c3cwnwcc7p31aq227-glibc-2.17-locales': No such file or dir= ectory > 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 > (and port that option to Guix while you=E2=80=99re at it ;-)). OK, I added it to my todo list. But I haven=E2=80=99t finished with genera= tions and MIPS yet. [1] https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00097.html [2] https://lists.gnu.org/archive/html/guix-devel/2013-08/msg00126.html [3] https://github.com/ijp/quickcheck/blob/master/quickcheck.sls --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJSNue4AAoJEM+IQzI9IQ386lMP/iDbZrz/SHMKwY5zvIMaWOgB 5HjRNf2HP4pEm4vgaeqaAxhNkk9QIR/pNCSbBudPrfhOln0/5CvTPlartwjNacv3 x9/Ps22Jjd89B+vLumFds+6jY6Wa/ealb2XnZB5miwQUmJnNsIHrxQHsAF02PX9p IAgKzgm2bWOrjRUhN10Ccio2gB+/+EjtgpvUfWGgigGm8mN8Va7F1vlof+A9cvlh QlCcwY3FFPB3Gxm5UHNzta/zTsq3LxLw9fRvxXuPlG4FMPmPTSpMmab6f0XbT6FH qlORu+39JWAsao0g5iGO12/5tDgFw8O6N/mCaOhTSwkcb8mBRDAu2Kf+WbNxL33t essMUoRKTe9woovPeJ/dHWYCawPAJVHFZaupDCJRFNeOj7NnrxHgDK1azwgQ0Nla SUvB1wrg35ja9tzbgqFXueIyrfbB4kMN9xpwfNPvnrkkxh1V2jr2ATvYHTg+h5Cw P5/Ed1kOcRwEBq1HGI5dFM0spaRkN1SYCezL04/eeG0e/N5I44HRWcnClFLftYTC EK6sg/z3P88Rxsnc4zfL6PoTYGm04f3Y1QvNlQREjGSkZYdv8VhCPjPyb6qnmPWu Yn0Yb0te6es6FDvsAoYHjC7573pzkKed8vjmf0q3cTFvhpePzrhq7EBAJF1xMI/M BkiJ/1+a0gplAlxnVeRv =9FOp -----END PGP SIGNATURE----- --=-=-=--