guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New ‘--list-generations’ and ‘--delete-generations’ options


From: Nikita Karetnikov
Subject: Re: New ‘--list-generations’ and ‘--delete-generations’ options
Date: Mon, 16 Sep 2013 15:12:53 +0400

> Cool.  The diff looks great...  but it lacks tests.

Yes, I wanted to finish the recutils part first.

I’ve been thinking about that, and I don’t like that we’d have to use
two record sets.  It’d be necessary to post-process the output nearly
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’s allow the ‘recutils’ 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 …)?

Also, why did you propose to use ‘object->fields’?  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 ‘string->duration’, and then
> put that one in (guix ui)?), along with a simple test in
> tests/guix-package.sh.

Why do you suggest to put ‘string->duration’ into (guix ui)?  I don’t
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 ‘maybe-comma-separated-integers’ accepts
>> something like ‘1,2,3,’ or ‘1,,,2’.  Or should I change the function?)

> That’s OK.

Hmmm, it feels sloppy, so I’ve 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’t 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 function

> 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…  On the other hand, it talks about a
particular object.  How do you distinguish these cases?

(I’ve also changed other comments and docstrings.)

>> +(define* (available-generations str #:optional (profile %current-profile))

> Perhaps ‘matching-generations’?

Done.

>> guix package: error: build failed: getting attributes of path 
>> `/nix/store/fcwh19ljibqjfx0c3cwnwcc7p31aq227-glibc-2.17-locales': No such 
>> file or directory

> Arf, what have you dooooone?

I don’t knooooow!

> Maybe you can try ‘nix-store --verify’

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’re at it ;-)).

OK, I added it to my todo list.  But I haven’t finished with generations
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

Attachment: pgpSaAbUI3ZhQ.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]