unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Goals for 0.4
@ 2013-08-29 12:34 Ludovic Courtès
  2013-08-29 13:16 ` Nikita Karetnikov
                   ` (5 more replies)
  0 siblings, 6 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-29 12:34 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1857 bytes --]

Hello!

So, what do we put in 0.4, and when do we release it?

First, I’d like to release 0.4 by (or on) GNU’s 30th birthday, which is
on Sep. 28th [0].  On the 28th, I’d also like to have a bootable QEMU
image built with Guix, featuring at least the init system (dmd), a
console login, and bare utilities.

What I would really like to see in 0.4:

  • Guix must be usable with the old Guile 2.0.5, since that’s what some
    distros provide.  At the GHM I realized that some people had weird
    bugs with that Guile, notably in the substituter.  I fixed a couple
    of bugs, but there may be others around.

    So, to 2.0.5 users: please run ‘make check’, use Guix and in
    particular the substituter, and report bugs!

  • Packages: as already discussed, more packages, anything that makes
    the distro more useful (having Git is a must.)
    A package a day keeps the competition away.  ;-)

  • Core updates: in particular libc 2.18.  Possibly switch to GCC 4.8
    as the default compiler.

  • APIs: new or extended APIs for building stand-alone images.  I’ve
    been looking into that recently, notably with the initrd stuff.

  • New ‘--list-generations’ and ‘--delete-generations’ options for
    ‘guix package’.

  • Manual: improve as we see fit; notably add a section on font usage
    for X applications.

Optional goals:

  • MIPS64/N64 support: the bootstrap tarballs are now all available
    through cross-compilation from x86_64, so it’s “just” a matter of
    feeding them in bootstrap.scm and trying out.

  • Rebuilt bootstrap binaries (aka. the “Fixed Point Project”, more on
    that later.)

  • Python 3, and related packaging changes.

Anything else?

What do people think?

Ludo’.

[0] https://www.gnu.org/gnu30/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
@ 2013-08-29 13:16 ` Nikita Karetnikov
  2013-08-29 13:36   ` Ludovic Courtès
  2013-09-03 19:21   ` MIPS64/N64 support (was: Goals for 0.4) Nikita Karetnikov
  2013-08-29 15:49 ` Goals for 0.4 Amirouche Boubekki
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-08-29 13:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 742 bytes --]

> First, I’d like to release 0.4 by (or on) GNU’s 30th birthday, which is
> on Sep. 28th [0].  On the 28th, I’d also like to have a bootable QEMU
> image built with Guix, featuring at least the init system (dmd), a
> console login, and bare utilities.

That would be great.  Because that’s the first thing people ask (on IRC,
for instance).

> • New ‘--list-generations’ and ‘--delete-generations’ options for
>   ‘guix package’.

I’m willing to help with this one.

> • MIPS64/N64 support: the bootstrap tarballs are now all available
>   through cross-compilation from x86_64, so it’s “just” a matter of
>   feeding them in bootstrap.scm and trying out.

I’m also interested in this one.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 13:16 ` Nikita Karetnikov
@ 2013-08-29 13:36   ` Ludovic Courtès
  2013-08-30 17:55     ` Nikita Karetnikov
  2013-09-22 19:19     ` [PATCH] guix package: Add '--delete-generations' Nikita Karetnikov
  2013-09-03 19:21   ` MIPS64/N64 support (was: Goals for 0.4) Nikita Karetnikov
  1 sibling, 2 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-29 13:36 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> First, I’d like to release 0.4 by (or on) GNU’s 30th birthday, which is
>> on Sep. 28th [0].  On the 28th, I’d also like to have a bootable QEMU
>> image built with Guix, featuring at least the init system (dmd), a
>> console login, and bare utilities.
>
> That would be great.  Because that’s the first thing people ask (on IRC,
> for instance).

Yeah, agreed.

>> • New ‘--list-generations’ and ‘--delete-generations’ options for
>>   ‘guix package’.
>
> I’m willing to help with this one.
>
>> • MIPS64/N64 support: the bootstrap tarballs are now all available
>>   through cross-compilation from x86_64, so it’s “just” a matter of
>>   feeding them in bootstrap.scm and trying out.
>
> I’m also interested in this one.

OK, your help is welcome on both fronts!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
  2013-08-29 13:16 ` Nikita Karetnikov
@ 2013-08-29 15:49 ` Amirouche Boubekki
  2013-08-29 20:04   ` Ludovic Courtès
  2013-08-29 20:42 ` Goals for 0.4 Andreas Enge
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 132+ messages in thread
From: Amirouche Boubekki @ 2013-08-29 15:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2055 bytes --]

Héllo,


What about the possiblity to use overlays ?


2013/8/29 Ludovic Courtès <ludo@gnu.org>

> Hello!
>
> So, what do we put in 0.4, and when do we release it?
>
> First, I’d like to release 0.4 by (or on) GNU’s 30th birthday, which is
> on Sep. 28th [0].  On the 28th, I’d also like to have a bootable QEMU
> image built with Guix, featuring at least the init system (dmd), a
> console login, and bare utilities.
>
> What I would really like to see in 0.4:
>
>   • Guix must be usable with the old Guile 2.0.5, since that’s what some
>     distros provide.  At the GHM I realized that some people had weird
>     bugs with that Guile, notably in the substituter.  I fixed a couple
>     of bugs, but there may be others around.
>
>     So, to 2.0.5 users: please run ‘make check’, use Guix and in
>     particular the substituter, and report bugs!
>
>   • Packages: as already discussed, more packages, anything that makes
>     the distro more useful (having Git is a must.)
>     A package a day keeps the competition away.  ;-)
>
>   • Core updates: in particular libc 2.18.  Possibly switch to GCC 4.8
>     as the default compiler.
>
>   • APIs: new or extended APIs for building stand-alone images.  I’ve
>     been looking into that recently, notably with the initrd stuff.
>
>   • New ‘--list-generations’ and ‘--delete-generations’ options for
>     ‘guix package’.
>
>   • Manual: improve as we see fit; notably add a section on font usage
>     for X applications.
>
> Optional goals:
>
>   • MIPS64/N64 support: the bootstrap tarballs are now all available
>     through cross-compilation from x86_64, so it’s “just” a matter of
>     feeding them in bootstrap.scm and trying out.
>
>   • Rebuilt bootstrap binaries (aka. the “Fixed Point Project”, more on
>     that later.)
>
>   • Python 3, and related packaging changes.
>
> Anything else?
>
> What do people think?
>
> Ludo’.
>
> [0] https://www.gnu.org/gnu30/
>

[-- Attachment #2: Type: text/html, Size: 2586 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 15:49 ` Goals for 0.4 Amirouche Boubekki
@ 2013-08-29 20:04   ` Ludovic Courtès
  2013-08-30 16:09     ` Cyprien Nicolas
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-29 20:04 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: guix-devel

Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:

> What about the possiblity to use overlays ?

Could you elaborate?

I hear this comes from the Gentoo jargon, but I’m not sure what
that means.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
  2013-08-29 13:16 ` Nikita Karetnikov
  2013-08-29 15:49 ` Goals for 0.4 Amirouche Boubekki
@ 2013-08-29 20:42 ` Andreas Enge
  2013-08-29 21:32   ` Ludovic Courtès
  2013-09-25  8:43   ` Andreas Enge
  2013-09-02 17:33 ` Cyril Roelandt
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 132+ messages in thread
From: Andreas Enge @ 2013-08-29 20:42 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Thu, Aug 29, 2013 at 02:34:27PM +0200, Ludovic Courtès wrote:
>   • Manual: improve as we see fit; notably add a section on font usage
>     for X applications.

I would volunteer for this one.

>   • Python 3, and related packaging changes.

And for some work on this one.

Andreas

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 20:42 ` Goals for 0.4 Andreas Enge
@ 2013-08-29 21:32   ` Ludovic Courtès
  2013-09-25  8:43   ` Andreas Enge
  1 sibling, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-29 21:32 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> skribis:

> On Thu, Aug 29, 2013 at 02:34:27PM +0200, Ludovic Courtès wrote:
>>   • Manual: improve as we see fit; notably add a section on font usage
>>     for X applications.
>
> I would volunteer for this one.
>
>>   • Python 3, and related packaging changes.
>
> And for some work on this one.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 20:04   ` Ludovic Courtès
@ 2013-08-30 16:09     ` Cyprien Nicolas
  2013-08-30 17:40       ` Amirouche Boubekki
  2013-08-30 19:31       ` Overlays Ludovic Courtès
  0 siblings, 2 replies; 132+ messages in thread
From: Cyprien Nicolas @ 2013-08-30 16:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1903 bytes --]

Il y a 20 heures, Ludovic Courtès écrivit :

> Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:
>
> > What about the possiblity to use overlays ?
>
> Could you elaborate?
>
> I hear this comes from the Gentoo jargon, but I’m not sure what
> that means.

I like the idea.  I'll try to elaborate myself, as a Gentoo user for
years ;-) I describe them from my own experience, official
documentation can be found there [1]

In Gentoo, ebuilds (the files that specify how to build a package from
source) are stored in the "portage tree", which is the official
repository.  The tree consists of directories, one per category, plus
one sub-directory par package, where package directories contains one
or more ebuilds, one ebuild per package version.  (plus some
additional files, like patches.)

"Portage" (the tool used to install packages from source, through the
"emerge" command) looks for ebuild in that directory, but it can also
looks from other directories which follow the same structure, those
directories are called "overlays", as they can mask packages from the
official tree, but also extend it.

They are plenty of overlays usage: experimental packages,
user-contributed packages, locally used packages for testing purposes…


However, overlay create new concerns.  First, priority of overlays, if
two provide the same package-version combination, which one to choose?
If Overlay A provide Package P, which depends on Library L, not in
Overlay A but in the "base" repository, and that Overlay B provide
a newer version of Library L, which L to choose?

Handling build failure of packages using overlays can be quite tricky
too. ;-)

And last, how and where to "centralize" overlays, in order to give
user a tool to easily add, remove, update overlays.


1. http://www.gentoo.org/proj/en/overlays/userguide.xml

-- 
Cyprien/Fulax

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-30 16:09     ` Cyprien Nicolas
@ 2013-08-30 17:40       ` Amirouche Boubekki
  2013-08-30 19:31       ` Overlays Ludovic Courtès
  1 sibling, 0 replies; 132+ messages in thread
From: Amirouche Boubekki @ 2013-08-30 17:40 UTC (permalink / raw)
  To: Cyprien Nicolas; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

I will just add that this feature is available in nixos
http://nixos.org/wiki/Nix%28OS%29_related_repositories_and_work


2013/8/30 Cyprien Nicolas <cyprien@nicolas.tf>

> Il y a 20 heures, Ludovic Courtès écrivit :
>
> > Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:
> >
> > > What about the possiblity to use overlays ?
> >
> > Could you elaborate?
> >
> > I hear this comes from the Gentoo jargon, but I’m not sure what
> > that means.
>
> I like the idea.  I'll try to elaborate myself, as a Gentoo user for
> years ;-) I describe them from my own experience, official
> documentation can be found there [1]
>
> In Gentoo, ebuilds (the files that specify how to build a package from
> source) are stored in the "portage tree", which is the official
> repository.  The tree consists of directories, one per category, plus
> one sub-directory par package, where package directories contains one
> or more ebuilds, one ebuild per package version.  (plus some
> additional files, like patches.)
>
> "Portage" (the tool used to install packages from source, through the
> "emerge" command) looks for ebuild in that directory, but it can also
> looks from other directories which follow the same structure, those
> directories are called "overlays", as they can mask packages from the
> official tree, but also extend it.
>
> They are plenty of overlays usage: experimental packages,
> user-contributed packages, locally used packages for testing purposes…
>
>
> However, overlay create new concerns.  First, priority of overlays, if
> two provide the same package-version combination, which one to choose?
> If Overlay A provide Package P, which depends on Library L, not in
> Overlay A but in the "base" repository, and that Overlay B provide
> a newer version of Library L, which L to choose?
>
> Handling build failure of packages using overlays can be quite tricky
> too. ;-)
>
> And last, how and where to "centralize" overlays, in order to give
> user a tool to easily add, remove, update overlays.
>
>
> 1. http://www.gentoo.org/proj/en/overlays/userguide.xml
>
> --
> Cyprien/Fulax
>

[-- Attachment #2: Type: text/html, Size: 2978 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 13:36   ` Ludovic Courtès
@ 2013-08-30 17:55     ` Nikita Karetnikov
  2013-08-30 18:31       ` Ludovic Courtès
  2013-09-22 19:19     ` [PATCH] guix package: Add '--delete-generations' Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-08-30 17:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

>>> • New ‘--list-generations’ and ‘--delete-generations’ options for
>>>   ‘guix package’.

I’ve been thinking about these options, and I’m not sure how they should
work.

Will it be enough to output a generation number and a list of packages
when ‘--list-generations’ is used?  For example:

Generation 1:
guile	2.0.9	out,debug	gnu/packages/base.scm:1022:33
guile-bootstrap	2.0	out	gnu/packages/bootstrap.scm:191:3

Generation 2:
hello	2.8	out	gnu/packages/base.scm:50:2

I think we could add ‘--from’ and ‘--to’ that have to be used with the
mentioned options:

$ guix package --delete-generations 1 3 8
Deleting generations 1, 3, 8...

$ guix package --delete-generations --from=4 --to=8
Deleting generations from 4 to 8...

$ guix package --delete-generations --from=4
(Let’s assume that there are 9 generations.)
Deleting generations from 4 to 9...

$ guix package --delete-generations --to=3
(I don’t like how the above sounds.  However, I couldn’t find a better
naming scheme.)
Deleting generations from 1 to 3...

Also, I’d like to remove the dash from ‘--roll-back’ since ‘--fallback’
is written without one.

What do you think?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-30 17:55     ` Nikita Karetnikov
@ 2013-08-30 18:31       ` Ludovic Courtès
  2013-08-31 16:40         ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-30 18:31 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>>> • New ‘--list-generations’ and ‘--delete-generations’ options for
>>>>   ‘guix package’.
>
> I’ve been thinking about these options, and I’m not sure how they should
> work.
>
> Will it be enough to output a generation number and a list of packages
> when ‘--list-generations’ is used?  For example:
>
> Generation 1:
> guile	2.0.9	out,debug	gnu/packages/base.scm:1022:33
> guile-bootstrap	2.0	out	gnu/packages/bootstrap.scm:191:3
>
> Generation 2:
> hello	2.8	out	gnu/packages/base.scm:50:2

Perhaps there could be several formats.  For instance,
--list-generations would be equivalent to --list-generations=short:

  generation 1     Dec. 16 2013
  generation 2     May 7 2013

And then --list-generations=long would do something like:

  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

WDYT?

> I think we could add ‘--from’ and ‘--to’ that have to be used with the
> mentioned options:
>
> $ guix package --delete-generations 1 3 8
> Deleting generations 1, 3, 8...
>
> $ guix package --delete-generations --from=4 --to=8
> Deleting generations from 4 to 8...

Rather, I would do:

  --delete-generations=3..9

It’s easier to parse and to type.

Likewise, it could even support:

  --delete-generations=1month

> Also, I’d like to remove the dash from ‘--roll-back’ since ‘--fallback’
> is written without one.
>
> What do you think?

I’ll have to disagree.  :-)

There’s no such verb as “rollback”, I think, whereas “fallback” is a
valid noun (and we don’t have the choice for “fallback”, since there are
messages in the daemon that mention it.)

Now, if you had --rollback as an alias, I won’t scream either...

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Overlays
  2013-08-30 16:09     ` Cyprien Nicolas
  2013-08-30 17:40       ` Amirouche Boubekki
@ 2013-08-30 19:31       ` Ludovic Courtès
  2013-08-30 20:42         ` Overlays Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-30 19:31 UTC (permalink / raw)
  To: Cyprien Nicolas; +Cc: guix-devel

Cyprien Nicolas <cyprien@nicolas.tf> skribis:

> "Portage" (the tool used to install packages from source, through the
> "emerge" command) looks for ebuild in that directory, but it can also
> looks from other directories which follow the same structure, those
> directories are called "overlays", as they can mask packages from the
> official tree, but also extend it.

OK, I see.

In Guix, packages (equivalent to “ebuilds”, AIUI) are just Scheme
objects.  Normally, they are exported by Guile modules; the GNU system
exports packages from the (gnu packages ...) name space, but users are
free to create other modules that define and export packages.

The ‘guix build’ and ‘guix package’ commands traverse the list of
modules in the (gnu packages ...) name space.  Thus, if you type:

  guix build hop

the whole list packages exported by (gnu packages ...) modules is
traversed in search of one whose name is “hop”.

But you can also run:

  guix build -e '(@ (my own packages) hop)'

to refer to a specific package definition in your own module.


Now, there is currently no way to instruct the command-line tools to
also look under (my own packages), for instance.  That may be a useful
thing to add.

> However, overlay create new concerns.  First, priority of overlays, if
> two provide the same package-version combination, which one to choose?
> If Overlay A provide Package P, which depends on Library L, not in
> Overlay A but in the "base" repository, and that Overlay B provide
> a newer version of Library L, which L to choose?

In Guix the dependency graph is really a graph of Scheme objects, so
there’s no ambiguity as to what they refer to.

So I think Guix nearly supports overlays, no?  :-)

The way forward is to identify precise mechanisms needed to better
support overlay-style uses, and then to come up with patches (patches
that are simple enough could go in for 0.4.)

A good starting point is the ‘fold-packages’ procedure in (gnu packages).

WDYT?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Overlays
  2013-08-30 19:31       ` Overlays Ludovic Courtès
@ 2013-08-30 20:42         ` Nikita Karetnikov
  2013-08-30 21:21           ` Overlays Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-08-30 20:42 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

> So I think Guix nearly supports overlays, no?  :-)

What do NixOS people mean by “overlay”?  Is it a remote collection of
recipes?  Does NixOS allow to use them without copying to the local
storage (like ‘gnu/packages’)?

I believe that the question was about these issues.  If so, Guix doesn’t
support that (yet?).

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Overlays
  2013-08-30 20:42         ` Overlays Nikita Karetnikov
@ 2013-08-30 21:21           ` Ludovic Courtès
  2013-08-31 10:56             ` Overlays Amirouche Boubekki
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-30 21:21 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> So I think Guix nearly supports overlays, no?  :-)
>
> What do NixOS people mean by “overlay”?

Well, I don’t think that wiki page has much authority.  ;-)

“Overlay” is not a term that is used in NixOS circles.  My guess is that
the Ruby and Haskell overlays mentioned at
<http://nixos.org/wiki/Nix(OS)_related_repositories_and_work> are used
by a single person, and I’m not sure what they do.

> Is it a remote collection of recipes?  Does NixOS allow to use them
> without copying to the local storage (like ‘gnu/packages’)?
>
> I believe that the question was about these issues.

I’m not sure what the issues are.

In Guix, third parties could distribute their own Guile modules that
define packages.  Guix would need a way to nicely deal with them at the
command line, but otherwise it’s just Guile modules.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Overlays
  2013-08-30 21:21           ` Overlays Ludovic Courtès
@ 2013-08-31 10:56             ` Amirouche Boubekki
  2013-08-31 15:57               ` Overlays Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Amirouche Boubekki @ 2013-08-31 10:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

2013/8/30 Ludovic Courtès <ludo@gnu.org>
>
> Nikita Karetnikov <nikita@karetnikov.org> skribis:
>
> >> So I think Guix nearly supports overlays, no?  :-)
> >
> > What do NixOS people mean by “overlay”?
>
> Well, I don’t think that wiki page has much authority.  ;-)
>
> “Overlay” is not a term that is used in NixOS circles.  My guess is that
> the Ruby and Haskell overlays mentioned at
> <http://nixos.org/wiki/Nix(OS)_related_repositories_and_work> are used
> by a single person, and I’m not sure what they do.

I don't recall how I heard about those overlay.

>
> > Is it a remote collection of recipes?  Does NixOS allow to use them
> > without copying to the local storage (like ‘gnu/packages’)?
> >
> > I believe that the question was about these issues.
>
> I’m not sure what the issues are.


The issue I see is that some one wants to distribute recipes but
doesn't want to contribute them in the guix repository. One way to do
that is to fork the guix repository and merge once in a while and then
ask the users to install packages using the command used during
development from the forked repository. Otherwise, if overlays were
supported users would just have to install overlays somewhat like apt
sources and use the same command as with guix distribution recipes.

I see they are quite useful in Gentoo for forked distributions.

>
> In Guix, third parties could distribute their own Guile modules that
> define packages. Guix would need a way to nicely deal with them at the
> command line, but otherwise it’s just Guile modules.

IIRC in nixos one just has to use the command «nix-env -i
path/to/nix/package» to install a recipe out of nixpkg tree, I'm not
sure it's supported by guix.

Anyway, the reason I raised now this feature is because:

- I find it a useful feature, but the features you proposed for 0.4
are way more interesting for the time being
- One user complained on IRC that overlays could *streamline* recipes
contributions that said contributing packages is not difficult using
the guix repository

So what I propose is to put this feature request in a TODO to avoid
future loosly backed request like mine (except if someone wants to
work on this) and focus on the 0.4 roadmap :)

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Overlays
  2013-08-31 10:56             ` Overlays Amirouche Boubekki
@ 2013-08-31 15:57               ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-31 15:57 UTC (permalink / raw)
  To: Amirouche Boubekki; +Cc: guix-devel

Amirouche Boubekki <amirouche.boubekki@gmail.com> skribis:

> The issue I see is that some one wants to distribute recipes but
> doesn't want to contribute them in the guix repository. One way to do
> that is to fork the guix repository and merge once in a while and then
> ask the users to install packages using the command used during
> development from the forked repository. Otherwise, if overlays were
> supported users would just have to install overlays somewhat like apt
> sources and use the same command as with guix distribution recipes.

Without touching the Guix code, Guix users can always create their own
modules containing their own package recipes.  For instance, in
my-own.scm, one could write:

  (define-module (my-own)
    #:use-module (guix packages)
    ...)

  (define-public my-own-package
    (package
      (name "my-own")
      ...))

All the API is usable from there, in particular ‘package-derivation’.

From the command-line, one can run:

  guix build -e '(@ (my-own) my-own-package)'

or:

  guix package -e '(@ (my-own) my-own-package)'

What does not work, though, is:

  guix package -i my-own

So, to me, that’s what we’d want to fix.

>> In Guix, third parties could distribute their own Guile modules that
>> define packages. Guix would need a way to nicely deal with them at the
>> command line, but otherwise it’s just Guile modules.
>
> IIRC in nixos one just has to use the command «nix-env -i
> path/to/nix/package» to install a recipe out of nixpkg tree, I'm not
> sure it's supported by guix.

It is, see above.  :-)

> Anyway, the reason I raised now this feature is because:
>
> - I find it a useful feature, but the features you proposed for 0.4
> are way more interesting for the time being
> - One user complained on IRC that overlays could *streamline* recipes
> contributions that said contributing packages is not difficult using
> the guix repository
>
> So what I propose is to put this feature request in a TODO to avoid
> future loosly backed request like mine (except if someone wants to
> work on this) and focus on the 0.4 roadmap :)

Agreed!

Thanks for explaining,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-30 18:31       ` Ludovic Courtès
@ 2013-08-31 16:40         ` Nikita Karetnikov
  2013-08-31 18:05           ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-08-31 16:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]

> Rather, I would do:

>   --delete-generations=3..9

> It’s easier to parse and to type.

> Likewise, it could even support:

>   --delete-generations=1month

Here’s what I decided to use:

--list-generations
--list-generations=10
--list-generations=1,32,9
--list-generations=4..10
--list-generations=11..
--list-generations=..13
--list-generations=first-month
--list-generations=last-month

I guess I have to write a parser for the “1,32,9” case, right?  Or is
there a simpler solution?

> Perhaps there could be several formats.  For instance,
> --list-generations would be equivalent to --list-generations=short:

>   generation 1     Dec. 16 2013
>   generation 2     May 7 2013

> And then --list-generations=long would do something like:

>   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

> WDYT?

OK, but how can I integrate this in the above scheme?  Will it be OK to
create an additional ‘--short’ switch or a new
‘--list-generations-short’ option?  Both solutions look ugly.

> I’ll have to disagree.  :-)

> There’s no such verb as “rollback”, I think, whereas “fallback” is a
> valid noun (and we don’t have the choice for “fallback”, since there are
> messages in the daemon that mention it.)

> Now, if you had --rollback as an alias, I won’t scream either...

See [1–4].  Would you like to keep ‘--roll-back’ anyway?

[1] https://en.wiktionary.org/wiki/rollback
[2] http://www.merriam-webster.com/dictionary/rollback
[3] http://www.thefreedictionary.com/rollback
[4] http://oxforddictionaries.com/us/definition/american_english/rollback

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-31 16:40         ` Nikita Karetnikov
@ 2013-08-31 18:05           ` Ludovic Courtès
  2013-08-31 20:34             ` Jose E. Marchesi
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-31 18:05 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel, Jose E. Marchesi

[-- Attachment #1: Type: text/plain, Size: 2768 bytes --]

(Cc’ing José or recutils.)

José: this is about providing a way to list the “generations” of a
profile, i.e., the packages that were installed at a given point in
time.

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Rather, I would do:
>
>>   --delete-generations=3..9
>
>> It’s easier to parse and to type.
>
>> Likewise, it could even support:
>
>>   --delete-generations=1month
>
> Here’s what I decided to use:
>
> --list-generations
> --list-generations=10
> --list-generations=1,32,9
> --list-generations=4..10
> --list-generations=11..
> --list-generations=..13
> --list-generations=first-month
> --list-generations=last-month
>
> I guess I have to write a parser for the “1,32,9” case, right?  Or is
> there a simpler solution?
>
>> Perhaps there could be several formats.  For instance,
>> --list-generations would be equivalent to --list-generations=short:
>
>>   generation 1     Dec. 16 2013
>>   generation 2     May 7 2013
>
>> And then --list-generations=long would do something like:
>
>>   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
>
>> WDYT?
>
> OK, but how can I integrate this in the above scheme?  Will it be OK to
> create an additional ‘--short’ switch or a new
> ‘--list-generations-short’ option?  Both solutions look ugly.

I just realized that we can do even better: have --list-generations
output recutils-formatted data (using ‘object->fields’).  Then, if we do
it right, the output can just be piped to ‘recsel’ to select entries of
a certain age, to display specific fields, etc.  Like:

  generation-number: 1
  date: 2013-05-07

However, I don’t know exactly how to represent both the generations and
the list of packages in each generation in a single recutils stream.

José, how can the relations between “generation” records and “package”
records be expressed?

>> I’ll have to disagree.  :-)
>
>> There’s no such verb as “rollback”, I think, whereas “fallback” is a
>> valid noun (and we don’t have the choice for “fallback”, since there are
>> messages in the daemon that mention it.)
>
>> Now, if you had --rollback as an alias, I won’t scream either...
>
> See [1–4].  Would you like to keep ‘--roll-back’ anyway?
>
> [1] https://en.wiktionary.org/wiki/rollback
> [2] http://www.merriam-webster.com/dictionary/rollback
> [3] http://www.thefreedictionary.com/rollback
> [4] http://oxforddictionaries.com/us/definition/american_english/rollback

OK, let’s just do this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 616 bytes --]

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 5c3947d..1c9898f 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -497,7 +497,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (option '(#\u "upgrade") #f #t
                 (lambda (opt name arg result)
                   (alist-cons 'upgrade arg result)))
-        (option '("roll-back") #f #f
+        (option '("roll-back" "rollback") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'roll-back? #t result)))
         (option '("search-paths") #f #f

[-- Attachment #3: Type: text/plain, Size: 63 bytes --]


and perhaps we can document both in the manual.

Ludo’.

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-31 18:05           ` Ludovic Courtès
@ 2013-08-31 20:34             ` Jose E. Marchesi
  2013-08-31 21:07               ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Jose E. Marchesi @ 2013-08-31 20:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


    I just realized that we can do even better: have --list-generations
    output recutils-formatted data (using ‘object->fields’).  Then, if we do
    it right, the output can just be piped to ‘recsel’ to select entries of
    a certain age, to display specific fields, etc.  Like:
    
      generation-number: 1
      date: 2013-05-07
    
    However, I don’t know exactly how to represent both the generations and
    the list of packages in each generation in a single recutils stream.
    
    José, how can the relations between “generation” records and “package”
    records be expressed?

You can have two record sets: one for generations, one for packages.  A
foreign key can relate them.  Something like this:

%rec: Generation

Id: 1
Date: Dec. 16 2013

Id: 2
Date: May 7 2013

%rec: Package
%type: Generation rec Generation

Package: guile
Version: 2.0.7
Generation: 1

Package: guile
Version: 2.0.9
Generation: 2

Package: hello
Version: 2.8
Generation 2
    

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-31 20:34             ` Jose E. Marchesi
@ 2013-08-31 21:07               ` Ludovic Courtès
  2013-09-01 23:16                 ` New ‘--list-generations’ and ‘--delete-generations’ options (was: Goals for 0.4) Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-08-31 21:07 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: guix-devel

jemarch@gnu.org (Jose E. Marchesi) skribis:

>     I just realized that we can do even better: have --list-generations
>     output recutils-formatted data (using ‘object->fields’).  Then, if we do
>     it right, the output can just be piped to ‘recsel’ to select entries of
>     a certain age, to display specific fields, etc.  Like:
>     
>       generation-number: 1
>       date: 2013-05-07
>     
>     However, I don’t know exactly how to represent both the generations and
>     the list of packages in each generation in a single recutils stream.
>     
>     José, how can the relations between “generation” records and “package”
>     records be expressed?
>
> You can have two record sets: one for generations, one for packages.  A
> foreign key can relate them.  Something like this:

Perfect, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* New ‘--list-generations’ and ‘--delete-generations’ options (was: Goals for 0.4)
  2013-08-31 21:07               ` Ludovic Courtès
@ 2013-09-01 23:16                 ` Nikita Karetnikov
  2013-09-02  9:08                   ` New ‘--list-generations’ and ‘--delete-generations’ options Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-01 23:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

I’m trying to handle the “last-month” and the “first-month” cases.  I’d
like to use ‘profile-numbers’* to construct an alist of generations and
their creation dates.

What can I use to get the creation date of a file?  I can’t find
anything in the manual.

* We should rename it to ‘generation-numbers’ or something like that.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-01 23:16                 ` New ‘--list-generations’ and ‘--delete-generations’ options (was: Goals for 0.4) Nikita Karetnikov
@ 2013-09-02  9:08                   ` Ludovic Courtès
  2013-09-05  1:30                     ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-02  9:08 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> I’m trying to handle the “last-month” and the “first-month” cases.  I’d
> like to use ‘profile-numbers’* to construct an alist of generations and
> their creation dates.
>
> What can I use to get the creation date of a file?  I can’t find
> anything in the manual.

Something like (and=> (stat foo) stat:ctime).

> * We should rename it to ‘generation-numbers’ or something like that.

Probably, yes.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
                   ` (2 preceding siblings ...)
  2013-08-29 20:42 ` Goals for 0.4 Andreas Enge
@ 2013-09-02 17:33 ` Cyril Roelandt
  2013-09-02 19:38   ` Ludovic Courtès
  2013-09-06  9:19 ` ‘--no-substitutes’ is ignored on i686 (was: Goals for 0.4) Nikita Karetnikov
  2013-09-24 21:59 ` Goals for 0.4 Ludovic Courtès
  5 siblings, 1 reply; 132+ messages in thread
From: Cyril Roelandt @ 2013-09-02 17:33 UTC (permalink / raw)
  To: guix-devel

On 08/29/2013 02:34 PM, Ludovic Courtès wrote:
>      So, to 2.0.5 users: please run ‘make check’, use Guix and in
>      particular the substituter, and report bugs!

When I started using Guix on i686, some tests failed. I tried to run 
"make check" again today, with Guile 2.0.5: everything works.

Cyril.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-02 17:33 ` Cyril Roelandt
@ 2013-09-02 19:38   ` Ludovic Courtès
  2013-09-02 19:40     ` Cyril Roelandt
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-02 19:38 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: guix-devel

Cyril Roelandt <tipecaml@gmail.com> skribis:

> On 08/29/2013 02:34 PM, Ludovic Courtès wrote:
>>      So, to 2.0.5 users: please run ‘make check’, use Guix and in
>>      particular the substituter, and report bugs!
>
> When I started using Guix on i686, some tests failed. I tried to run
> "make check" again today, with Guile 2.0.5: everything works.

Good.  Can you check whether the substituter works?

That is, try to install something that’s available on hydra.gnu.org, and
check that it downloads correctly, and prints “Please consider upgrading
Guile to get proper progress report”.

TIA!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-02 19:38   ` Ludovic Courtès
@ 2013-09-02 19:40     ` Cyril Roelandt
  2013-09-02 21:35       ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Cyril Roelandt @ 2013-09-02 19:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On 09/02/2013 09:38 PM, Ludovic Courtès wrote:
> That is, try to install something that’s available on hydra.gnu.org, and
> check that it downloads correctly, and prints “Please consider upgrading
> Guile to get proper progress report”.

It does exactly that.


Cyril.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-02 19:40     ` Cyril Roelandt
@ 2013-09-02 21:35       ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-02 21:35 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: guix-devel

Cyril Roelandt <tipecaml@gmail.com> skribis:

> On 09/02/2013 09:38 PM, Ludovic Courtès wrote:
>> That is, try to install something that’s available on hydra.gnu.org, and
>> check that it downloads correctly, and prints “Please consider upgrading
>> Guile to get proper progress report”.
>
> It does exactly that.

Great, thanks.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* MIPS64/N64 support (was: Goals for 0.4)
  2013-08-29 13:16 ` Nikita Karetnikov
  2013-08-29 13:36   ` Ludovic Courtès
@ 2013-09-03 19:21   ` Nikita Karetnikov
  2013-09-03 20:45     ` MIPS64/N64 support Ludovic Courtès
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-03 19:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

>> • MIPS64/N64 support: the bootstrap tarballs are now all available
>>   through cross-compilation from x86_64, so it’s “just” a matter of
>>   feeding them in bootstrap.scm and trying out.

> I’m also interested in this one.

Oh, I forgot that I’ll need five tarballs, not two [1].  Can I get the
other three somewhere?

Otherwise, I’ll probably try to cross-compile them myself.

[1] http://www.fdn.fr/~lcourtes/tmp/

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-03 19:21   ` MIPS64/N64 support (was: Goals for 0.4) Nikita Karetnikov
@ 2013-09-03 20:45     ` Ludovic Courtès
  2013-09-04  0:35       ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-03 20:45 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> • MIPS64/N64 support: the bootstrap tarballs are now all available
>>>   through cross-compilation from x86_64, so it’s “just” a matter of
>>>   feeding them in bootstrap.scm and trying out.
>
>> I’m also interested in this one.
>
> Oh, I forgot that I’ll need five tarballs, not two [1].  Can I get the
> other three somewhere?
>
> Otherwise, I’ll probably try to cross-compile them myself.

If you can cross-compile (really: substitute) them from x86_64, the
better (you can even log in to hydra.gnu.org and get them from there.)
Otherwise let me know and we’ll arrange something.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-03 20:45     ` MIPS64/N64 support Ludovic Courtès
@ 2013-09-04  0:35       ` Nikita Karetnikov
  2013-09-04 12:18         ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-04  0:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]

> If you can cross-compile (really: substitute) them from x86_64, the
> better (you can even log in to hydra.gnu.org and get them from there.)
> Otherwise let me know and we’ll arrange something.

$ ./pre-inst-env guix build binutils-static-stripped-tarball \
                            bootstrap-binaries \
                            gcc-stripped-tarball \
                            glibc-stripped-tarball \
                            guile-static-stripped-tarball \
                            guile-2.0.9 \
                            -s x86_64-linux --target=mips64el-linux-gnuabi64
/nix/store/5w82rp4ibbn0azd1yr4q1skcxhw89dcy-guile-2.0.9-debug
/nix/store/g35wv744318hkn9d3hcqlcsfw996n3yw-guile-2.0.9
/nix/store/2splrd2277xsydp694qrscrk0pj4g4cn-guile-static-stripped-tarball-2.0.9
/nix/store/pkf0dm7m815p6ckam8chvv7825g6lzim-glibc-stripped-tarball-2.17
/nix/store/dhr8d58y48nds7njgg5hzq9b1a8yaaq5-gcc-stripped-tarball-4.7.3
/nix/store/0rx75anx2bk29jvy14qkzzpkc8wbbpn9-bootstrap-binaries-0
/nix/store/wzwpq959jdg4p7ar775pwi8f4ph90jkp-binutils-static-stripped-tarball-2.23.2

Which Guile do I need?  The stripped one, right?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-04  0:35       ` Nikita Karetnikov
@ 2013-09-04 12:18         ` Ludovic Courtès
  2013-09-06  8:35           ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-04 12:18 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> If you can cross-compile (really: substitute) them from x86_64, the
>> better (you can even log in to hydra.gnu.org and get them from there.)
>> Otherwise let me know and we’ll arrange something.
>
> $ ./pre-inst-env guix build binutils-static-stripped-tarball \
>                             bootstrap-binaries \
>                             gcc-stripped-tarball \
>                             glibc-stripped-tarball \
>                             guile-static-stripped-tarball \
>                             guile-2.0.9 \
>                             -s x86_64-linux --target=mips64el-linux-gnuabi64

Oh indeed, using ‘-s’ was a good idea.  Note that ‘guix build
bootstrap-tarballs’ is even faster to type.

> Which Guile do I need?  The stripped one, right?

The one that’s in the output of ‘guix build bootstrap-tarballs’ (I
forgot the name.)

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-02  9:08                   ` New ‘--list-generations’ and ‘--delete-generations’ options Ludovic Courtès
@ 2013-09-05  1:30                     ` Nikita Karetnikov
  2013-09-05 20:00                       ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-05  1:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 319 bytes --]

The attached procedure will be invoked when either option is called with
an argument.

It returns an empty list if the argument is not valid.  Or when the
needed generation can’t be found.

Do you see any problems?  Please check everything (especially the
‘first-month’ and ‘last-month’ functions).


[-- Attachment #1.2: avail-generations.scm --]
[-- Type: text/plain, Size: 4642 bytes --]

(use-modules (srfi srfi-1)
             (srfi srfi-11)
             (srfi srfi-26)
             (ice-9 regex)
             (ice-9 optargs))

(define profile-numbers (@@ (guix scripts package) profile-numbers))
(define %current-profile (@@ (guix scripts package) %current-profile))

;; XXX: (avail-generations "") returns () (because of (csi)).  This case
;; should be handled by a different procedure.  Basically, it means that no
;; arguments were passed to '--list-generations' or '--delete-generations'.
(define* (avail-generations str #:optional (profile %current-profile))
  "Return a list of generations matching the pattern in STR."
  (define (valid-gen? n)
    ;; Is N a valid generation number?
    (any (cut = n <>) (profile-numbers profile)))

  (define (valid-gens lst)
    ;; Return a list of valid generation numbers.
    (fold-right (lambda (x lst)
                  (if (valid-gen? x)
                      (cons x lst)
                      lst))
                '()
                lst))

  (define (int)
    ;; Does STR contain an integer?
    (let ((x (string->number str)))
      (and (integer? x)
           (valid-gen? x)
           (list x))))

  (define (csi)
    ;; Does STR contain comma-separated integers?

    ;; XXX: Should it handle spaces?
    ;;
    ;; (let* ((str* (string-concatenate (string-split str #\space)))
    ;;        (lst  (map string->number (delete "" (string-split str* #\,)))))
    ;;
    ;; The uncommented version returns '() for "1,2 ", "2, 3", "2 ,3", etc.
    ;; (The other procedures don't handle similar cases too.)
    (let ((lst (delete-duplicates
                (map string->number
                     (delete "" (string-split str #\,))))))
      (and (every integer? lst)
           (valid-gens lst))))

  (define (safe-match:substring->number match n)
    (false-if-exception (string->number (match:substring match n))))

  (define (whole-range)
    (let* ((rx  (make-regexp "^([0-9]+)\\.\\.([0-9]+)$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1))
           (y   (safe-match:substring->number res 2)))
      (and (every integer? (list x y))
           (<= x y)                     ; in Haskell, [1..1] => [1]
           (valid-gens (iota (1+ (- y x)) x)))))

  (define (start-range)
    (let* ((rx  (make-regexp "^([0-9]+)\\.\\.$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1)))
      (and (integer? x)
           (drop-while (cut > x <>)
                       ;; XXX: Is it really necessary to sort?
                       (sort (profile-numbers profile) <)))))

  (define (end-range)
    (let* ((rx  (make-regexp "^\\.\\.([0-9]+)$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1)))
      (and (integer? x)
           (valid-gens (iota x 1)))))

  (define dates-gens
    ;; Return an alist of dates and generations.
    (map (lambda (x)
           (cons (and=> (stat (format #f "~a-~a-link"
                                      ;; XXX: Should I check that
                                      ;; 'number->string's argument is
                                      ;; actually a number?  Can I
                                      ;; trust 'profile-numbers'?
                                      profile (number->string x)))
                        stat:ctime)
                 x))
         ;; XXX: Is there a need to sort?
         (sort (profile-numbers profile) <)))

  (define dates
    (fold-right (lambda (x lst)
                  (cons (first x) lst))
                '()
                dates-gens))

  (define (first-month)
    (let ((x (+ (apply min dates) (* 30 86400)))) ; add 30 days
      (and (string=? "first-month" str)
           (map (cut assoc-ref dates-gens <>)
                (filter (cut >= x <>) dates)))))

  (define (last-month)
    (let ((x (- (apply max dates) (* 30 86400)))) ; subtract 30 days
      (and (string=? "last-month" str)
           (map (cut assoc-ref dates-gens <>)
                (filter (cut <= x <>) dates)))))

  (or (int) (csi)
      (whole-range) (start-range) (end-range)
      (first-month) (last-month) '()))

;;;
;;; Valid syntax.
;;;

(for-each (lambda (x)
       (display (avail-generations x)) (newline))
     (list "1" "6" "12"

           "3,"
           "4,4"
           "2,3"
           "4,5,1,2"
           "3,2,3,"

           "1..3"
           "2..4"
           "1..11"
           "3..3"
           "12..12"

           "1.."
           "3.."
           "13.."

           "..1"
           "..7"
           "..14"

           "first-month"
           "last-month"))


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-05  1:30                     ` Nikita Karetnikov
@ 2013-09-05 20:00                       ` Ludovic Courtès
  2013-09-05 21:14                         ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-05 20:00 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> The attached procedure will be invoked when either option is called with
> an argument.

Nice.

BTW, what did you think of the idea of using recutils format as the
output?  (Either as the sole output format, or otherwise as a secondary
format.)

> Do you see any problems?  Please check everything (especially the
> ‘first-month’ and ‘last-month’ functions).

Better yet: write test cases.  :-)

> ;; XXX: (avail-generations "") returns () (because of (csi)).  This case
> ;; should be handled by a different procedure.  Basically, it means that no
> ;; arguments were passed to '--list-generations' or '--delete-generations'.
> (define* (avail-generations str #:optional (profile %current-profile))

Please, never use abbreviations in public identifiers, and avoid them in
private identifiers too (‘valid-generation?’, ‘maybe-integer’ instead of
‘int’, etc.)

>   "Return a list of generations matching the pattern in STR."

What about splitting it in two functions:

  ‘string->time-range’ → return two SRFI-19 time objects representing a
                          time interval, or #f and #f on failure

  ‘generation-within-time-range?’

Writing tests for the former will be easy.

The code otherwise looks OK, but disentangling parsing from validation
will make it even more pleasant IMO.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-05 20:00                       ` Ludovic Courtès
@ 2013-09-05 21:14                         ` Nikita Karetnikov
  2013-09-07 19:34                           ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-05 21:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]

> BTW, what did you think of the idea of using recutils format as the
> output?  (Either as the sole output format, or otherwise as a secondary
> format.)

I like the idea.  It’s always better to use a documented format,
especially when it comes with a mode for Emacs.  And don’t forget that
‘--search’ already uses recutils.  I didn’t say anything before because
I haven’t tried to implement this part yet.

>> Do you see any problems?  Please check everything (especially the
>> ‘first-month’ and ‘last-month’ functions).

> Better yet: write test cases.  :-)

I have some tests, but you have to modify ‘int’ and the other related
procedures to use them.  So it’s not an option.

I’m also not sure what’s the best way to test the ‘first-month’ and
‘last-month’ functions (the validation part).  Any ideas?

> The code otherwise looks OK, but disentangling parsing from validation
> will make it even more pleasant IMO.

I agree.  I just haven’t found a way that avoids unnecessary repetition.

(I’ll comment on other issues later.)

Could you share your thoughts on other things that are marked with
“XXX”?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-04 12:18         ` Ludovic Courtès
@ 2013-09-06  8:35           ` Nikita Karetnikov
  2013-09-06  9:46             ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-06  8:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

> Oh indeed, using ‘-s’ was a good idea.  Note that ‘guix build
> bootstrap-tarballs’ is even faster to type.

Thanks.

>> Which Guile do I need?  The stripped one, right?

> The one that’s in the output of ‘guix build bootstrap-tarballs’ (I
> forgot the name.)

Yep, the stripped one.

Can I download the bootstrap tarballs from the web interface of Hydra?
(Otherwise, I’ll have to configure a web server myself.  I’d like to
avoid that.)

Also, I’ve noticed that your tarballs (the ones in /tmp) are different
From the ones I use.  Does it raise a flag?  Was there a change in the
inputs?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* ‘--no-substitutes’ is ignored on i686 (was: Goals for 0.4)
  2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
                   ` (3 preceding siblings ...)
  2013-09-02 17:33 ` Cyril Roelandt
@ 2013-09-06  9:19 ` Nikita Karetnikov
  2013-09-06  9:59   ` ‘--no-substitutes’ is ignored on i686 Ludovic Courtès
  2013-09-24 21:59 ` Goals for 0.4 Ludovic Courtès
  5 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-06  9:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

> • Guix must be usable with the old Guile 2.0.5, since that’s what some
>   distros provide.  At the GHM I realized that some people had weird
>   bugs with that Guile, notably in the substituter.  I fixed a couple
>   of bugs, but there may be others around.

>   So, to 2.0.5 users: please run ‘make check’, use Guix and in
>   particular the substituter, and report bugs!

I’m using the latest version of Guile.  And I’ve already mentioned this
(though, it might be a new issue): ‘--no-substitutes’ doesn’t work on my
system at all.  It’s completely ignored.  (I haven’t tested on a
different machine.)

I’ll try to look into it when I finish with generations and MIPS.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-06  8:35           ` Nikita Karetnikov
@ 2013-09-06  9:46             ` Ludovic Courtès
  2013-09-07  2:45               ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-06  9:46 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Oh indeed, using ‘-s’ was a good idea.  Note that ‘guix build
>> bootstrap-tarballs’ is even faster to type.
>
> Thanks.
>
>>> Which Guile do I need?  The stripped one, right?
>
>> The one that’s in the output of ‘guix build bootstrap-tarballs’ (I
>> forgot the name.)
>
> Yep, the stripped one.
>
> Can I download the bootstrap tarballs from the web interface of Hydra?

Why not do ‘guix build bootstrap-tarballs -s x86_64-linux --target=...’?

> Also, I’ve noticed that your tarballs (the ones in /tmp) are different
> From the ones I use.  Does it raise a flag?  Was there a change in the
> inputs?

It’s likely that something changed in the inputs in the meantime.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: ‘--no-substitutes’ is ignored on i686
  2013-09-06  9:19 ` ‘--no-substitutes’ is ignored on i686 (was: Goals for 0.4) Nikita Karetnikov
@ 2013-09-06  9:59   ` Ludovic Courtès
  2013-09-07  8:43     ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-06  9:59 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> • Guix must be usable with the old Guile 2.0.5, since that’s what some
>>   distros provide.  At the GHM I realized that some people had weird
>>   bugs with that Guile, notably in the substituter.  I fixed a couple
>>   of bugs, but there may be others around.
>
>>   So, to 2.0.5 users: please run ‘make check’, use Guix and in
>>   particular the substituter, and report bugs!
>
> I’m using the latest version of Guile.  And I’ve already mentioned this
> (though, it might be a new issue): ‘--no-substitutes’ doesn’t work on my
> system at all.  It’s completely ignored.  (I haven’t tested on a
> different machine.)

In which command?  guix build, guix package, guix-daemon?

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-06  9:46             ` Ludovic Courtès
@ 2013-09-07  2:45               ` Nikita Karetnikov
  2013-09-07 12:57                 ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-07  2:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

>> Can I download the bootstrap tarballs from the web interface of Hydra?

> Why not do ‘guix build bootstrap-tarballs -s x86_64-linux --target=...’?

When I tested the previous set of binaries (see the mips64el branch), it
was necessary to adjust ‘%url-base’ in ‘build-aux/download.scm’.  It
seems that now it’s not needed since they are already available on
hydra.gnu.org.

What I’ve done so far:

1. Added ‘mips64el-linux-gnuabi64’ to ‘glibc-dynamic-linker’ in
   ‘bootstrap.scm’.

2. Adjusted ‘%bootstrap-coreutils&co’ and similar procedures.

3. Created ‘mips64el-linux-gnuabi64’ in ‘gnu/packages/bootstrap/’.

4. Placed ‘bash’, ‘mkdir’, ‘tar’, ‘xz’, and ‘guile-2.0.7.tar.xz’* in
   that directory.

   * It’s 2.0.9.  I decided not to touch ‘%bootstrap-guile’ for now to
     avoid errors.

Am I on the right track?

Now, how can I test it?  My machine uses a different ABI (N32), so
‘%current-system’ is set to ‘mips64el-linux’.  I’ve already tried to run

  $ ./pre-inst-env guix build -K -s mips64el-linux-gnuabi64 hello

but that failed with

  guix build: error: build failed: a `mips64el-linux-gnuabi64' is
  required to build `/nix/store/…guile-bootstrap-2.0.drv', but I am a
  `mips64el-linux'

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: ‘--no-substitutes’ is ignored on i686
  2013-09-06  9:59   ` ‘--no-substitutes’ is ignored on i686 Ludovic Courtès
@ 2013-09-07  8:43     ` Nikita Karetnikov
  2013-09-07 13:00       ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-07  8:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

> In which command?  guix build, guix package, guix-daemon?

‘guix build’ and ‘guix package’ when ‘guix-daemon’ runs without
‘--no-substitutes’.  (I was able to reproduce this on a different i686
machine.)

When the daemon uses the mentioned option, ‘guix build’ and ‘guix
package’ work as expected.  

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-07  2:45               ` Nikita Karetnikov
@ 2013-09-07 12:57                 ` Ludovic Courtès
  2013-09-08 14:21                   ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-07 12:57 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> When I tested the previous set of binaries (see the mips64el branch), it
> was necessary to adjust ‘%url-base’ in ‘build-aux/download.scm’.  It
> seems that now it’s not needed since they are already available on
> hydra.gnu.org.

Well, when you’ve confirmed that you’ve managed to build something with
these binaries, I’ll upload them to alpha.gnu.org, and then we can have
bootstrap.scm and build-aux/download.scm refer to that.

> What I’ve done so far:
>
> 1. Added ‘mips64el-linux-gnuabi64’ to ‘glibc-dynamic-linker’ in
>    ‘bootstrap.scm’.
>
> 2. Adjusted ‘%bootstrap-coreutils&co’ and similar procedures.
>
> 3. Created ‘mips64el-linux-gnuabi64’ in ‘gnu/packages/bootstrap/’.

Hmm, I think we should just call it ‘mips64el-linux’ since the ABI is
really something orthogonal.

> 4. Placed ‘bash’, ‘mkdir’, ‘tar’, ‘xz’, and ‘guile-2.0.7.tar.xz’* in
>    that directory.
>
>    * It’s 2.0.9.  I decided not to touch ‘%bootstrap-guile’ for now to
>      avoid errors.

What do you mean?  ‘%bootstrap-guile’ needs to refer to that new
tarball, right?

> Am I on the right track?

I think so!

> Now, how can I test it?  My machine uses a different ABI (N32), so
> ‘%current-system’ is set to ‘mips64el-linux’.  I’ve already tried to run
>
>   $ ./pre-inst-env guix build -K -s mips64el-linux-gnuabi64 hello
>
> but that failed with
>
>   guix build: error: build failed: a `mips64el-linux-gnuabi64' is
>   required to build `/nix/store/…guile-bootstrap-2.0.drv', but I am a
>   `mips64el-linux'

Good question.  I think we should use ‘mips64el-linux’ as the system
type (which is really just ARCHITECTURE-KERNEL).  IOW, let’s not use
‘mips64el-linux-gnuabi64’ anywhere, except as a GNU triplet when
cross-compiling.

When we want to support multiple ABIs for a given ARCHITECTURE-KERNEL
tuple, we’ll have to provide a mechanism in addition to --system that
would allow users to select the libc/gcc/binutils to use, I think.

For now, let’s just keep it simple and use ‘mips64el-linux’ for N64.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: ‘--no-substitutes’ is ignored on i686
  2013-09-07  8:43     ` Nikita Karetnikov
@ 2013-09-07 13:00       ` Ludovic Courtès
  2013-09-08 11:53         ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-07 13:00 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> ‘guix build’ and ‘guix package’ when ‘guix-daemon’ runs without
> ‘--no-substitutes’.  (I was able to reproduce this on a different i686
> machine.)

What exactly makes you think it’s ignored?  Could you copy/paste a
faulty-looking session?

TIA,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-05 21:14                         ` Nikita Karetnikov
@ 2013-09-07 19:34                           ` Ludovic Courtès
  2013-09-08 10:59                             ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-07 19:34 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> BTW, what did you think of the idea of using recutils format as the
>> output?  (Either as the sole output format, or otherwise as a secondary
>> format.)
>
> I like the idea.  It’s always better to use a documented format,
> especially when it comes with a mode for Emacs.  And don’t forget that
> ‘--search’ already uses recutils.  I didn’t say anything before because
> I haven’t tried to implement this part yet.

I’m asking because if we do that, ‘--list-generations’ may just as well
print out *all* the generation records.  Users who want to select only
less than one-month old generations can do that with ‘recsel’, and we
don’t have anything more to do.

WDYT?

OTOH, for ‘--delete-generations’ it will still be more convenient to
support ‘--delete-generations’.

>>> Do you see any problems?  Please check everything (especially the
>>> ‘first-month’ and ‘last-month’ functions).
>
>> Better yet: write test cases.  :-)
>
> I have some tests, but you have to modify ‘int’ and the other related
> procedures to use them.  So it’s not an option.
>
> I’m also not sure what’s the best way to test the ‘first-month’ and
> ‘last-month’ functions (the validation part).  Any ideas?

I think you find it difficult to test because the parsing and generation
enumeration are intermingled.

If parsing is separated as I suggested, with a ‘string->date-range’
procedure, then it becomes trivial to write test cases for that.

>> The code otherwise looks OK, but disentangling parsing from validation
>> will make it even more pleasant IMO.
>
> I agree.  I just haven’t found a way that avoids unnecessary repetition.

What do you think of the separation I proposed?

> Could you share your thoughts on other things that are marked with
> “XXX”?

I don’t have much to say on these at this stage, but I think it’d be
easier to comment on the next version of the patch.  :-)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-07 19:34                           ` Ludovic Courtès
@ 2013-09-08 10:59                             ` Nikita Karetnikov
  2013-09-08 20:22                               ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-08 10:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3148 bytes --]

> I’m asking because if we do that, ‘--list-generations’ may just as well
> print out *all* the generation records.  Users who want to select only
> less than one-month old generations can do that with ‘recsel’, and we
> don’t have anything more to do.

> WDYT?

I see recutils as an advanced option (for those who need it), not a
replacement for the basic functionality.

> OTOH, for ‘--delete-generations’ it will still be more convenient to
> support ‘--delete-generations’.

Could you rephrase?  I don’t understand the above.  I believe we should
think from a user’s perspective.  One should be able to select the
needed generations without relying on a different program.

> I think you find it difficult to test because the parsing and generation
> enumeration are intermingled.

Right, I agree.

>>> What about splitting it in two functions:

>>>   ‘string->time-range’ → return two SRFI-19 time objects representing a
>>>                           time interval, or #f and #f on failure

>>>   ‘generation-within-time-range?’

>>> Writing tests for the former will be easy.

> What do you think of the separation I proposed?

We have the following cases: ‘1’, ‘1,2,3’, ‘1..9’, ‘1..’, ‘..9’,
‘first-month’, and ‘last-month’.  It’s easy to parse the first three and
output a list of generations without checking them.  However, you’ll
have to check the profile in the other cases.  That’s the problem.

It’s also possible to write something like this (untested):

(define (available-generations str)
  (define (integer?*)
    (integer? (string->number str)))

  (define (comma-separated-integers?)
    (every integer?
           (delete-duplicates
            (map string->number
                 (delete "" (string-split str #\,))))))

  (define (safe-match:substring->number match n)
    (false-if-exception (string->number (match:substring match n))))

  (define (maybe-whole-range-lst)
    (let* ((rx  (make-regexp "^([0-9]+)\\.\\.([0-9]+)$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1))
           (y   (safe-match:substring->number res 2)))
      (list x y)))

  (define (whole-range?)
    (let ((x (first maybe-whole-range-lst))
          (y (last maybe-whole-range-lst)))
      (and (every integer? (maybe-whole-range-lst))
           (<= x y))))

  (define (maybe-start-range)
    (let* ((rx  (make-regexp "^([0-9]+)\\.\\.$"))
           (res (regexp-exec rx str)))
      (safe-match:substring->number res 1)))

  (define (start-range?)
    (integer? (maybe-start-range)))

  ;; ...

  )

First, this is quite wordy.  Moreover, we’ll have to move every
definition to the global namespace if we want to test only syntax.
I doubt that the above is the way to go.

I don’t understand how the ‘string->time-range’ function will help to
solve the above problem.  There are only two time-related cases:
‘first-month’ and ‘last-month’.  Why do you want to return a time range
for every case?  Could you show an example?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: ‘--no-substitutes’ is ignored on i686
  2013-09-08 11:53         ` Nikita Karetnikov
@ 2013-09-08 11:51           ` Cyril Roelandt
  2013-09-08 13:22             ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Cyril Roelandt @ 2013-09-08 11:51 UTC (permalink / raw)
  To: guix-devel

On 09/08/2013 01:53 PM, Nikita Karetnikov wrote:
>   ./pre-inst-env guix build --no-substitutes gnupg

I can confirm this bug on i686. The same happens with "guix package 
--no-substitutes -i gnupg". On x86-64, everything works as expected.

Cyril.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: ‘--no-substitutes’ is ignored on i686
  2013-09-07 13:00       ` Ludovic Courtès
@ 2013-09-08 11:53         ` Nikita Karetnikov
  2013-09-08 11:51           ` Cyril Roelandt
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-08 11:53 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 4326 bytes --]

>> ‘guix build’ and ‘guix package’ when ‘guix-daemon’ runs without
>> ‘--no-substitutes’.  (I was able to reproduce this on a different i686
>> machine.)

> What exactly makes you think it’s ignored?  Could you copy/paste a
> faulty-looking session?

$ ./pre-inst-env guix build --no-substitutes gnupg
The following derivations will be built:
   /nix/store/swyylv56n9fpnxnqw5h5gy95mpjmf0lx-gnupg-2.0.20.drv
   /nix/store/pxvw878a2fw8rd64sads063hx5kjijns-openldap-2.4.33.tgz.drv
   /nix/store/smqppmc5sd9frz4d19vfwfj4bhxqda99-libtool-2.4.2.drv
   /nix/store/8s2k9k4l3aixvn857swxs885qkyg05id-psutils.tar.gz.drv
   /nix/store/4y4brrb4rmwql317kbvds741ilgi9msd-jpegsrc.v9.tar.gz.drv
   /nix/store/5ikf53ls2i6xdaaddw1sm010g6wzyd7j-libxml2-2.9.0.tar.gz.drv
   /nix/store/yb62gz206w2pp6nqpwr2ijmfj7723qbx-indent-2.2.10.tar.gz.drv
   /nix/store/7w7758084p0ili52j9vrw8dkq3r8r3wc-flex-2.5.37.tar.bz2.drv
   /nix/store/qm95baqg5b9hh54nlclmrlpxafdpk1zk-indent-2.2.10.drv
   /nix/store/4xhz8blfj99nrrvrsdqjmipqsrn5xwi6-flex-2.5.37.drv
   /nix/store/k422hqd2l18zphlnz1rri9qbxknzxgwj-netpbm-10.61.01.tar.xz.drv
   /nix/store/l8z4xp49zr2j4478lpba6c65n8dpxvai-libxml2-2.9.0.drv
   /nix/store/xd3dwjvji806xnxp2jsnncijy0wg1scc-libjpeg-9.drv
   /nix/store/ww3rvxm17c2zyksdhnkn5piah0xxvq3s-bison-2.7.1.tar.xz.drv
   /nix/store/9qdbzgw6v682rzlv9a3qczi5760kqqhi-tcl8.6.0-src.tar.gz.drv
   /nix/store/8blqb9n9fsp1h0lvgvyb1fgnn17nphg2-libpaper_1.1.24.tar.gz.drv
   /nix/store/x644bps9lc3yii90chixhbvzkmky2hlg-jpegsrc.v8d.tar.gz.drv
   /nix/store/19pc2f3ip6qcic7hx3xqwwqdac02d1al-module-import.drv
   /nix/store/c8ab23r4cj2g6zaf98ypxcz0qjq9vw2z-module-import-compiled.drv
   /nix/store/n7nx64sd8hv3lhi54763c6777v1hs6na-Python-2.7.5.tar.xz.drv
   /nix/store/fn31pxbjjcs4g759cqlr830cb3vcw3h0-file-5.12.tar.gz.drv
   /nix/store/b2va43nfrwdnj5acpjxw33byyggvwalc-file-5.12.drv
   /nix/store/hcqbbfqirdzmsnil735sskr5s92px8pj-tiff-4.0.3.tar.gz.drv
   /nix/store/an93n6pkia8lf49y7grbd5dkbrbfh8yh-libpng-1.5.17.tar.xz.drv
   /nix/store/2dpajnb37mf9s9axvb0lja5idx06xfyq-freetype-2.4.11.tar.gz.drv
   /nix/store/k3plxynf8xphaqakk48x9zdd012602y2-lcms2-2.4.tar.gz.drv
   /nix/store/08qhs6n7dyqfj3bmf2mkwq3lyj0qjss0-gnu-ghostscript-9.06.0.tar.xz.drv
   /nix/store/3cxxdn6i3sql8gh5a11mfmx68hycrq87-lcms-2.4.drv
   /nix/store/8yzwzgbxba5xczvd9c4nrfwv7w9wszxa-freetype-2.4.11.drv
   /nix/store/c6mh84ncnw4w3733xvcxw38wr0czb70w-libpng-1.5.17.drv
   /nix/store/dr8qz0vbkv5ya2lfsppk9hcifq0y8cay-libtiff-4.0.3.drv
   /nix/store/jj3pjz786pqzv3szyhcnwz1an1vjjagn-python-2.7.5.drv
   /nix/store/rhd80qqfz3nlac0vyvm63fw044q82gr7-libjpeg-8d.drv
   /nix/store/y79bjq6nj5mk3d4qdp1i2fzm1mj5zam9-libpaper-1.1.24.drv
   /nix/store/z56cj63ry7dhidapws29mdvn8m17b5zg-tcl-8.6.0.drv
   /nix/store/4gv47zr1spxl2rawcz6v4nfqrqm7prd1-ghostscript-9.06.0.drv
   /nix/store/8kfr7395i84sbd4hrhhfhgc47wvj49ln-bison-2.7.1.drv
   /nix/store/9s9zzg3q7lpwd2di95blxa01b8addz1f-groff-1.22.2.tar.gz.drv
   /nix/store/gr7850fqnjl3jzvlf9j3iqfizcgwgfxa-netpbm-10.61.01.drv
   /nix/store/jzi31aih10imcpfvw2d86hh12mzy28vc-psutils-17.drv
   /nix/store/cgkm9m0ncyh45yn11k3qn5iq0ihdrsaj-groff-1.22.2.drv
   /nix/store/s5c89ln277ll2nwszp4yb7x698ax9hva-curl-7.28.1.tar.lzma.drv
   /nix/store/1c3x3mqcpn4vym6m9119l396kajqfygw-gnupg-2.0.20.tar.bz2.drv
   /nix/store/2dbks70qns3zk8h4gqi2dm7pah9rf5aw-curl-7.28.1.drv
   /nix/store/2lv3by85li0lxkl2qcv2xa7by80kn3yq-openldap-2.4.33.drv
   /nix/store/k765wvxqk82fsvlzx297cwl24wl9xzx6-bzip2-1.0.6.drv
@ substituter-started /nix/store/568swmv4cw0jcs8rr0vriw4wsfrfrv3h-openldap-2.4.33 /home/tester/guix-test/nix/scripts/substitute-binary
downloading `/nix/store/568swmv4cw0jcs8rr0vriw4wsfrfrv3h-openldap-2.4.33' from `http://hydra.gnu.org/nar/568swmv4cw0jcs8rr0vriw4wsfrfrv3h-openldap-2.4.33' (7.3 MiB installed)...
http://hydra.gnu.org/nar/568swmv4cw0jcs8rr0vriw4wsfrfrv3h-openldap-2.4.33	2192.0 KiB transferred@ substituter-succeeded /nix/store/568swmv4cw0jcs8rr0vriw4wsfrfrv3h-openldap-2.4.33
@ substituter-started /nix/store/60cjlv89nibps2mhhqgdjq9badf9qffd-curl-7.28.1 /home/tester/guix-test/nix/scripts/substitute-binary
downloading `/nix/store/60cjlv89nibps2mhhqgdjq9badf9qffd-curl-7.28.1' from `http://hydra.gnu.org/nar/60cjlv89nibps2mhhqgdjq9badf9qffd-curl-7.28.1' (1.7 MiB installed)...

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: ‘--no-substitutes’ is ignored on i686
  2013-09-08 11:51           ` Cyril Roelandt
@ 2013-09-08 13:22             ` Nikita Karetnikov
  0 siblings, 0 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-08 13:22 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

> I can confirm this bug on i686. The same happens with "guix package
> --no-substitutes -i gnupg". On x86-64, everything works as expected.

Does it mean that the daemon is the cause of the problem since the error
is platform-specific?   Also, note this line:

  The following derivations will be built: …

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-07 12:57                 ` Ludovic Courtès
@ 2013-09-08 14:21                   ` Nikita Karetnikov
  2013-09-08 19:54                     ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-08 14:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

>> 3. Created ‘mips64el-linux-gnuabi64’ in ‘gnu/packages/bootstrap/’.

> Hmm, I think we should just call it ‘mips64el-linux’ since the ABI is
> really something orthogonal.

I’ve already tried that:

$ ./pre-inst-env guix build -K -s mips64el-linux-gnuabi64 hello

[…]

ERROR: bootstrap binary not found "tar" "mips64el-linux-gnuabi64"

How would you change ‘bootstrap.scm’ to handle this?

>>    * It’s 2.0.9.  I decided not to touch ‘%bootstrap-guile’ for now to
>>      avoid errors.

> What do you mean?  ‘%bootstrap-guile’ needs to refer to that new
> tarball, right?

Yes, ‘%bootstrap-guile’ expects a binary called ‘guile-2.0.7.tar.xz’:

  (guile (->store "guile-2.0.7.tar.xz"))

> When we want to support multiple ABIs for a given ARCHITECTURE-KERNEL
> tuple, we’ll have to provide a mechanism in addition to --system that
> would allow users to select the libc/gcc/binutils to use, I think.

It would be better to do that, yes.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-08 14:21                   ` Nikita Karetnikov
@ 2013-09-08 19:54                     ` Ludovic Courtès
  2013-09-09  5:38                       ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-08 19:54 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> 3. Created ‘mips64el-linux-gnuabi64’ in ‘gnu/packages/bootstrap/’.
>
>> Hmm, I think we should just call it ‘mips64el-linux’ since the ABI is
>> really something orthogonal.
>
> I’ve already tried that:
>
> $ ./pre-inst-env guix build -K -s mips64el-linux-gnuabi64 hello
>
> […]
>
> ERROR: bootstrap binary not found "tar" "mips64el-linux-gnuabi64"
>
> How would you change ‘bootstrap.scm’ to handle this?

As I wrote, call it ‘mips64el-linux’, and put the binaries under the
directory of that name.

>>>    * It’s 2.0.9.  I decided not to touch ‘%bootstrap-guile’ for now to
>>>      avoid errors.
>
>> What do you mean?  ‘%bootstrap-guile’ needs to refer to that new
>> tarball, right?
>
> Yes, ‘%bootstrap-guile’ expects a binary called ‘guile-2.0.7.tar.xz’:
>
>   (guile (->store "guile-2.0.7.tar.xz"))

Aah, right.  Well, either call it this way, or do something like:

  (->store
    (if (string=? (%current-system) "mips64el-linux")
        "guile-2.0.9.tar.xz"
        "guile-2.0.7.tar.xz"))
      
HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-08 10:59                             ` Nikita Karetnikov
@ 2013-09-08 20:22                               ` Ludovic Courtès
  2013-09-09  9:17                                 ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-08 20:22 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> I’m asking because if we do that, ‘--list-generations’ may just as well
>> print out *all* the generation records.  Users who want to select only
>> less than one-month old generations can do that with ‘recsel’, and we
>> don’t have anything more to do.
>
>> WDYT?
>
> I see recutils as an advanced option (for those who need it), not a
> replacement for the basic functionality.

Yeah, possibly.

In that case, would you suggest --list-generations=rec to specify the
recutils output format (with no filtering)?

>> OTOH, for ‘--delete-generations’ it will still be more convenient to
>> support ‘--delete-generations’.
>
> Could you rephrase?

Oops, sorry; this should read:

  OTOH for ‘--delete-generations’ it will be more convenient to support
  date-range specifications such as ‘last-month’, etc.

> I don’t understand the above.  I believe we should think from a user’s
> perspective.  One should be able to select the needed generations
> without relying on a different program.

Yes.

>>>> What about splitting it in two functions:
>
>>>>   ‘string->time-range’ → return two SRFI-19 time objects representing a
>>>>                           time interval, or #f and #f on failure
>
>>>>   ‘generation-within-time-range?’
>
>>>> Writing tests for the former will be easy.
>
>> What do you think of the separation I proposed?
>
> We have the following cases: ‘1’, ‘1,2,3’, ‘1..9’, ‘1..’, ‘..9’,
> ‘first-month’, and ‘last-month’.  It’s easy to parse the first three and
> output a list of generations without checking them.  However, you’ll
> have to check the profile in the other cases.  That’s the problem.

[...]

> I don’t understand how the ‘string->time-range’ function will help to
> solve the above problem.  There are only two time-related cases:
> ‘first-month’ and ‘last-month’.  Why do you want to return a time range
> for every case?  Could you show an example?

Sorry I think I have been sloppy.

So we want to support generation enumerations like ‘1,2,3’, ranges
(incl. open-ended ranges) like ‘1..9’, and age specifications.

For the first one, I would do a ‘string->generations’ procedure:

  "1,2,3"  ⇒ (1 2 3)
  "1..9"   ⇒ (1 2 3 4 5 6 7 8 9)
  "..9"    ⇒ (<= 9)  ; with the ‘<=’ symbol
  "1.."    ⇒ (>= 1)
  "foo"    ⇒ #f

Age specifications would only be of the kind “at least X days/months
old”.  A non-ambiguous syntax is needed, and something more flexible
than just ‘last-month’.  Let’s assume ‘string->duration’:

  "+22"    ⇒ #<time time-duration ...>   ; 22 days
  "+2w"    ⇒ #<time time-duration ...>   ; 14 days
  "+1m"    ⇒ #<time time-duration ...>   ; 30 days
  
Then one just needs to ‘filter’ all the generations that match the
specification.  This way, there are two parsing procedures, and one or
two filtering procedures.


These are just suggestions, but that seems to make more sense now.
WDYT?

Apologies for the confusion!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-08 19:54                     ` Ludovic Courtès
@ 2013-09-09  5:38                       ` Nikita Karetnikov
  2013-09-09 16:47                         ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-09  5:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

>> I’ve already tried that:
>>
>> $ ./pre-inst-env guix build -K -s mips64el-linux-gnuabi64 hello
>>
>> […]
>>
>> ERROR: bootstrap binary not found "tar" "mips64el-linux-gnuabi64"

> As I wrote, call it ‘mips64el-linux’, and put the binaries under the
> directory of that name.

I did that but forgot to adjust ‘-s mips64el-linux-gnuabi64’.  So I’ve
just tried this command:

$ ./pre-inst-env guix build -K -s mips64el-linux hello

The bootstrap Guile binary that I fetched from Hydra [1] aborts when
‘./guile --version’ is called.  But this one works [2].  What has
happened?

I’ve also tested ‘./tar --version’ (the one from Hydra), and it works.

Could you run the following command and paste the hashsums?

$ ./pre-inst-env guix build bootstrap-tarballs -s x86_64-linux --target=mips64el-linux-gnuabi64

[1] https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00046.html
[2] http://www.fdn.fr/~lcourtes/tmp/guile-static-stripped-2.0.9-mips64el-linux-gnuabi64.tar.xz

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-08 20:22                               ` Ludovic Courtès
@ 2013-09-09  9:17                                 ` Nikita Karetnikov
  2013-09-09 16:55                                   ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-09  9:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]

> In that case, would you suggest --list-generations=rec to specify the
> recutils output format (with no filtering)?

No need for the ‘rec’ part.  I propose to output all generations in the
recutils format when ‘--list-generations’ is passed.

> Age specifications would only be of the kind “at least X days/months
> old”.  A non-ambiguous syntax is needed, and something more flexible
> than just ‘last-month’.  Let’s assume ‘string->duration’:

>   "+22"    ⇒ #<time time-duration ...>   ; 22 days
>   "+2w"    ⇒ #<time time-duration ...>   ; 14 days
>   "+1m"    ⇒ #<time time-duration ...>   ; 30 days

The plus sign is confusing (we’re subtracting).  I’d rather use ‘22d’,
‘2w’, and ‘1m’.

How can I subtract 22 days from (current-time) using SRFI-19?  There is
a ‘subtract-duration’ procedure, but I don’t understand how to create a
‘duration’ object.

> These are just suggestions, but that seems to make more sense now.

Indeed.

> Apologies for the confusion!

No worries.  Thanks for the tips.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-09  5:38                       ` Nikita Karetnikov
@ 2013-09-09 16:47                         ` Ludovic Courtès
  2013-09-27  2:16                           ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-09 16:47 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> I’ve already tried that:
>>>
>>> $ ./pre-inst-env guix build -K -s mips64el-linux-gnuabi64 hello
>>>
>>> […]
>>>
>>> ERROR: bootstrap binary not found "tar" "mips64el-linux-gnuabi64"
>
>> As I wrote, call it ‘mips64el-linux’, and put the binaries under the
>> directory of that name.
>
> I did that but forgot to adjust ‘-s mips64el-linux-gnuabi64’.  So I’ve
> just tried this command:
>
> $ ./pre-inst-env guix build -K -s mips64el-linux hello
>
> The bootstrap Guile binary that I fetched from Hydra [1] aborts when
> ‘./guile --version’ is called.  But this one works [2].  What has
> happened?

What’s the URL of the hydra.gnu.org tarballs you’re using?

Instead of a URL, you can also change bootstrap.scm to refer directly to
a local file name, like this:

  (package
    ...
    (source "/home/nikita/my-guile-that-works.tar.gz")
    ...)

> I’ve also tested ‘./tar --version’ (the one from Hydra), and it works.
>
> Could you run the following command and paste the hashsums?
>
> $ ./pre-inst-env guix build bootstrap-tarballs -s x86_64-linux --target=mips64el-linux-gnuabi64

The output paths are:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build bootstrap-tarballs -s x86_64-linux --target=mips64el-linux-gnuabi64 -n
The following files would be downloaded:
   /nix/store/m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0
   /nix/store/dhr8d58y48nds7njgg5hzq9b1a8yaaq5-gcc-stripped-tarball-4.7.3
   /nix/store/f995q3ypr3mwvl2bmwi6va7917rf7f22-guile-static-stripped-tarball-2.0.9
   /nix/store/hz7lk2xxfbm2s804nsw1ca1adin12dfn-static-binaries-tarball-0
   /nix/store/pkf0dm7m815p6ckam8chvv7825g6lzim-glibc-stripped-tarball-2.17
   /nix/store/wzwpq959jdg4p7ar775pwi8f4ph90jkp-binutils-static-stripped-tarball-2.23.2
--8<---------------cut here---------------end--------------->8---

> [1] https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00046.html
> [2] http://www.fdn.fr/~lcourtes/tmp/guile-static-stripped-2.0.9-mips64el-linux-gnuabi64.tar.xz

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-09  9:17                                 ` Nikita Karetnikov
@ 2013-09-09 16:55                                   ` Ludovic Courtès
  2013-09-11  5:16                                     ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-09 16:55 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> In that case, would you suggest --list-generations=rec to specify the
>> recutils output format (with no filtering)?
>
> No need for the ‘rec’ part.  I propose to output all generations in the
> recutils format when ‘--list-generations’ is passed.

OK.

>> Age specifications would only be of the kind “at least X days/months
>> old”.  A non-ambiguous syntax is needed, and something more flexible
>> than just ‘last-month’.  Let’s assume ‘string->duration’:
>
>>   "+22"    ⇒ #<time time-duration ...>   ; 22 days
>>   "+2w"    ⇒ #<time time-duration ...>   ; 14 days
>>   "+1m"    ⇒ #<time time-duration ...>   ; 30 days
>
> The plus sign is confusing (we’re subtracting).  I’d rather use ‘22d’,
> ‘2w’, and ‘1m’.

Fine with me.

> How can I subtract 22 days from (current-time) using SRFI-19?

Note that the above example suggests that ‘string->duration’ returns a
time object with of type ‘time-duration’ (thus independent of the
current time.)

Subtraction is done like this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (subtract-duration (current-time)
                        (make-time time-duration 0 (* 3600 24 22)))
$3 = #<time type: time-utc nanosecond: 357264000 second: 1376844845>
scheme@(guile-user)> (date->string (time-utc->date $3))
$4 = "Sun Aug 18 18:54:05+0200 2013"
--8<---------------cut here---------------end--------------->8---

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-09 16:55                                   ` Ludovic Courtès
@ 2013-09-11  5:16                                     ` Nikita Karetnikov
  2013-09-11 21:25                                       ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-11  5:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2461 bytes --]

>> How can I subtract 22 days from (current-time) using SRFI-19?

> Note that the above example suggests that ‘string->duration’ returns a
> time object with of type ‘time-duration’ (thus independent of the
> current time.)

Ah, OK.  But we’ll have to subtract from (current-time) later anyway,
right?  Why do you want to return a ‘time-duration’ object?

So, here’s the parsing phase.  WDYT?

(use-modules (srfi srfi-1)
             (srfi srfi-19)
             (ice-9 regex))

;;;
;;; Parsing.
;;;

(define (string->generations str)
  (define (maybe-integer)
    (let ((x (string->number str)))
      (and (integer? x)
           (list x))))

  (define (maybe-comma-separated-integers)
    (let ((lst (delete-duplicates
                (map string->number
                     (delete "" (string-split str #\,))))))
      (and (every integer? lst)
           lst)))

  (define (safe-match:substring->number match n)
    (false-if-exception (string->number (match:substring match n))))

  (define (maybe-whole-range)
    (let* ((rx  (make-regexp "^([0-9]+)\\.\\.([0-9]+)$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1))
           (y   (safe-match:substring->number res 2)))
      (and (every integer? (list x y))
           (<= x y)
           (iota (1+ (- y x)) x))))

  (define (maybe-start-range)
    (let* ((rx  (make-regexp "^([0-9]+)\\.\\.$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1)))
      (and (integer? x)
           `(>= ,x))))

  (define (maybe-end-range)
    (let* ((rx  (make-regexp "^\\.\\.([0-9]+)$"))
           (res (regexp-exec rx str))
           (x   (safe-match:substring->number res 1)))
      (and (integer? x)
           `(<= ,x))))

  (or (maybe-integer) (maybe-comma-separated-integers)
      (maybe-whole-range) (maybe-start-range) (maybe-end-range)))

(define (string->duration str)
  (define (maybe-duration hours pattern)
    (let ((res (regexp-exec (make-regexp pattern) str)))
      (false-if-exception
       (make-time time-duration 0
                  (* 3600 hours (string->number (match:substring res 1)))))))

  (define (days)
    (maybe-duration 24 "^([0-9]+)d$"))

  (define (weeks)
    (maybe-duration (* 24 7) "^([0-9]+)w$"))

  (define (months)
    (maybe-duration (* 24 30) "^([0-9]+)m$"))

  (or (days) (weeks) (months)))

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-11  5:16                                     ` Nikita Karetnikov
@ 2013-09-11 21:25                                       ` Ludovic Courtès
  2013-09-12  9:17                                         ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-11 21:25 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> How can I subtract 22 days from (current-time) using SRFI-19?
>
>> Note that the above example suggests that ‘string->duration’ returns a
>> time object with of type ‘time-duration’ (thus independent of the
>> current time.)
>
> Ah, OK.  But we’ll have to subtract from (current-time) later anyway,
> right?  Why do you want to return a ‘time-duration’ object?

To separate concerns, and to simplify testing.

> So, here’s the parsing phase.  WDYT?

Overall looks good to me, but I think it can be simplified:

> (define (string->generations str)
>   (define (maybe-integer)
>     (let ((x (string->number str)))
>       (and (integer? x)
>            (list x))))
>
>   (define (maybe-comma-separated-integers)
>     (let ((lst (delete-duplicates
>                 (map string->number
>                      (delete "" (string-split str #\,))))))
>       (and (every integer? lst)
>            lst)))


>   (define (safe-match:substring->number match n)
>     (false-if-exception (string->number (match:substring match n))))
>
>   (define (maybe-whole-range)
>     (let* ((rx  (make-regexp "^([0-9]+)\\.\\.([0-9]+)$"))
>            (res (regexp-exec rx str))
>            (x   (safe-match:substring->number res 1))
>            (y   (safe-match:substring->number res 2)))

By definition submatches 1 and 2 exist when RES is true.
Thus, I’d remove ‘safe-match:substring->number’ and do:

  (match (string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
    (#f #f)
    (matches
     (let ((start (number->string (match:substring matches 1)))
           (end   (number->string (match:substring matches 2))))
       ...)))

>   (or (maybe-integer) (maybe-comma-separated-integers)
>       (maybe-whole-range) (maybe-start-range) (maybe-end-range)))

Probably this can reduce to a big ‘cond’, which would be even more
readable:

  (cond ((maybe-integer)
         =>
         list)
        ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
         =>
         (lambda (match)
           ...))
        ...)

> (define (string->duration str)
>   (define (maybe-duration hours pattern)
>     (let ((res (regexp-exec (make-regexp pattern) str)))
>       (false-if-exception
>        (make-time time-duration 0
>                   (* 3600 hours (string->number (match:substring res 1)))))))
>
>   (define (days)
>     (maybe-duration 24 "^([0-9]+)d$"))
>
>   (define (weeks)
>     (maybe-duration (* 24 7) "^([0-9]+)w$"))
>
>   (define (months)
>     (maybe-duration (* 24 30) "^([0-9]+)m$"))
>
>   (or (days) (weeks) (months)))

Likewise, just:

  (define (hours->duration hours)
    (make-time ...))

  (cond ((string-match "^([0-9]+)d$" str)
         =>
         ...)
        ...)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-11 21:25                                       ` Ludovic Courtès
@ 2013-09-12  9:17                                         ` Nikita Karetnikov
  2013-09-12 12:26                                           ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-12  9:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1026 bytes --]

> By definition submatches 1 and 2 exist when RES is true.
> Thus, I’d remove ‘safe-match:substring->number’ and do:

>   (match (string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
>     (#f #f)
>     (matches
>      (let ((start (number->string (match:substring matches 1)))
>            (end   (number->string (match:substring matches 2))))
>        ...)))

Done.

> Probably this can reduce to a big ‘cond’, which would be even more
> readable:

>   (cond ((maybe-integer)
>          =>
>          list)
>         ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
>          =>
>          (lambda (match)
>            ...))
>         ...)

Are you sure?  I haven’t found a way to make ‘cond’ as readable as ‘or’.

I’m attaching a sketchy version.  If you don’t see any problems, I’ll
try to integrate this code into ‘package.scm’.

(Something is wrong with the store on my machine, so I can’t properly
test the filtering part.  But I’ll do it as soon as possible.)


[-- Attachment #1.2: avail-generations5.scm --]
[-- Type: text/plain, Size: 4232 bytes --]

(define-module (avail-generations)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-19)
  #:use-module (srfi srfi-26)
  #:use-module (ice-9 regex)
  #:use-module (ice-9 match))

(define profile-numbers (@@ (guix scripts package) profile-numbers))
(define %current-profile (@@ (guix scripts package) %current-profile))

;;;
;;; Parsing.
;;;

(define (string->generations str)
  (define (maybe-integer)
    (let ((x (string->number str)))
      (and (integer? x)
           (list x))))

  (define (maybe-comma-separated-integers)
    (let ((lst (delete-duplicates
                (map string->number
                     (delete "" (string-split str #\,))))))
      (and (every integer? lst)
           lst)))

  (define (maybe-whole-range)
    (match (string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
      (#f #f)
      (res
       (let ((s (string->number (match:substring res 1)))
             (e (string->number (match:substring res 2))))
         (and (every integer? (list s e))
              (<= s e)
              (iota (1+ (- e s)) s))))))

  (define (maybe-start-range)
    (match (string-match "^([0-9]+)\\.\\.$" str)
      (#f #f)
      (res
       (let ((s (string->number (match:substring res 1))))
         (and (integer? s)
              `(>= ,s))))))

  (define (maybe-end-range)
    (match (string-match "^\\.\\.([0-9]+)$" str)
      (#f #f)
      (res
       (let ((e (string->number (match:substring res 1))))
         (and (integer? e)
              `(<= ,e))))))

  (or (maybe-integer) (maybe-comma-separated-integers)
      (maybe-whole-range) (maybe-start-range) (maybe-end-range)))

(define (string->duration str)
  (define (maybe-duration hours pattern)
    (match (string-match pattern str)
      (#f #f)
      (res
       (make-time time-duration 0
                  (* 3600 hours (string->number (match:substring res 1)))))))

  (define (days)
    (maybe-duration 24 "^([0-9]+)d$"))

  (define (weeks)
    (maybe-duration (* 24 7) "^([0-9]+)w$"))

  (define (months)
    (maybe-duration (* 24 30) "^([0-9]+)m$"))

  (or (days) (weeks) (months)))


;;;
;;; Filtering.
;;;

(define* (available-generations str #:optional (profile %current-profile))
  (define (valid-generations lst)
    (define (valid-gen? n)
      (any (cut = n <>) (profile-numbers profile)))

    (fold-right (lambda (x lst)
                  (if (valid-gen? x)
                      (cons x lst)
                      lst))
                '()
                lst))

  ;; XXX: find a better name for this function.
  (define (filter-generations gens)
    (match gens
      (() '())
      (('>= n)
       (drop-while (cut > n <>)
                   ;; XXX: is it really necessary to sort?  Check
                   ;; 'profile-numbers'.
                   (sort (profile-numbers profile) <)))
      (('<= n)
       (valid-generations (iota n 1)))
      ((lst ..1)
       (valid-generations lst))
      (_ #f)))

  ;; XXX: find a better name.
  (define (filter-by-duration dur)
    (define dates-gens
      ;; Return an alist of dates and generations.
      (map (lambda (x)
             (cons (and=> (stat (format #f "~a-~a-link"
                                        ;; XXX: Should I check that
                                        ;; 'number->string's argument is
                                        ;; actually a number?  Can I
                                        ;; trust 'profile-numbers'?
                                        profile (number->string x)))
                          stat:ctime)
                   x))
           ;; XXX: Is there a need to sort?
           (sort (profile-numbers profile) <)))

    (define dates
      (fold-right (lambda (x lst)
                    (cons (first x) lst))
                  '()
                  dates-gens))

    (match dur
      (#f #f)
      (res
       (let ((s (time-second (subtract-duration (current-time) dur))))
         (map (cut assoc-ref dates-gens <>)
              (filter (cut <= s <>) dates))))))

  (cond ((string->generations str)
         =>
         filter-generations)
        ((string->duration str)
         =>
         filter-by-duration)
        (else #f)))

;; XXX:
;; scheme@(avail-generations)> (available-generations "..0")
;; $21 = ()

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-12  9:17                                         ` Nikita Karetnikov
@ 2013-09-12 12:26                                           ` Ludovic Courtès
  2013-09-13 14:44                                             ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-12 12:26 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Probably this can reduce to a big ‘cond’, which would be even more
>> readable:
>
>>   (cond ((maybe-integer)
>>          =>
>>          list)
>>         ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
>>          =>
>>          (lambda (match)
>>            ...))
>>         ...)
>
> Are you sure?  I haven’t found a way to make ‘cond’ as readable as ‘or’.

Yes, it makes it easier to enumerate all the cases, and to reason about it.

For instance, in ‘string->generations’, getting rid of ‘maybe-*-range’
and instead inlining the ‘string-match’ calls in ‘cond’ would greatly
clarify things IMO:

  (cond ((maybe-integer) ...)
        ((maybe-comma-separated-integers) ...)
        ((string-match p1 x) => ...)
        ((string-match p2 x) => ...)
        ((string-match p3 x) => ...)
        (else #f))

> I’m attaching a sketchy version.  If you don’t see any problems, I’ll
> try to integrate this code into ‘package.scm’.

I’d prefer clearer case analysis as shown above.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-12 12:26                                           ` Ludovic Courtès
@ 2013-09-13 14:44                                             ` Nikita Karetnikov
  2013-09-13 21:29                                               ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-13 14:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 765 bytes --]

> I’d prefer clearer case analysis as shown above.

OK, what do you think about this diff?  If everything is fine, I’ll make
it output generations in the recutils format.

(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?)

I don’t know if the code works with non-default profiles because my
store is broken.  When I try to install or build a new package (with or
without substitutes), I get the following message:

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

I’ve already tried to run ‘guix gc’, but it didn’t help.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: list-generations.diff --]
[-- Type: text/x-diff, Size: 7076 bytes --]

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1393ca3..6e8171c 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -34,6 +34,7 @@
   #:use-module (ice-9 vlist)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
@@ -246,6 +247,127 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
              (switch-link)))
           (else (switch-link)))))                 ; anything else
 
+(define (string->generations str)
+  "Return a list of generations matching a pattern in STR.  This function
+accepts the following patterns: \"1\", \"1,2,3\", \"1..9\", \"1..\", \"..9\"."
+  (define (maybe-integer)
+    (let ((x (string->number str)))
+      (and (integer? x)
+           x)))
+
+  (define (maybe-comma-separated-integers)
+    (let ((lst (delete-duplicates
+                (map string->number
+                     (delete "" (string-split str #\,))))))
+      (and (every integer? lst)
+           lst)))
+
+  (cond ((maybe-integer)
+         =>
+         list)
+        ((maybe-comma-separated-integers)
+         =>
+         identity)
+        ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
+         =>
+         (lambda (match)
+           (let ((s (string->number (match:substring match 1)))
+                 (e (string->number (match:substring match 2))))
+             (and (every integer? (list s e))
+                  (<= s e)
+                  (iota (1+ (- e s)) s)))))
+        ((string-match "^([0-9]+)\\.\\.$" str)
+         =>
+         (lambda (match)
+           (let ((s (string->number (match:substring match 1))))
+             (and (integer? s)
+                  `(>= ,s)))))
+        ((string-match "^\\.\\.([0-9]+)$" str)
+         =>
+         (lambda (match)
+           (let ((e (string->number (match:substring match 1))))
+             (and (integer? e)
+                  `(<= ,e)))))
+        (else #f)))
+
+(define (string->duration str)
+  "Return a duration matching a pattern in STR.  This function accepts the
+following patterns: \"1d\", \"1w\", \"1m\"."
+  (define (hours->duration hours match)
+    (make-time time-duration 0
+               (* 3600 hours (string->number (match:substring match 1)))))
+
+  (cond ((string-match "^([0-9]+)d$" str)
+         =>
+         (lambda (match)
+           (hours->duration 24 match)))
+        ((string-match "^([0-9]+)w$" str)
+         =>
+         (lambda (match)
+           (hours->duration (* 24 7) match)))
+        ((string-match "^([0-9]+)m$" str)
+         =>
+         (lambda (match)
+           (hours->duration (* 24 30) match)))
+        (else #f)))
+
+(define* (available-generations str #:optional (profile %current-profile))
+  "Return a list of available generations matching pattern in STR.  See
+'string->generations' and 'string->duration' for a list of valid patterns."
+  (define (valid-generations lst)
+    (define (valid-generation? n)
+      (any (cut = n <>) (generation-numbers profile)))
+
+    (fold-right (lambda (x acc)
+                  (if (valid-generation? x)
+                      (cons x acc)
+                      acc))
+                '()
+                lst))
+
+  (define (filter-generations generations)
+    (match generations
+      (() '())
+      (('>= n)
+       (drop-while (cut > n <>)
+                   (generation-numbers profile)))
+      (('<= n)
+       (valid-generations (iota n 1)))
+      ((lst ..1)
+       (valid-generations lst))
+      (_ #f)))
+
+  (define (filter-by-duration duration)
+    (define dates-generations
+      ;; Return an alist of dates and generations.
+      (map (lambda (x)
+             (cons (and=> (stat (format #f "~a-~a-link"
+                                        profile (number->string x)))
+                          stat:ctime)
+                   x))
+           (generation-numbers profile)))
+
+    (define dates
+      (fold-right (lambda (x acc)
+                    (cons (first x) acc))
+                  '()
+                  dates-generations))
+
+    (match duration
+      (#f #f)
+      (res
+       (let ((s (time-second (subtract-duration (current-time) duration))))
+         (map (cut assoc-ref dates-generations <>)
+              (filter (cut <= s <>) dates))))))
+
+  (cond ((string->generations str)
+         =>
+         filter-generations)
+        ((string->duration str)
+         =>
+         filter-by-duration)
+        (else #f)))
+
 (define (find-packages-by-description rx)
   "Search in SYNOPSIS and DESCRIPTION using RX.  Return a list of
 matching packages."
@@ -441,6 +563,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
       --roll-back        roll back to the previous generation"))
   (display (_ "
       --search-paths     display needed environment variable definitions"))
+  (display (_ "
+  -l  --list-generations[=REGEXP]
+                         list generations matching REGEXP"))
   (newline)
   (display (_ "
   -p, --profile=PROFILE  use PROFILE instead of the user's default profile"))
@@ -500,6 +625,10 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (option '("roll-back") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'roll-back? #t result)))
+        (option '(#\l "list-generations") #f #t
+                (lambda (opt name arg result)
+                  (cons `(query list-generations ,(or arg ""))
+                        result)))
         (option '("search-paths") #f #f
                 (lambda (opt name arg result)
                   (cons `(query search-paths) result)))
@@ -879,6 +1008,24 @@ more information.~%"))
     ;; actually processed, #f otherwise.
     (let ((profile  (assoc-ref opts 'profile)))
       (match (assoc-ref opts 'query)
+        (('list-generations regexp)
+         (define* (list-generation number)
+           (begin
+             (format #t "Generation ~a:~%" (number->string number))
+             (for-each (match-lambda
+                        ((name version output location _)
+                         (format #t "~a\t~a\t~a\t~a~%"
+                                 name version output location)))
+                       (manifest-packages
+                        (profile-manifest
+                         (format #f "~a-~a-link" profile number))))))
+
+         (let ((lst (if (string-null? regexp)
+                        (generation-numbers profile)
+                        (or (available-generations regexp profile)
+                            (leave (_ "invalid syntax: ~a~%") regexp)))))
+             (for-each list-generation lst)))
+
         (('list-installed regexp)
          (let* ((regexp    (and regexp (make-regexp regexp)))
                 (manifest  (profile-manifest profile))

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-13 14:44                                             ` Nikita Karetnikov
@ 2013-09-13 21:29                                               ` Ludovic Courtès
  2013-09-16 11:12                                                 ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-13 21:29 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> I’d prefer clearer case analysis as shown above.
>
> OK, what do you think about this diff?  If everything is fine, I’ll make
> it output generations in the recutils format.

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

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.

WDYT?

> (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.

> I don’t know if the code works with non-default profiles because my
> store is broken.  When I try to install or build a new package (with or
> without substitutes), I get the following message:
>
> 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?

Maybe you can try ‘nix-store --verify’ (and port that option to Guix
while you’re at it ;-)).

Minor things:

> +(define (string->generations str)
> +  "Return a list of generations matching a pattern in STR.  This function

Return *the* list of...

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

Perhaps ‘matching-generations’?

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-13 21:29                                               ` Ludovic Courtès
@ 2013-09-16 11:12                                                 ` Nikita Karetnikov
  2013-09-16 12:16                                                   ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-16 11:12 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3489 bytes --]

> 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 #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: New ‘--list-generations’ and ‘--delete-generations’ options
  2013-09-16 11:12                                                 ` Nikita Karetnikov
@ 2013-09-16 12:16                                                   ` Ludovic Courtès
  2013-09-18  0:43                                                     ` PRELIMINARY: [PATCH] guix package: Add '--list-generations' Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-16 12:16 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Cool.  The diff looks great...  but it lacks tests.
>
> Yes, I wanted to finish the recutils part first.

I think it’s reasonable to have a first milestone without recutils
output.

> 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.

Not sure what you mean by “two record sets”.

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’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?

Yes.

> Should it point to the store instead of (gnu packages …)?

Yes, I think so.

> Also, why did you propose to use ‘object->fields’?  Should I create an
> SRFI-9 record representing the recutils fields?

‘object->fields’ is just a convenient way to serialize an object in
recutils format.

So no, you don’t need a new record type for the recutils field.  Instead
you would just serialize the objects that represent a profile/manifest
using that (currently there’s no distinct record type for those, but 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 ‘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)?

Because it’s 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’s why
there’s tests/packages.scm *and* tests/guix-package.sh, for instance.

Besides, I’m all for QuickCheck-style tests, there just wasn’t 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 ‘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:

Even better.  :-)

>>> +(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?

Here we’re using Scheme lists to represent a set, and there can be only
one set of generations matching the given pattern; that’s why I
suggested ‘the’ instead of ‘a’.

In general I like to remove any ambiguity, and using ‘a’ is often a
source of ambiguity.

>>> 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

Problem with permissions on the SQLite database, I guess.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* PRELIMINARY: [PATCH] guix package: Add '--list-generations'.
  2013-09-16 12:16                                                   ` Ludovic Courtès
@ 2013-09-18  0:43                                                     ` Nikita Karetnikov
  2013-09-18 17:35                                                       ` Nikita Karetnikov
                                                                         ` (2 more replies)
  0 siblings, 3 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-18  0:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 2386 bytes --]

> I think it’s reasonable to have a first milestone without recutils
> output.

OK.

> Not sure what you mean by “two record sets”.

“You can have two record sets: one for generations, one for
packages.” [1]

> 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.

Right.

>> 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?

> Yes.

>> Should it point to the store instead of (gnu packages …)?

> Yes, I think so.

Done.

>> Why do you suggest to put ‘string->duration’ into (guix ui)?

> Because it’s a user-interface function.

Done.  However, I think it would be better to write more generic
procedures if we want to place them in separate modules, so they can be
reused.  (I can replace the current version with a more generic one if
you want.)

>> 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.

I “fixed” it by deleting the store and reinstalling Guix.

I’m attaching the patch.  Please don’t push it yet.  I’ve just found a
bug.  On my machine, ‘guix package -p test -l 2d’ and ‘guix package -p
test -l’ should return the same set of generations, but the fourth
generation is shown twice in the former case.

Other issues:

1. ‘false-if-exception’ in ‘generation-ctime’.

2. A race condition (marked with XXX).

3. ‘guix package -l -p test’ returns ‘guix package: error: test:
   extraneous argument’.  (However, the same happens with ‘-I’.)

4. There must be a better way to write the test in
   ‘tests/guix-package.sh’.

[1] https://lists.gnu.org/archive/html/guix-devel/2013-08/msg00173.html


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Add-list-generations.patch --]
[-- Type: text/x-diff, Size: 14758 bytes --]

From 27e73d3d86ca7abfbc470f3561c059d730314821 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Tue, 17 Sep 2013 23:56:10 +0000
Subject: [PATCH] guix package: Add '--list-generations'.

* guix/scripts/package.scm: Import (srfi srfi-19).
  (generation-ctime, matching-generations): New functions.
  (show-help): Add '--list-generations'.
  (%options): Likewise.
  (guix-package)[process-query]: Add support for '--list-generations'.
* guix/ui.scm: Import (srfi srfi-19) and (ice-9 regex).
  (string->generations, string->duration): New functions.
* tests/guix-package.sh: Test '--list-generations'.
* tests/ui.scm: Import (srfi srfi-19).
  Test 'string->generations' and 'string->duration'.
* doc/guix.texi (Invoking guix-package): Document '--list-generations'.
---
 doc/guix.texi            |   36 +++++++++++++++++
 guix/scripts/package.scm |  100 ++++++++++++++++++++++++++++++++++++++++++++++
 guix/ui.scm              |   68 +++++++++++++++++++++++++++++++
 tests/guix-package.sh    |    4 ++
 tests/ui.scm             |   85 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 293 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5d1b780..ebf80b4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -606,6 +606,42 @@ library are installed in the profile, then @code{--search-paths} will
 suggest setting these variables to @code{@var{profile}/include} and
 @code{@var{profile}/lib}, respectively.
 
+@item --list-generations[=@var{regexp}]
+@itemx -l [@var{regexp}]
+Return a list of generations along with their creation dates.
+
+For each installed package, print the following items, separated by
+tabs: the name of a package, its version string, the part of the package
+that is installed (@pxref{Packages with Multiple Outputs}), and the
+location of this package in the store.
+
+When @var{regexp} is used, the command returns only matching
+generations.  Valid patterns include:
+
+@itemize
+@item @emph{Integers and comma-separated integers}.  Both patterns will simply
+return the corresponding generations.  For instance,
+@code{--list-generations=1} will return the first one.
+
+If you pass @code{--list-generations=1,8,2}, the command will return
+three generations in the specified order.  Neither spaces nor trailing
+commas are allowed.
+
+@item @emph{Ranges}.  @code{--list-generations=2..9} will print the
+specified generations and everything in between.  Note that the
+start of a range must be lesser than its end.
+
+It is also possible to omit the endpoint.  For example,
+@code{--list-generations=2..}, will output all generations starting from
+the second one.
+
+@item @emph{Durations}.  You can also get the last @emph{N}@tie{}days, weeks,
+or months by passing an integer along with the first letter of the
+duration, e.g., @code{--list-generations=20d}.
+
+@end itemize
+
+
 @item --profile=@var{profile}
 @itemx -p @var{profile}
 Use @var{profile} instead of the user's default profile.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1393ca3..0d3cc05 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -34,6 +34,7 @@
   #:use-module (ice-9 vlist)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
@@ -246,6 +247,66 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
              (switch-link)))
           (else (switch-link)))))                 ; anything else
 
+(define (generation-ctime profile number)
+  "Return the creation date of a generation or #f if it does not exist."
+  (false-if-exception
+   (stat:ctime (stat (format #f "~a-~a-link" profile number)))))
+
+(define* (matching-generations str #:optional (profile %current-profile))
+  "Return the list of available generations matching a pattern in STR.  See
+'string->generations' and 'string->duration' for the list of valid patterns."
+  (define (valid-generations lst)
+    (define (valid-generation? n)
+      (any (cut = n <>) (generation-numbers profile)))
+
+    (fold-right (lambda (x acc)
+                  (if (valid-generation? x)
+                      (cons x acc)
+                      acc))
+                '()
+                lst))
+
+  (define (filter-generations generations)
+    (match generations
+      (() '())
+      (('>= n)
+       (drop-while (cut > n <>)
+                   (generation-numbers profile)))
+      (('<= n)
+       (valid-generations (iota n 1)))
+      ((lst ..1)
+       (valid-generations lst))
+      (_ #f)))
+
+  (define (filter-by-duration duration)
+    (define dates-generations
+      ;; Return the alist of dates and generations.
+      (map (lambda (number)
+             (cons (generation-ctime profile number)
+                   number))
+           (generation-numbers profile)))
+
+    (define dates
+      (fold-right (lambda (x acc)
+                    (cons (first x) acc))
+                  '()
+                  dates-generations))
+
+    (match duration
+      (#f #f)
+      (res
+       (let ((s (time-second (subtract-duration (current-time) duration))))
+         (map (cut assoc-ref dates-generations <>)
+              (filter (cut <= s <>) dates))))))
+
+  (cond ((string->generations str)
+         =>
+         filter-generations)
+        ((string->duration str)
+         =>
+         filter-by-duration)
+        (else #f)))
+
 (define (find-packages-by-description rx)
   "Search in SYNOPSIS and DESCRIPTION using RX.  Return a list of
 matching packages."
@@ -441,6 +502,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
       --roll-back        roll back to the previous generation"))
   (display (_ "
       --search-paths     display needed environment variable definitions"))
+  (display (_ "
+  -l  --list-generations[=REGEXP]
+                         list generations matching REGEXP"))
   (newline)
   (display (_ "
   -p, --profile=PROFILE  use PROFILE instead of the user's default profile"))
@@ -500,6 +564,10 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (option '("roll-back") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'roll-back? #t result)))
+        (option '(#\l "list-generations") #f #t
+                (lambda (opt name arg result)
+                  (cons `(query list-generations ,(or arg ""))
+                        result)))
         (option '("search-paths") #f #f
                 (lambda (opt name arg result)
                   (cons `(query search-paths) result)))
@@ -879,6 +947,38 @@ more information.~%"))
     ;; actually processed, #f otherwise.
     (let ((profile  (assoc-ref opts 'profile)))
       (match (assoc-ref opts 'query)
+        (('list-generations regexp)
+         (define (list-generation number)
+           (begin
+             (format #t "Generation ~a\t~a~%" number
+                     (date->string
+                      (time-utc->date
+                       (make-time time-utc 0
+                                  (generation-ctime profile number)))
+                      "~b ~d ~Y"))
+             (for-each (match-lambda
+                        ((name version output location _)
+                         (format #t "  ~a\t~a\t~a\t~a~%"
+                                 name version output location)))
+                       (manifest-packages
+                        (profile-manifest
+                         (format #f "~a-~a-link" profile number))))
+             (newline)))
+
+         (cond ((not (file-exists? profile)) ; XXX: race condition
+                (leave (_ "profile '~a' does not exist~%")
+                       profile))
+               ((string-null? regexp)
+                (for-each list-generation
+                          (generation-numbers profile)))
+               ((matching-generations regexp profile)
+                =>
+                (cut for-each list-generation <>))
+               (else
+                (leave (_ "invalid syntax: ~a~%")
+                       regexp)))
+         #t)
+
         (('list-installed regexp)
          (let* ((regexp    (and regexp (make-regexp regexp)))
                 (manifest  (profile-manifest profile))
diff --git a/guix/ui.scm b/guix/ui.scm
index 720d01b..a3289b4 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -28,12 +28,14 @@
   #:use-module ((guix licenses) #:select (license? license-name))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
   #:autoload   (ice-9 ftw)  (scandir)
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
+  #:use-module (ice-9 regex)
   #:export (_
             N_
             leave
@@ -50,6 +52,8 @@
             fill-paragraph
             string->recutils
             package->recutils
+            string->generations
+            string->duration
             args-fold*
             run-guix-command
             program-name
@@ -404,6 +408,70 @@ WIDTH columns."
           (and=> (package-description p) description->recutils))
   (newline port))
 
+(define (string->generations str)
+  "Return the list of generations matching a pattern in STR.  This function
+accepts the following patterns: \"1\", \"1,2,3\", \"1..9\", \"1..\", \"..9\"."
+  (define (maybe-integer)
+    (let ((x (string->number str)))
+      (and (integer? x)
+           x)))
+
+  (define (maybe-comma-separated-integers)
+    (let ((lst (delete-duplicates
+                (map string->number
+                     (string-split str #\,)))))
+      (and (every integer? lst)
+           lst)))
+
+  (cond ((maybe-integer)
+         =>
+         list)
+        ((maybe-comma-separated-integers)
+         =>
+         identity)
+        ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
+         =>
+         (lambda (match)
+           (let ((s (string->number (match:substring match 1)))
+                 (e (string->number (match:substring match 2))))
+             (and (every integer? (list s e))
+                  (<= s e)
+                  (iota (1+ (- e s)) s)))))
+        ((string-match "^([0-9]+)\\.\\.$" str)
+         =>
+         (lambda (match)
+           (let ((s (string->number (match:substring match 1))))
+             (and (integer? s)
+                  `(>= ,s)))))
+        ((string-match "^\\.\\.([0-9]+)$" str)
+         =>
+         (lambda (match)
+           (let ((e (string->number (match:substring match 1))))
+             (and (integer? e)
+                  `(<= ,e)))))
+        (else #f)))
+
+(define (string->duration str)
+  "Return the duration matching a pattern in STR.  This function accepts the
+following patterns: \"1d\", \"1w\", \"1m\"."
+  (define (hours->duration hours match)
+    (make-time time-duration 0
+               (* 3600 hours (string->number (match:substring match 1)))))
+
+  (cond ((string-match "^([0-9]+)d$" str)
+         =>
+         (lambda (match)
+           (hours->duration 24 match)))
+        ((string-match "^([0-9]+)w$" str)
+         =>
+         (lambda (match)
+           (hours->duration (* 24 7) match)))
+        ((string-match "^([0-9]+)m$" str)
+         =>
+         (lambda (match)
+           (hours->duration (* 24 30) match)))
+        (else #f)))
+
 (define (args-fold* options unrecognized-option-proc operand-proc . seeds)
   "A wrapper on top of `args-fold' that does proper user-facing error
 reporting."
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index ee186ea..f8596fa 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -81,6 +81,10 @@ then
         "name: hello"
     test "`guix package -s "n0t4r341p4ck4g3"`" = ""
 
+    # List generations.
+    test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
+        = "  guile-bootstrap"
+
     # Remove a package.
     guix package --bootstrap -p "$profile" -r "guile-bootstrap"
     test -L "$profile-3-link"
diff --git a/tests/ui.scm b/tests/ui.scm
index 0b6f3c5..adba9f9 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -20,6 +20,7 @@
 (define-module (test-ui)
   #:use-module (guix ui)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-64))
 
 ;; Test the (guix ui) module.
@@ -64,6 +65,90 @@ interface, and powerful string processing.")
                    10)
    #\newline))
 
+(test-equal "integer"
+  '(1)
+  (string->generations "1"))
+
+(test-equal "comma-separated integers"
+  '(3 7 1 4 6)
+  (string->generations "3,7,1,4,6"))
+
+(test-equal "closed range"
+  '(4 5 6 7 8 9 10 11 12)
+  (string->generations "4..12"))
+
+(test-equal "closed range, equal endpoints"
+  '(3)
+  (string->generations "3..3"))
+
+(test-equal "infinite end range"
+  '(>= 7)
+  (string->generations "7.."))
+
+(test-equal "infinite start range"
+  '(<= 42)
+  (string->generations "..42"))
+
+(test-equal "integer, char"
+  #f
+  (string->generations "a"))
+
+(test-equal "comma-separated integers, consecutive comma"
+  #f
+  (string->generations "1,,2"))
+
+(test-equal "comma-separated integers, trailing comma"
+  #f
+  (string->generations "1,2,"))
+
+(test-equal "comma-separated integers, chars"
+  #f
+  (string->generations "a,b"))
+
+(test-equal "closed range, start > end"
+  #f
+  (string->generations "9..2"))
+
+(test-equal "closed range, chars"
+  #f
+  (string->generations "a..b"))
+
+(test-equal "infinite end range, char"
+  #f
+  (string->generations "a.."))
+
+(test-equal "infinite start range, char"
+  #f
+  (string->generations "..a"))
+
+(test-equal "duration, 1 day"
+  (make-time time-duration 0 (* 3600 24))
+  (string->duration "1d"))
+
+(test-equal "duration, 1 week"
+  (make-time time-duration 0 (* 3600 24 7))
+  (string->duration "1w"))
+
+(test-equal "duration, 1 month"
+  (make-time time-duration 0 (* 3600 24 30))
+  (string->duration "1m"))
+
+(test-equal "duration, 1 week == 7 days"
+  (string->duration "1w")
+  (string->duration "7d"))
+
+(test-equal "duration, 1 month == 30 days"
+  (string->duration "1m")
+  (string->duration "30d"))
+
+(test-equal "duration, integer"
+  #f
+  (string->duration "1"))
+
+(test-equal "duration, char"
+  #f
+  (string->duration "d"))
+
 (test-end "ui")
 
 \f
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: PRELIMINARY: [PATCH] guix package: Add '--list-generations'.
  2013-09-18  0:43                                                     ` PRELIMINARY: [PATCH] guix package: Add '--list-generations' Nikita Karetnikov
@ 2013-09-18 17:35                                                       ` Nikita Karetnikov
  2013-09-18 21:32                                                       ` Ludovic Courtès
  2013-09-18 21:35                                                       ` PRELIMINARY: " Ludovic Courtès
  2 siblings, 0 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-18 17:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

> I’ve just found a bug.  On my machine, ‘guix package -p test -l 2d’
> and ‘guix package -p test -l’ should return the same set of
> generations, but the fourth generation is shown twice in the former
> case.

Generations 4 and 5 have the same creation date for some reason:

scheme@(guix ui)> dates-generations
$4 = ((1379357250 . 1) (1379364436 . 2) (1379364463 . 3) (1379364530 . 4) (1379364530 . 5) (1379419461 . 6))

Since this line

(map (cut assoc-ref dates-generations <>)

returns the first entry with the given key, the fourth generation is
printed twice.

I’ll try to replace the alist with something else.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: PRELIMINARY: [PATCH] guix package: Add '--list-generations'.
  2013-09-18  0:43                                                     ` PRELIMINARY: [PATCH] guix package: Add '--list-generations' Nikita Karetnikov
  2013-09-18 17:35                                                       ` Nikita Karetnikov
@ 2013-09-18 21:32                                                       ` Ludovic Courtès
  2013-09-19  0:49                                                         ` Nikita Karetnikov
  2013-09-18 21:35                                                       ` PRELIMINARY: " Ludovic Courtès
  2 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-18 21:32 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Not sure what you mean by “two record sets”.
>
> “You can have two record sets: one for generations, one for
> packages.” [1]

Ah so I was referring to recutils record sets (I thought you were
talking about SRFI-9 records or something.)  So what’s the question?
:-)

>>> Why do you suggest to put ‘string->duration’ into (guix ui)?
>
>> Because it’s a user-interface function.
>
> Done.  However, I think it would be better to write more generic
> procedures if we want to place them in separate modules, so they can be
> reused.  (I can replace the current version with a more generic one if
> you want.)

Well, ‘string->duration’ is just as generic as ‘string->number’.

However I agree ‘string->generation’ could remain internal to
(guix scripts package).  No big deal though.

> I’m attaching the patch.  Please don’t push it yet.  I’ve just found a
> bug.  On my machine, ‘guix package -p test -l 2d’ and ‘guix package -p
> test -l’ should return the same set of generations, but the fourth
> generation is shown twice in the former case.

OK.

> Other issues:
>
> 1. ‘false-if-exception’ in ‘generation-ctime’.
>
> 2. A race condition (marked with XXX).
>
> 3. ‘guix package -l -p test’ returns ‘guix package: error: test:
>    extraneous argument’.  (However, the same happens with ‘-I’.)
>
> 4. There must be a better way to write the test in
>    ‘tests/guix-package.sh’.

[...]

> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -606,6 +606,42 @@ library are installed in the profile, then @code{--search-paths} will
>  suggest setting these variables to @code{@var{profile}/include} and
>  @code{@var{profile}/lib}, respectively.
>  
> +@item --list-generations[=@var{regexp}]
> +@itemx -l [@var{regexp}]

s/regexp/pattern/

> +Return a list of generations along with their creation dates.
> +
> +For each installed package, print the following items, separated by
> +tabs: the name of a package, its version string, the part of the package
> +that is installed (@pxref{Packages with Multiple Outputs}), and the
> +location of this package in the store.
> +
> +When @var{regexp} is used, the command returns only matching
> +generations.  Valid patterns include:
> +
> +@itemize
> +@item @emph{Integers and comma-separated integers}.  Both patterns will simply
> +return the corresponding generations.  For instance,
> +@code{--list-generations=1} will return the first one.

I’d use @table rather than @itemize.

Wording: a pattern doesn’t “return” anything, so perhaps:

  These patterns denote generation numbers.

> +If you pass @code{--list-generations=1,8,2}, the command will return
> +three generations in the specified order.  Neither spaces nor trailing
> +commas are allowed.

s/If you pass/Passing/
s/will return/specifies/

> @@ -441,6 +502,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
>        --roll-back        roll back to the previous generation"))
>    (display (_ "
>        --search-paths     display needed environment variable definitions"))
> +  (display (_ "
> +  -l  --list-generations[=REGEXP]
> +                         list generations matching REGEXP"))

Should be “-l, --list-generations”, with a comma.
s/REGEXP/PATTERN/

> --- a/tests/guix-package.sh
> +++ b/tests/guix-package.sh
> @@ -81,6 +81,10 @@ then
>          "name: hello"
>      test "`guix package -s "n0t4r341p4ck4g3"`" = ""
>  
> +    # List generations.
> +    test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
> +        = "  guile-bootstrap"

That’s OK.  You could also grep the string “generation 1” (assuming
we’re running in the C locale, dunno if it’s the case.)

> +(test-equal "infinite end range"

s/infinite/indefinite/

Looks like this is ready to get in!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: PRELIMINARY: [PATCH] guix package: Add '--list-generations'.
  2013-09-18  0:43                                                     ` PRELIMINARY: [PATCH] guix package: Add '--list-generations' Nikita Karetnikov
  2013-09-18 17:35                                                       ` Nikita Karetnikov
  2013-09-18 21:32                                                       ` Ludovic Courtès
@ 2013-09-18 21:35                                                       ` Ludovic Courtès
  2 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-18 21:35 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> 3. ‘guix package -l -p test’ returns ‘guix package: error: test:
>    extraneous argument’.  (However, the same happens with ‘-I’.)

That’s because -p is interpreted as the optional argument to -l, and so
‘test’ is considered an extra argument.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* [PATCH] guix package: Add '--list-generations'.
  2013-09-18 21:32                                                       ` Ludovic Courtès
@ 2013-09-19  0:49                                                         ` Nikita Karetnikov
  2013-09-19  9:39                                                           ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-19  0:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 1858 bytes --]

> Ah so I was referring to recutils record sets (I thought you were
> talking about SRFI-9 records or something.)  So what’s the question?
> :-)

I was trying to explain why we shouldn’t always output generations in
the recutils format.  It works for ‘--search’ because there’s only one
record.

>> I’m attaching the patch.  Please don’t push it yet.  I’ve just found a
>> bug.  On my machine, ‘guix package -p test -l 2d’ and ‘guix package -p
>> test -l’ should return the same set of generations, but the fourth
>> generation is shown twice in the former case.

> OK.

Fixed, but I found a new one.  We output a human-readable date but
filter generations based on ‘ctime’.  This may cause problems in some
cases.

Let me try to demonstrate the problem.

$ ./pre-inst-env guix package -p test -l

Generation 1	Sep 16 2013
Generation 2	Sep 16 2013
Generation 3	Sep 16 2013
Generation 4	Sep 16 2013
Generation 5	Sep 16 2013
Generation 6	Sep 17 2013

And the last two days:

$ ./pre-inst-env guix package -p test -l 2d
Generation 2	Sep 16 2013
Generation 3	Sep 16 2013
Generation 4	Sep 16 2013
Generation 5	Sep 16 2013
Generation 6	Sep 17 2013

See?  Even though the first five generations have the same date, the
first one is not shown.

I believe that this bug is now fixed.

I incorporated all your suggestions except the following ones.

> I’d use @table rather than @itemize.

IIUC, it can be used only with the following commands: “@code, @samp,
@var, @option, or @kbd.” [1]  Neither command seems to match.

> s/If you pass/Passing/
> s/will return/specifies/

This doesn’t sound right because the other sentences use “will.”

Can I push the attached patch to ‘master’?

[1] https://gnu.org/software/texinfo/manual/texinfo/texinfo.html#index-table


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Add-list-generations.patch --]
[-- Type: text/x-diff, Size: 15041 bytes --]

From 65a2d978e1b74cde953e81109dad33f2562e8294 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Thu, 19 Sep 2013 00:36:05 +0000
Subject: [PATCH] guix package: Add '--list-generations'.

* guix/scripts/package.scm: Import (srfi srfi-19).
  (generation-time, matching-generations): New functions.
  (show-help): Add '--list-generations'.
  (%options): Likewise.
  (guix-package)[process-query]: Add support for '--list-generations'.
* guix/ui.scm: Import (srfi srfi-19) and (ice-9 regex).
  (string->generations, string->duration): New functions.
* tests/guix-package.sh: Test '--list-generations'.
* tests/ui.scm: Import (srfi srfi-19).
  Test 'string->generations' and 'string->duration'.
* doc/guix.texi (Invoking guix-package): Document '--list-generations'.
---
 doc/guix.texi            |   33 ++++++++++++++
 guix/scripts/package.scm |  107 ++++++++++++++++++++++++++++++++++++++++++++++
 guix/ui.scm              |   68 +++++++++++++++++++++++++++++
 tests/guix-package.sh    |    4 ++
 tests/ui.scm             |   85 ++++++++++++++++++++++++++++++++++++
 5 files changed, 297 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5d1b780..680e629 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -606,6 +606,39 @@ library are installed in the profile, then @code{--search-paths} will
 suggest setting these variables to @code{@var{profile}/include} and
 @code{@var{profile}/lib}, respectively.
 
+@item --list-generations[=@var{pattern}]
+@itemx -l [@var{pattern}]
+Return a list of generations along with their creation dates.
+
+For each installed package, print the following items, separated by
+tabs: the name of a package, its version string, the part of the package
+that is installed (@pxref{Packages with Multiple Outputs}), and the
+location of this package in the store.
+
+When @var{pattern} is used, the command returns only matching
+generations.  Valid patterns include:
+
+@itemize
+@item @emph{Integers and comma-separated integers}.  Both patterns denote
+generation numbers.  For instance, @code{--list-generations=1} will
+return the first one.
+
+And @code{--list-generations=1,8,2} will output three generations in the
+specified order.  Neither spaces nor trailing commas are allowed.
+
+@item @emph{Ranges}.  @code{--list-generations=2..9} will print the
+specified generations and everything in between.  Note that the
+start of a range must be lesser than its end.
+
+It is also possible to omit the endpoint.  For example,
+@code{--list-generations=2..}, will output all generations starting from
+the second one.
+
+@item @emph{Durations}.  You can also get the last @emph{N}@tie{}days, weeks,
+or months by passing an integer along with the first letter of the
+duration, e.g., @code{--list-generations=20d}.
+@end itemize
+
 @item --profile=@var{profile}
 @itemx -p @var{profile}
 Use @var{profile} instead of the user's default profile.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1393ca3..1cff9b0 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -34,6 +34,7 @@
   #:use-module (ice-9 vlist)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
@@ -246,6 +247,74 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
              (switch-link)))
           (else (switch-link)))))                 ; anything else
 
+(define (generation-time profile number)
+  "Return the creation time of a generation in the UTC format."
+  (make-time time-utc 0
+             (stat:ctime (stat (format #f "~a-~a-link" profile number)))))
+
+(define* (matching-generations str #:optional (profile %current-profile))
+  "Return the list of available generations matching a pattern in STR.  See
+'string->generations' and 'string->duration' for the list of valid patterns."
+  (define (valid-generations lst)
+    (define (valid-generation? n)
+      (any (cut = n <>) (generation-numbers profile)))
+
+    (fold-right (lambda (x acc)
+                  (if (valid-generation? x)
+                      (cons x acc)
+                      acc))
+                '()
+                lst))
+
+  (define (filter-generations generations)
+    (match generations
+      (() '())
+      (('>= n)
+       (drop-while (cut > n <>)
+                   (generation-numbers profile)))
+      (('<= n)
+       (valid-generations (iota n 1)))
+      ((lst ..1)
+       (valid-generations lst))
+      (_ #f)))
+
+  (define (filter-by-duration duration)
+    (define (time-at-midnight time)
+      ;; Return TIME at midnight by setting nanoseconds, seconds, minutes, and
+      ;; hours to zeros.
+      (let ((d (time-utc->date time)))
+         (date->time-utc
+          (make-date 0 0 0 0
+                     (date-day d) (date-month d)
+                     (date-year d) (date-zone-offset d)))))
+
+    (define generation-ctime-alist
+      (map (lambda (number)
+             (cons number
+                   (time-second
+                    (time-at-midnight
+                     (generation-time profile number)))))
+           (generation-numbers profile)))
+
+    (match duration
+      (#f #f)
+      (res
+       (let ((s (time-second
+                 (subtract-duration (time-at-midnight (current-time))
+                                    duration))))
+         (delete #f (map (lambda (x)
+                           (and (<= s (cdr x))
+                                (first x)))
+                         generation-ctime-alist))))))
+
+  (cond ((string->generations str)
+         =>
+         filter-generations)
+        ((string->duration str)
+         =>
+         filter-by-duration)
+        (else #f)))
+
 (define (find-packages-by-description rx)
   "Search in SYNOPSIS and DESCRIPTION using RX.  Return a list of
 matching packages."
@@ -441,6 +510,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
       --roll-back        roll back to the previous generation"))
   (display (_ "
       --search-paths     display needed environment variable definitions"))
+  (display (_ "
+  -l, --list-generations[=PATTERN]
+                         list generations matching PATTERN"))
   (newline)
   (display (_ "
   -p, --profile=PROFILE  use PROFILE instead of the user's default profile"))
@@ -500,6 +572,10 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
         (option '("roll-back") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'roll-back? #t result)))
+        (option '(#\l "list-generations") #f #t
+                (lambda (opt name arg result)
+                  (cons `(query list-generations ,(or arg ""))
+                        result)))
         (option '("search-paths") #f #f
                 (lambda (opt name arg result)
                   (cons `(query search-paths) result)))
@@ -879,6 +955,37 @@ more information.~%"))
     ;; actually processed, #f otherwise.
     (let ((profile  (assoc-ref opts 'profile)))
       (match (assoc-ref opts 'query)
+        (('list-generations pattern)
+         (define (list-generation number)
+           (begin
+             (format #t "Generation ~a\t~a~%" number
+                     (date->string
+                      (time-utc->date
+                       (generation-time profile number))
+                      "~b ~d ~Y"))
+             (for-each (match-lambda
+                        ((name version output location _)
+                         (format #t "  ~a\t~a\t~a\t~a~%"
+                                 name version output location)))
+                       (manifest-packages
+                        (profile-manifest
+                         (format #f "~a-~a-link" profile number))))
+             (newline)))
+
+         (cond ((not (file-exists? profile)) ; XXX: race condition
+                (leave (_ "profile '~a' does not exist~%")
+                       profile))
+               ((string-null? pattern)
+                (for-each list-generation
+                          (generation-numbers profile)))
+               ((matching-generations pattern profile)
+                =>
+                (cut for-each list-generation <>))
+               (else
+                (leave (_ "invalid syntax: ~a~%")
+                       pattern)))
+         #t)
+
         (('list-installed regexp)
          (let* ((regexp    (and regexp (make-regexp regexp)))
                 (manifest  (profile-manifest profile))
diff --git a/guix/ui.scm b/guix/ui.scm
index 720d01b..a3289b4 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -28,12 +28,14 @@
   #:use-module ((guix licenses) #:select (license? license-name))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-37)
   #:autoload   (ice-9 ftw)  (scandir)
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
+  #:use-module (ice-9 regex)
   #:export (_
             N_
             leave
@@ -50,6 +52,8 @@
             fill-paragraph
             string->recutils
             package->recutils
+            string->generations
+            string->duration
             args-fold*
             run-guix-command
             program-name
@@ -404,6 +408,70 @@ WIDTH columns."
           (and=> (package-description p) description->recutils))
   (newline port))
 
+(define (string->generations str)
+  "Return the list of generations matching a pattern in STR.  This function
+accepts the following patterns: \"1\", \"1,2,3\", \"1..9\", \"1..\", \"..9\"."
+  (define (maybe-integer)
+    (let ((x (string->number str)))
+      (and (integer? x)
+           x)))
+
+  (define (maybe-comma-separated-integers)
+    (let ((lst (delete-duplicates
+                (map string->number
+                     (string-split str #\,)))))
+      (and (every integer? lst)
+           lst)))
+
+  (cond ((maybe-integer)
+         =>
+         list)
+        ((maybe-comma-separated-integers)
+         =>
+         identity)
+        ((string-match "^([0-9]+)\\.\\.([0-9]+)$" str)
+         =>
+         (lambda (match)
+           (let ((s (string->number (match:substring match 1)))
+                 (e (string->number (match:substring match 2))))
+             (and (every integer? (list s e))
+                  (<= s e)
+                  (iota (1+ (- e s)) s)))))
+        ((string-match "^([0-9]+)\\.\\.$" str)
+         =>
+         (lambda (match)
+           (let ((s (string->number (match:substring match 1))))
+             (and (integer? s)
+                  `(>= ,s)))))
+        ((string-match "^\\.\\.([0-9]+)$" str)
+         =>
+         (lambda (match)
+           (let ((e (string->number (match:substring match 1))))
+             (and (integer? e)
+                  `(<= ,e)))))
+        (else #f)))
+
+(define (string->duration str)
+  "Return the duration matching a pattern in STR.  This function accepts the
+following patterns: \"1d\", \"1w\", \"1m\"."
+  (define (hours->duration hours match)
+    (make-time time-duration 0
+               (* 3600 hours (string->number (match:substring match 1)))))
+
+  (cond ((string-match "^([0-9]+)d$" str)
+         =>
+         (lambda (match)
+           (hours->duration 24 match)))
+        ((string-match "^([0-9]+)w$" str)
+         =>
+         (lambda (match)
+           (hours->duration (* 24 7) match)))
+        ((string-match "^([0-9]+)m$" str)
+         =>
+         (lambda (match)
+           (hours->duration (* 24 30) match)))
+        (else #f)))
+
 (define (args-fold* options unrecognized-option-proc operand-proc . seeds)
   "A wrapper on top of `args-fold' that does proper user-facing error
 reporting."
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index ee186ea..f8596fa 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -81,6 +81,10 @@ then
         "name: hello"
     test "`guix package -s "n0t4r341p4ck4g3"`" = ""
 
+    # List generations.
+    test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
+        = "  guile-bootstrap"
+
     # Remove a package.
     guix package --bootstrap -p "$profile" -r "guile-bootstrap"
     test -L "$profile-3-link"
diff --git a/tests/ui.scm b/tests/ui.scm
index 0b6f3c5..3d5c3e7 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -20,6 +20,7 @@
 (define-module (test-ui)
   #:use-module (guix ui)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-64))
 
 ;; Test the (guix ui) module.
@@ -64,6 +65,90 @@ interface, and powerful string processing.")
                    10)
    #\newline))
 
+(test-equal "integer"
+  '(1)
+  (string->generations "1"))
+
+(test-equal "comma-separated integers"
+  '(3 7 1 4 6)
+  (string->generations "3,7,1,4,6"))
+
+(test-equal "closed range"
+  '(4 5 6 7 8 9 10 11 12)
+  (string->generations "4..12"))
+
+(test-equal "closed range, equal endpoints"
+  '(3)
+  (string->generations "3..3"))
+
+(test-equal "indefinite end range"
+  '(>= 7)
+  (string->generations "7.."))
+
+(test-equal "indefinite start range"
+  '(<= 42)
+  (string->generations "..42"))
+
+(test-equal "integer, char"
+  #f
+  (string->generations "a"))
+
+(test-equal "comma-separated integers, consecutive comma"
+  #f
+  (string->generations "1,,2"))
+
+(test-equal "comma-separated integers, trailing comma"
+  #f
+  (string->generations "1,2,"))
+
+(test-equal "comma-separated integers, chars"
+  #f
+  (string->generations "a,b"))
+
+(test-equal "closed range, start > end"
+  #f
+  (string->generations "9..2"))
+
+(test-equal "closed range, chars"
+  #f
+  (string->generations "a..b"))
+
+(test-equal "indefinite end range, char"
+  #f
+  (string->generations "a.."))
+
+(test-equal "indefinite start range, char"
+  #f
+  (string->generations "..a"))
+
+(test-equal "duration, 1 day"
+  (make-time time-duration 0 (* 3600 24))
+  (string->duration "1d"))
+
+(test-equal "duration, 1 week"
+  (make-time time-duration 0 (* 3600 24 7))
+  (string->duration "1w"))
+
+(test-equal "duration, 1 month"
+  (make-time time-duration 0 (* 3600 24 30))
+  (string->duration "1m"))
+
+(test-equal "duration, 1 week == 7 days"
+  (string->duration "1w")
+  (string->duration "7d"))
+
+(test-equal "duration, 1 month == 30 days"
+  (string->duration "1m")
+  (string->duration "30d"))
+
+(test-equal "duration, integer"
+  #f
+  (string->duration "1"))
+
+(test-equal "duration, char"
+  #f
+  (string->duration "d"))
+
 (test-end "ui")
 
 \f
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--list-generations'.
  2013-09-19  0:49                                                         ` Nikita Karetnikov
@ 2013-09-19  9:39                                                           ` Ludovic Courtès
  2013-09-19 11:48                                                             ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-19  9:39 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Ah so I was referring to recutils record sets (I thought you were
>> talking about SRFI-9 records or something.)  So what’s the question?
>> :-)
>
> I was trying to explain why we shouldn’t always output generations in
> the recutils format.  It works for ‘--search’ because there’s only one
> record.

Ah OK, makes sense.

>>> I’m attaching the patch.  Please don’t push it yet.  I’ve just found a
>>> bug.  On my machine, ‘guix package -p test -l 2d’ and ‘guix package -p
>>> test -l’ should return the same set of generations, but the fourth
>>> generation is shown twice in the former case.
>
>> OK.
>
> Fixed, but I found a new one.  We output a human-readable date but
> filter generations based on ‘ctime’.  This may cause problems in some
> cases.
>
> Let me try to demonstrate the problem.
>
> $ ./pre-inst-env guix package -p test -l
>
> Generation 1	Sep 16 2013
> Generation 2	Sep 16 2013
> Generation 3	Sep 16 2013
> Generation 4	Sep 16 2013
> Generation 5	Sep 16 2013
> Generation 6	Sep 17 2013
>
> And the last two days:
>
> $ ./pre-inst-env guix package -p test -l 2d
> Generation 2	Sep 16 2013
> Generation 3	Sep 16 2013
> Generation 4	Sep 16 2013
> Generation 5	Sep 16 2013
> Generation 6	Sep 17 2013
>
> See?  Even though the first five generations have the same date, the
> first one is not shown.

That’s not necessarily a bug: it could be that generation 1 is just
slightly more than 48 hours old (the time should also be displayed, I
think.)

>> I’d use @table rather than @itemize.
>
> IIUC, it can be used only with the following commands: “@code, @samp,
> @var, @option, or @kbd.” [1]  Neither command seems to match.

The manual says that @table “works with other commands besides those
explicitly mentioned”, so you could use @emph or @asis.

>> s/If you pass/Passing/
>> s/will return/specifies/
>
> This doesn’t sound right because the other sentences use “will.”

This should be present tense overall (for example, s/will print/prints/,
s/will output/outputs/, etc.)

> Can I push the attached patch to ‘master’?

Yep!

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--list-generations'.
  2013-09-19  9:39                                                           ` Ludovic Courtès
@ 2013-09-19 11:48                                                             ` Nikita Karetnikov
  2013-09-19 12:13                                                               ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-19 11:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

> That’s not necessarily a bug: it could be that generation 1 is just
> slightly more than 48 hours old (the time should also be displayed, I
> think.)

Right, that’s what I was trying to show.  Anyway, it shouldn’t be an
issue now.

OK, I added ‘~T’.

> This should be present tense overall (for example, s/will print/prints/,
> s/will output/outputs/, etc.)

Done.

>> Can I push the attached patch to ‘master’?

> Yep!

Done.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--list-generations'.
  2013-09-19 11:48                                                             ` Nikita Karetnikov
@ 2013-09-19 12:13                                                               ` Ludovic Courtès
  2013-09-21 20:39                                                                 ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-19 12:13 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> Can I push the attached patch to ‘master’?
>
>> Yep!
>
> Done.

Great, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--list-generations'.
  2013-09-19 12:13                                                               ` Ludovic Courtès
@ 2013-09-21 20:39                                                                 ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-21 20:39 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Commit 99882c6 modifies ‘--list-generations’ so that generations are
listed in numerical order:

--8<---------------cut here---------------start------------->8---
$ LC_ALL=fr_FR.utf8 ./pre-inst-env guix package --list-generations|grep ^G|head -13|tail -3
Generation 99	août 24 2013 10:37:50
Generation 100	août 25 2013 16:20:07
Generation 101	sept. 02 2013 13:36:45
--8<---------------cut here---------------end--------------->8---

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* [PATCH] guix package: Add '--delete-generations'.
  2013-08-29 13:36   ` Ludovic Courtès
  2013-08-30 17:55     ` Nikita Karetnikov
@ 2013-09-22 19:19     ` Nikita Karetnikov
  2013-09-22 20:15       ` Generation 0 (was: [PATCH] guix package: Add '--delete-generations'.) Nikita Karetnikov
  2013-09-22 20:55       ` [PATCH] guix package: Add '--delete-generations' Ludovic Courtès
  1 sibling, 2 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-22 19:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 266 bytes --]

Can I push this patch to ‘master’?  Do you see any problems?

I had noticed that ‘--roll-back’ doesn’t output anything with
‘--dry-run’, so I implemented ‘--delete-generations’ similarly.  Maybe
it would be better to print something.  WDYT?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Add-delete-generations.patch --]
[-- Type: text/x-diff, Size: 20291 bytes --]

From ede983c90bd4cdece708820e1d52a2d1894a51c8 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Sun, 22 Sep 2013 18:50:06 +0000
Subject: [PATCH] guix package: Add '--delete-generations'.

* guix/scripts/package.scm (link-to-empty-environment)
  (switch-to-previous-generation): New functions.
  (roll-back): Replace internal functions with the new ones.
  (show-help): Add '--delete-generations'.
  (%options): Likewise.
  (guix-package): Add 'apply-to-generations'.
  (guix-package)[process-actions]: Add support for '--delete-generations'.
  (guix-package)[process-query]: Replace 'cond' with 'apply-to-generations'.
* tests/guix-package.sh: Test '--delete-generations'.
* doc/guix.texi (Invoking guix-package): Document '--delete-generations'.
---
 doc/guix.texi            |    7 ++
 guix/scripts/package.scm |  271 ++++++++++++++++++++++++++++------------------
 tests/guix-package.sh    |    7 ++
 3 files changed, 178 insertions(+), 107 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index fdddcc5..3d61630 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -639,6 +639,13 @@ or months by passing an integer along with the first letter of the
 duration, e.g., @code{--list-generations=20d}.
 @end itemize
 
+@item --delete-generations[=@var{pattern}]
+@itemx -d [@var{pattern}]
+Delete generations.
+
+When @var{pattern} is specified, delete only the matching generations.
+This command accepts the same patterns as @option{--list-generations}.
+
 @item --profile=@var{profile}
 @itemx -p @var{profile}
 Use @var{profile} instead of the user's default profile.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index c0cedcd..c72b56e 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -214,6 +214,25 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
              (compose string->number (cut match:substring <> 1)))
       0))
 
+(define (link-to-empty-environment generation)
+  "Link GENERATION, a string, to the empty environment."
+  (let* ((drv  (profile-derivation (%store) '()))
+         (prof (derivation->output-path drv "out")))
+    (when (not (build-derivations (%store) (list drv)))
+          (leave (_ "failed to build the empty profile~%")))
+
+    (switch-symlinks generation prof)))
+
+(define (switch-to-previous-generation profile)
+  "Atomically switch PROFILE to the previous generation."
+  (let* ((number              (generation-number profile))
+         (previous-number     (previous-generation-number profile number))
+         (previous-generation (format #f "~a-~a-link"
+                                      profile previous-number)))
+    (format #t (_ "switching from generation ~a to ~a~%")
+            number previous-number)
+    (switch-symlinks profile previous-generation)))
+
 (define (roll-back profile)
   "Roll back to the previous generation of PROFILE."
   (let* ((number              (generation-number profile))
@@ -222,28 +241,18 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
                                       profile previous-number))
          (manifest            (string-append previous-generation "/manifest")))
 
-    (define (switch-link)
-      ;; Atomically switch PROFILE to the previous generation.
-      (format #t (_ "switching from generation ~a to ~a~%")
-              number previous-number)
-      (switch-symlinks profile previous-generation))
-
-    (cond ((not (file-exists? profile))           ; invalid profile
+    (cond ((not (file-exists? profile))                 ; invalid profile
            (leave (_ "profile `~a' does not exist~%")
                   profile))
-          ((zero? number)                         ; empty profile
+          ((zero? number)                               ; empty profile
            (format (current-error-port)
                    (_ "nothing to do: already at the empty profile~%")))
-          ((or (zero? previous-number)            ; going to emptiness
+          ((or (zero? previous-number)                  ; going to emptiness
                (not (file-exists? previous-generation)))
-           (let* ((drv  (profile-derivation (%store) '()))
-                  (prof (derivation->output-path drv "out")))
-             (when (not (build-derivations (%store) (list drv)))
-               (leave (_ "failed to build the empty profile~%")))
-
-             (switch-symlinks previous-generation prof)
-             (switch-link)))
-          (else (switch-link)))))                 ; anything else
+           (begin (link-to-empty-environment previous-generation)
+                  (switch-to-previous-generation profile)))
+          (else
+           (switch-to-previous-generation profile)))))  ; anything else
 
 (define (generation-time profile number)
   "Return the creation time of a generation in the UTC format."
@@ -511,6 +520,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
   (display (_ "
   -l, --list-generations[=PATTERN]
                          list generations matching PATTERN"))
+  (display (_ "
+  -d, --delete-generations[=PATTERN]
+                         delete generations matching PATTERN"))
   (newline)
   (display (_ "
   -p, --profile=PROFILE  use PROFILE instead of the user's default profile"))
@@ -574,6 +586,10 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
                 (lambda (opt name arg result)
                   (cons `(query list-generations ,(or arg ""))
                         result)))
+        (option '(#\d "delete-generations") #f #t
+                (lambda (opt name arg result)
+                  (alist-cons 'delete-generations (or arg "")
+                              result)))
         (option '("search-paths") #f #f
                 (lambda (opt name arg result)
                   (cons `(query search-paths) result)))
@@ -742,6 +758,20 @@ more information.~%"))
                 %profile-directory (or (getenv "USER") (getuid)))
         (rtfm))))
 
+  (define (apply-to-generations function profile pattern)
+    (cond ((not (file-exists? profile)) ; XXX: race condition
+           (leave (_ "profile '~a' does not exist~%")
+                  profile))
+          ((string-null? pattern)
+           (for-each function
+                     (generation-numbers profile)))
+          ((matching-generations pattern profile)
+           =>
+           (cut for-each function <>))
+          (else
+           (leave (_ "invalid syntax: ~a~%")
+                  pattern))))
+
   (define (process-actions opts)
     ;; Process any install/remove/upgrade action from OPTS.
 
@@ -824,85 +854,123 @@ more information.~%"))
                        install))))
         (_ #f)))
 
+    (define (delete-generation number)
+      (define (display-and-delete generation)
+        (begin (format #t "deleting ~a~%" generation)
+               (delete-file generation)))
+
+      (define (current-generation? profile generation)
+        (string=? (readlink profile) generation))
+
+      (let* ((generation      (format #f "~a-~a-link" profile number))
+             (previous-number (previous-generation-number profile number))
+             (previous-generation (format #f "~a-~a-link"
+                                          profile previous-number)))
+        (cond ((zero? number))  ; do not delete generation 0
+              ((and (current-generation? profile generation)
+                    (not (file-exists? previous-generation)))
+               (begin (link-to-empty-environment previous-generation)
+                      (switch-to-previous-generation profile)
+                      (display-and-delete generation)))
+              ((current-generation? profile generation)
+               (begin (roll-back profile)
+                      (display-and-delete generation)))
+              (else
+               (display-and-delete generation)))))
+
     ;; First roll back if asked to.
-    (if (and (assoc-ref opts 'roll-back?) (not dry-run?))
-        (begin
-          (roll-back profile)
-          (process-actions (alist-delete 'roll-back? opts)))
-        (let* ((installed (manifest-packages (profile-manifest profile)))
-               (upgrade-regexps (filter-map (match-lambda
-                                             (('upgrade . regexp)
-                                              (make-regexp (or regexp "")))
-                                             (_ #f))
-                                            opts))
-               (upgrade  (if (null? upgrade-regexps)
-                             '()
-                             (let ((newest (find-newest-available-packages)))
-                               (filter-map (match-lambda
-                                            ((name version output path _)
-                                             (and (any (cut regexp-exec <> name)
-                                                       upgrade-regexps)
-                                                  (upgradeable? name version path)
-                                                  (find-package name
-                                                                (or output "out"))))
-                                            (_ #f))
-                                           installed))))
-               (install  (append
-                          upgrade
-                          (filter-map (match-lambda
-                                       (('install . (? package? p))
-                                        (package->tuple p))
-                                       (('install . (? store-path?))
-                                        #f)
-                                       (('install . package)
-                                        (find-package package))
-                                       (_ #f))
-                                      opts)))
-               (drv      (filter-map (match-lambda
-                                      ((name version sub-drv
-                                             (? package? package)
-                                             (deps ...))
-                                       (check-package-freshness package)
-                                       (package-derivation (%store) package))
-                                      (_ #f))
-                                     install))
-               (install* (append
-                          (filter-map (match-lambda
-                                       (('install . (? package? p))
-                                        #f)
-                                       (('install . (? store-path? path))
-                                        (let-values (((name version)
-                                                      (package-name->name+version
-                                                       (store-path-package-name
-                                                        path))))
-                                          `(,name ,version #f ,path ())))
+    (cond ((and (assoc-ref opts 'roll-back?) (not dry-run?))
+           (begin
+             (roll-back profile)
+             (process-actions (alist-delete 'roll-back? opts))))
+          ((and (assoc-ref opts 'delete-generations)
+                (not dry-run?))
+           (filter-map (match-lambda
+                        (('delete-generations . pattern)
+                         (begin (apply-to-generations delete-generation
+                                                      profile pattern)
+                                (process-actions
+                                 (alist-delete 'delete-generations opts))))
+                        (_ #f))
+                       opts))
+          (else
+           (let* ((installed (manifest-packages (profile-manifest profile)))
+                  (upgrade-regexps (filter-map (match-lambda
+                                                (('upgrade . regexp)
+                                                 (make-regexp (or regexp "")))
+                                                (_ #f))
+                                               opts))
+                  (upgrade (if (null? upgrade-regexps)
+                               '()
+                               (let ((newest (find-newest-available-packages)))
+                                 (filter-map
+                                  (match-lambda
+                                   ((name version output path _)
+                                    (and (any (cut regexp-exec <> name)
+                                              upgrade-regexps)
+                                         (upgradeable? name version path)
+                                         (find-package name
+                                                       (or output "out"))))
+                                   (_ #f))
+                                  installed))))
+                  (install (append
+                            upgrade
+                            (filter-map (match-lambda
+                                         (('install . (? package? p))
+                                          (package->tuple p))
+                                         (('install . (? store-path?))
+                                          #f)
+                                         (('install . package)
+                                          (find-package package))
+                                         (_ #f))
+                                        opts)))
+                  (drv (filter-map (match-lambda
+                                    ((name version sub-drv
+                                           (? package? package)
+                                           (deps ...))
+                                     (check-package-freshness package)
+                                     (package-derivation (%store) package))
+                                    (_ #f))
+                                   install))
+                  (install*
+                   (append
+                    (filter-map (match-lambda
+                                 (('install . (? package? p))
+                                  #f)
+                                 (('install . (? store-path? path))
+                                  (let-values (((name version)
+                                                (package-name->name+version
+                                                 (store-path-package-name
+                                                  path))))
+                                    `(,name ,version #f ,path ())))
+                                 (_ #f))
+                                opts)
+                    (map (lambda (tuple drv)
+                           (match tuple
+                                  ((name version sub-drv _ (deps ...))
+                                   (let ((output-path
+                                          (derivation->output-path
+                                           drv sub-drv)))
+                                     `(,name ,version ,sub-drv ,output-path
+                                             ,(canonicalize-deps deps))))))
+                         install drv)))
+                  (remove (filter-map (match-lambda
+                                       (('remove . package)
+                                        package)
                                        (_ #f))
-                                      opts)
-                          (map (lambda (tuple drv)
-                                 (match tuple
-                                   ((name version sub-drv _ (deps ...))
-                                    (let ((output-path
-                                           (derivation->output-path
-                                            drv sub-drv)))
-                                      `(,name ,version ,sub-drv ,output-path
-                                              ,(canonicalize-deps deps))))))
-                               install drv)))
-               (remove   (filter-map (match-lambda
-                                      (('remove . package)
-                                       package)
-                                      (_ #f))
-                                     opts))
-               (remove*  (filter-map (cut assoc <> installed) remove))
-               (packages (append install*
-                                 (fold (lambda (package result)
-                                         (match package
-                                           ((name _ out _ ...)
-                                            (filter (negate
-                                                     (cut same-package? <>
-                                                          name out))
-                                                    result))))
-                                       (fold alist-delete installed remove)
-                                       install*))))
+                                      opts))
+                  (remove* (filter-map (cut assoc <> installed) remove))
+                  (packages
+                   (append install*
+                           (fold (lambda (package result)
+                                   (match package
+                                          ((name _ out _ ...)
+                                           (filter (negate
+                                                    (cut same-package? <>
+                                                         name out))
+                                                   result))))
+                                 (fold alist-delete installed remove)
+                                 install*))))
 
           (when (equal? profile %current-profile)
             (ensure-default-profile))
@@ -946,7 +1014,7 @@ more information.~%"))
                                                count)
                                         count)
                                 (display-search-paths packages
-                                                      profile))))))))))
+                                                      profile)))))))))))
 
   (define (process-query opts)
     ;; Process any query specified by OPTS.  Return #t when a query was
@@ -970,18 +1038,7 @@ more information.~%"))
                          (format #f "~a-~a-link" profile number))))
              (newline)))
 
-         (cond ((not (file-exists? profile)) ; XXX: race condition
-                (leave (_ "profile '~a' does not exist~%")
-                       profile))
-               ((string-null? pattern)
-                (for-each list-generation
-                          (generation-numbers profile)))
-               ((matching-generations pattern profile)
-                =>
-                (cut for-each list-generation <>))
-               (else
-                (leave (_ "invalid syntax: ~a~%")
-                       pattern)))
+         (apply-to-generations list-generation profile pattern)
          #t)
 
         (('list-installed regexp)
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index b09a9c0..65bc94c 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -132,6 +132,13 @@ then
     # Make sure LIBRARY_PATH gets listed by `--search-paths'.
     guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap
     guix package --search-paths -p "$profile" | grep LIBRARY_PATH
+
+    # Delete the third generation and check that it was actually deleted.
+    guix package -p "$profile" --delete-generations=3
+    test -z "`guix package -p "$profile" -l 3`"
+
+    # Do not output anything when such a generation does not exist.
+    test -z "`guix package -p "$profile" --delete-generations=42`"
 fi
 
 # Make sure the `:' syntax works.
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Generation 0 (was: [PATCH] guix package: Add '--delete-generations'.)
  2013-09-22 19:19     ` [PATCH] guix package: Add '--delete-generations' Nikita Karetnikov
@ 2013-09-22 20:15       ` Nikita Karetnikov
  2013-09-22 21:15         ` Generation 0 Ludovic Courtès
  2013-09-22 20:55       ` [PATCH] guix package: Add '--delete-generations' Ludovic Courtès
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-22 20:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

I think we should change ‘--list-generations’ to not output the zeroth
generation.  Even though it could be present in the profile, users
shouldn’t be concerned about it.

Currently, ‘--delete-generations’ ignores the zeroth generation.  Other
options seem even more confusing:

1. If you don’t have any other generations and delete it, profile
   couldn’t point to anything.

2. If you delete it along with the profile, users might be confused (or
   angry).

WDYT?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-22 19:19     ` [PATCH] guix package: Add '--delete-generations' Nikita Karetnikov
  2013-09-22 20:15       ` Generation 0 (was: [PATCH] guix package: Add '--delete-generations'.) Nikita Karetnikov
@ 2013-09-22 20:55       ` Ludovic Courtès
  2013-09-23 10:11         ` Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-22 20:55 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> Can I push this patch to ‘master’?  Do you see any problems?

Looks good!  Minor issues discussed below.

> I had noticed that ‘--roll-back’ doesn’t output anything with
> ‘--dry-run’, so I implemented ‘--delete-generations’ similarly.  Maybe
> it would be better to print something.  WDYT?

Agreed (in a separate patch.)

> +@item --delete-generations[=@var{pattern}]
> +@itemx -d [@var{pattern}]
> +Delete generations.

“Delete the generations matching @var{patterns} or ... when omitted.”

Or what actually?  I would expect it to delete all the generations but
the current one when PATTERN is omitted, right?

> +(define (link-to-empty-environment generation)
> +  "Link GENERATION, a string, to the empty environment."

s/environment/profile/ maybe?  (I know there are other inconsistencies
in these files.)

Ideally this factorization would go in a patch of its own, before the
one that adds --delete-generations.  Is that doable for you?

> +  (define (apply-to-generations function profile pattern)

s/function/proc/ to follow the convention.

> +        (cond ((zero? number))  ; do not delete generation 0
> +              ((and (current-generation? profile generation)
> +                    (not (file-exists? previous-generation)))
> +               (begin (link-to-empty-environment previous-generation)
> +                      (switch-to-previous-generation profile)
> +                      (display-and-delete generation)))
> +              ((current-generation? profile generation)
> +               (begin (roll-back profile)
> +                      (display-and-delete generation)))

No need for ‘begin’ in the body of a ‘cond’ clause.

>      ;; First roll back if asked to.
> -    (if (and (assoc-ref opts 'roll-back?) (not dry-run?))
> -        (begin
> -          (roll-back profile)
> -          (process-actions (alist-delete 'roll-back? opts)))
> -        (let* ((installed (manifest-packages (profile-manifest profile)))
> -               (upgrade-regexps (filter-map (match-lambda
> -                                             (('upgrade . regexp)
> -                                              (make-regexp (or regexp "")))
> -                                             (_ #f))

[...]

Why is there this big hunk?  If it’s just reindenting, could you arrange
to remove this hunk?

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-22 20:15       ` Generation 0 (was: [PATCH] guix package: Add '--delete-generations'.) Nikita Karetnikov
@ 2013-09-22 21:15         ` Ludovic Courtès
  2013-09-23 10:14           ` Nikita Karetnikov
  2013-09-24  0:54           ` Nikita Karetnikov
  0 siblings, 2 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-22 21:15 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> I think we should change ‘--list-generations’ to not output the zeroth
> generation.  Even though it could be present in the profile, users
> shouldn’t be concerned about it.

Agreed.

> Currently, ‘--delete-generations’ ignores the zeroth generation.  Other
> options seem even more confusing:
>
> 1. If you don’t have any other generations and delete it, profile
>    couldn’t point to anything.
>
> 2. If you delete it along with the profile, users might be confused (or
>    angry).
>
> WDYT?

I think it should be impossible to remove Generation 0 through the
command-line tools, because that generation exists precisely so that the
profile always points to something valid.

So yes, ‘--delete-generations’ must ignore Generation 0.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-22 20:55       ` [PATCH] guix package: Add '--delete-generations' Ludovic Courtès
@ 2013-09-23 10:11         ` Nikita Karetnikov
  2013-09-23 15:41           ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-23 10:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

> “Delete the generations matching @var{patterns} or ... when omitted.”

> Or what actually?  I would expect it to delete all the generations but
> the current one when PATTERN is omitted, right?

‘--delete-generations’ deletes everything and points the profile to the
zeroth generation.  There are range patterns if you want to keep the
current generation.  I prefer the current behavior.

> Ideally this factorization would go in a patch of its own, before the
> one that adds --delete-generations.  Is that doable for you?

I think so.

> No need for ‘begin’ in the body of a ‘cond’ clause.

Why?  Is it specified somewhere?  Or is it easier to read?

> Why is there this big hunk?  If it’s just reindenting, could you arrange
> to remove this hunk?

I couldn’t avoid reindenting since the word “cond” is longer than “if.”
However, I used this opportunity to move a couple of things around.  I’d
prefer to keep this change.

Frankly, I think that the module should be reorganized at some point
(especially the ‘guix-package’ function).  I don’t like that functions
don’t fit on the screen.



[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-22 21:15         ` Generation 0 Ludovic Courtès
@ 2013-09-23 10:14           ` Nikita Karetnikov
  2013-09-23 15:42             ` Ludovic Courtès
  2013-09-24  0:54           ` Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-23 10:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

>> I think we should change ‘--list-generations’ to not output the zeroth
>> generation.  Even though it could be present in the profile, users
>> shouldn’t be concerned about it.

> Agreed.

Good.

> I think it should be impossible to remove Generation 0 through the
> command-line tools, because that generation exists precisely so that the
> profile always points to something valid.

> So yes, ‘--delete-generations’ must ignore Generation 0.

Right, I agree.  But some might expect it to delete the profile as well.
Should we have a separate tool for this?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-23 10:11         ` Nikita Karetnikov
@ 2013-09-23 15:41           ` Ludovic Courtès
  2013-09-24  7:21             ` Nikita Karetnikov
  2013-09-25  4:21             ` Nikita Karetnikov
  0 siblings, 2 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-23 15:41 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> “Delete the generations matching @var{patterns} or ... when omitted.”
>
>> Or what actually?  I would expect it to delete all the generations but
>> the current one when PATTERN is omitted, right?
>
> ‘--delete-generations’ deletes everything and points the profile to the
> zeroth generation.  There are range patterns if you want to keep the
> current generation.  I prefer the current behavior.

Oh.  I’d prefer if it would delete all generations but the current one.

That’s a fairly useful pattern: suppose you want to make space on your
disk (and you know you won’t need to roll back), it’d be handy to run:

  guix package --delete-generations && guix gc

Whereas if you have to use ranges, you end up doing something like:

  guix package --list-generations |grep ^G
  # check the number of the last generation...
  guix package --delete-generations=..42 && guix gc

Conversely, removing *all* the generations is something you’re unlikely
to do very often.

WDYT?

>> No need for ‘begin’ in the body of a ‘cond’ clause.
>
> Why?  Is it specified somewhere?  Or is it easier to read?

It’s easier to read if there’s no extra ‘begin’ IMO, and it’s specified
in R5RS & co. (info "(r5rs) Expression").

>> Why is there this big hunk?  If it’s just reindenting, could you arrange
>> to remove this hunk?
>
> I couldn’t avoid reindenting since the word “cond” is longer than “if.”
> However, I used this opportunity to move a couple of things around.  I’d
> prefer to keep this change.

OK fine.  I just wanted to make sure this was only reindenting.

> Frankly, I think that the module should be reorganized at some point
> (especially the ‘guix-package’ function).  I don’t like that functions
> don’t fit on the screen.

Agreed (though individual functions do fit on the screen; the top-level
function is pretty much a module ;-)).

The profile-related functions will go in a (guix profile) module as soon
as you’re done with --delete-generations.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-23 10:14           ` Nikita Karetnikov
@ 2013-09-23 15:42             ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-23 15:42 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> I think it should be impossible to remove Generation 0 through the
>> command-line tools, because that generation exists precisely so that the
>> profile always points to something valid.
>
>> So yes, ‘--delete-generations’ must ignore Generation 0.
>
> Right, I agree.  But some might expect it to delete the profile as well.
> Should we have a separate tool for this?

We have one; it’s called ‘rm’.  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-22 21:15         ` Generation 0 Ludovic Courtès
  2013-09-23 10:14           ` Nikita Karetnikov
@ 2013-09-24  0:54           ` Nikita Karetnikov
  2013-09-24  5:56             ` [PATCH] guix package: Show which generation is the current one. (was: Generation 0) Nikita Karetnikov
  2013-09-24 12:43             ` Generation 0 Ludovic Courtès
  1 sibling, 2 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-24  0:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 315 bytes --]

>> I think we should change ‘--list-generations’ to not output the zeroth
>> generation.  Even though it could be present in the profile, users
>> shouldn’t be concerned about it.

> Agreed.

Can I push these patches to ‘master’?  Should I document that the zeroth
generation is always ignored?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-tests-Test-that-list-generations-may-not-output-anyt.patch --]
[-- Type: text/x-diff, Size: 873 bytes --]

From 7fc042876bf00031d6b36b8d697984ce1ee1700e Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Mon, 23 Sep 2013 22:56:21 +0000
Subject: [PATCH 1/3] tests: Test that '--list-generations' may not output
 anything.

---
 tests/guix-package.sh |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index b09a9c0..e2c0374 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -85,6 +85,9 @@ then
     test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
         = "  guile-bootstrap"
 
+    # Do not output anything when a generation does not exist.
+    test -z "`guix package -p "$profile" -l 42`"
+
     # Remove a package.
     guix package --bootstrap -p "$profile" -r "guile-bootstrap"
     test -L "$profile-3-link"
-- 
1.7.9.5


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-guix-package-Do-not-list-the-zeroth-generation.patch --]
[-- Type: text/x-diff, Size: 3249 bytes --]

From ac4c69fea488e4028f3957986104159fca467ecb Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Mon, 23 Sep 2013 23:31:15 +0000
Subject: [PATCH 2/3] guix package: Do not list the zeroth generation.

* guix/scripts/package.scm(guix-package)[process-query]: Change
  'list-generation' to not list the zeroth generation.
* tests/guix-package.sh: Test it.
---
 guix/scripts/package.scm |   35 ++++++++++++++++++-----------------
 tests/guix-package.sh    |    3 +++
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1d00e39..9ed499d 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -955,23 +955,24 @@ more information.~%"))
       (match (assoc-ref opts 'query)
         (('list-generations pattern)
          (define (list-generation number)
-           (begin
-             (format #t (_ "Generation ~a\t~a~%") number
-                     (date->string
-                      (time-utc->date
-                       (generation-time profile number))
-                      "~b ~d ~Y ~T"))
-             (for-each (match-lambda
-                        ((name version output location _)
-                         (format #t "  ~a\t~a\t~a\t~a~%"
-                                 name version output location)))
-
-                       ;; Show most recently installed packages last.
-                       (reverse
-                        (manifest-packages
-                         (profile-manifest
-                          (format #f "~a-~a-link" profile number)))))
-             (newline)))
+           (or (zero? number)
+               (begin
+                 (format #t (_ "Generation ~a\t~a~%") number
+                         (date->string
+                          (time-utc->date
+                           (generation-time profile number))
+                          "~b ~d ~Y ~T"))
+                 (for-each (match-lambda
+                            ((name version output location _)
+                             (format #t "  ~a\t~a\t~a\t~a~%"
+                                     name version output location)))
+
+                           ;; Show most recently installed packages last.
+                           (reverse
+                            (manifest-packages
+                             (profile-manifest
+                              (format #f "~a-~a-link" profile number)))))
+                 (newline))))
 
          (cond ((not (file-exists? profile)) ; XXX: race condition
                 (leave (_ "profile '~a' does not exist~%")
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index e2c0374..b4bd414 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -110,6 +110,9 @@ then
         test "`readlink_base "$profile"`" = "$profile-0-link"
     done
 
+    # Test that '--list-generations' does not output the zeroth generation.
+    test -z "`guix package -p "$profile" -l 0`"
+
     # Reinstall after roll-back to the empty profile.
     guix package --bootstrap -p "$profile" -e "$boot_make"
     test "`readlink_base "$profile"`" = "$profile-1-link"
-- 
1.7.9.5


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: 0003-tests-Use-test-z-to-check-that-a-string-equals-zero.patch --]
[-- Type: text/x-diff, Size: 849 bytes --]

From 64b01b6414d42b9b495059223e5312d9d01ba860 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Tue, 24 Sep 2013 00:36:51 +0000
Subject: [PATCH 3/3] tests: Use 'test -z' to check that a string equals zero.

---
 tests/guix-package.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index b4bd414..2b8b146 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -79,7 +79,7 @@ then
     # Search.
     test "`guix package -s "An example GNU package" | grep ^name:`" = \
         "name: hello"
-    test "`guix package -s "n0t4r341p4ck4g3"`" = ""
+    test -z "`guix package -s "n0t4r341p4ck4g3"`"
 
     # List generations.
     test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* [PATCH] guix package: Show which generation is the current one. (was: Generation 0)
  2013-09-24  0:54           ` Nikita Karetnikov
@ 2013-09-24  5:56             ` Nikita Karetnikov
  2013-09-24 12:45               ` [PATCH] guix package: Show which generation is the current one Ludovic Courtès
  2013-09-24 12:43             ` Generation 0 Ludovic Courtès
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-24  5:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 308 bytes --]

Will these lines be i18n’d?  I fail to configure the locales properly,
so I can’t check.

+                       (format #t "~a\t(current)~%" header)
+                       (format #t "~a~%" header)))

Can I push this patch to ‘master’?  (It should be applied on top of the
other three.)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Show-which-generation-is-the-current-on.patch --]
[-- Type: text/x-diff, Size: 2710 bytes --]

From 7759ad3ad89d236e766639c0875540e60a503d16 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Tue, 24 Sep 2013 05:41:32 +0000
Subject: [PATCH] guix package: Show which generation is the current one.

* guix/scripts/package.scm (guix-package)[process-query]: Show that a
  generation is the current one if the profile points to it.
* tests/guix-package.sh: Test it.
---
 guix/scripts/package.scm |   17 ++++++++++++-----
 tests/guix-package.sh    |    3 +++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 9ed499d..a8dfcbc 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -955,13 +955,20 @@ more information.~%"))
       (match (assoc-ref opts 'query)
         (('list-generations pattern)
          (define (list-generation number)
+           (define (current-generation? number)
+             (let ((generation (format #f "~a-~a-link" profile number)))
+               (string=? (readlink profile) generation)))
+
            (or (zero? number)
                (begin
-                 (format #t (_ "Generation ~a\t~a~%") number
-                         (date->string
-                          (time-utc->date
-                           (generation-time profile number))
-                          "~b ~d ~Y ~T"))
+                 (let ((header (format #f (_ "Generation ~a\t~a") number
+                                       (date->string
+                                        (time-utc->date
+                                         (generation-time profile number))
+                                        "~b ~d ~Y ~T"))))
+                   (if (current-generation? number)
+                       (format #t "~a\t(current)~%" header)
+                       (format #t "~a~%" header)))
                  (for-each (match-lambda
                             ((name version output location _)
                              (format #t "  ~a\t~a\t~a\t~a~%"
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 2b8b146..74deb3a 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -118,6 +118,9 @@ then
     test "`readlink_base "$profile"`" = "$profile-1-link"
     test -x "$profile/bin/guile" && ! test -x "$profile/bin/make"
 
+    # Check that the first generation is the current one.
+    test "`guix package -p "$profile" -l 1 | cut -f3 | head -n1`" = "(current)"
+
     # Roll-back to generation 0, and install---all at once.
     guix package --bootstrap -p "$profile" --roll-back -i guile-bootstrap
     test "`readlink_base "$profile"`" = "$profile-1-link"
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-23 15:41           ` Ludovic Courtès
@ 2013-09-24  7:21             ` Nikita Karetnikov
  2013-09-24 12:50               ` Ludovic Courtès
  2013-09-25  4:21             ` Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-24  7:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

>>>> I had noticed that ‘--roll-back’ doesn’t output anything with
>>>> ‘--dry-run’, so I implemented ‘--delete-generations’ similarly.  Maybe
>>>> it would be better to print something.  WDYT?

>>> Agreed (in a separate patch.)

I don’t think that I’ll have time for this before the release.  I’d
like to be able to test the MIPS binaries.

>>> “Delete the generations matching @var{patterns} or ... when omitted.”

>>> Or what actually?  I would expect it to delete all the generations but
>>> the current one when PATTERN is omitted, right?

OK.  Should it delete the current generation when it’s specified
explicitly, e.g., ‘--delete-generations=5’?  What about other patterns?

>>>> +(define (link-to-empty-environment generation)
>>>> +  "Link GENERATION, a string, to the empty environment."

>>> s/environment/profile/ maybe?  (I know there are other inconsistencies
>>> in these files.)

OK.

>>> Ideally this factorization would go in a patch of its own, before the
>>> one that adds --delete-generations.  Is that doable for you?

>> I think so.

Sorry, I’m not sure what have to be changed.  (I’ve just looked
through the module.)  Do you have time to work on this?

>>>> +  (define (apply-to-generations function profile pattern)

>>> s/function/proc/ to follow the convention.

OK.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-24  0:54           ` Nikita Karetnikov
  2013-09-24  5:56             ` [PATCH] guix package: Show which generation is the current one. (was: Generation 0) Nikita Karetnikov
@ 2013-09-24 12:43             ` Ludovic Courtès
  2013-09-24 22:29               ` Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-24 12:43 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> I think we should change ‘--list-generations’ to not output the zeroth
>>> generation.  Even though it could be present in the profile, users
>>> shouldn’t be concerned about it.
>
>> Agreed.
>
> Can I push these patches to ‘master’?  Should I document that the zeroth
> generation is always ignored?

Why not.  There’s already a mention of “profile zero” (which should be
changed to “generation zero”) under ‘--roll-back’ in the manual.

> From 7fc042876bf00031d6b36b8d697984ce1ee1700e Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Mon, 23 Sep 2013 22:56:21 +0000
> Subject: [PATCH 1/3] tests: Test that '--list-generations' may not output
>  anything.

Make sure to add a commit log.

> ---
>  tests/guix-package.sh |    3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tests/guix-package.sh b/tests/guix-package.sh
> index b09a9c0..e2c0374 100644
> --- a/tests/guix-package.sh
> +++ b/tests/guix-package.sh
> @@ -85,6 +85,9 @@ then
>      test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
>          = "  guile-bootstrap"
>  
> +    # Do not output anything when a generation does not exist.
> +    test -z "`guix package -p "$profile" -l 42`"

I’d rather test the exit code instead of/in addition to the output.
Does it exit with 1?  I think it should.

> +           (or (zero? number)
> +               (begin
> +                 (format #t (_ "Generation ~a\t~a~%") number

OK, but rather use

  (unless (zero? number)
    (format #t ...)
    ...)

> From 64b01b6414d42b9b495059223e5312d9d01ba860 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Tue, 24 Sep 2013 00:36:51 +0000
> Subject: [PATCH 3/3] tests: Use 'test -z' to check that a string equals zero.
>
> ---
>  tests/guix-package.sh |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

OK.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Show which generation is the current one.
  2013-09-24  5:56             ` [PATCH] guix package: Show which generation is the current one. (was: Generation 0) Nikita Karetnikov
@ 2013-09-24 12:45               ` Ludovic Courtès
  2013-09-24 13:55                 ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-24 12:45 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> Will these lines be i18n’d?  I fail to configure the locales properly,
> so I can’t check.
>
> +                       (format #t "~a\t(current)~%" header)
> +                       (format #t "~a~%" header)))

Change the first one to:

  (format #t (_ "~a\t(current)~%") header)

That will internationalize it.

> From 7759ad3ad89d236e766639c0875540e60a503d16 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Tue, 24 Sep 2013 05:41:32 +0000
> Subject: [PATCH] guix package: Show which generation is the current one.
>
> * guix/scripts/package.scm (guix-package)[process-query]: Show that a
>   generation is the current one if the profile points to it.
> * tests/guix-package.sh: Test it.
> ---
>  guix/scripts/package.scm |   17 ++++++++++++-----
>  tests/guix-package.sh    |    3 +++
>  2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
> index 9ed499d..a8dfcbc 100644
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -955,13 +955,20 @@ more information.~%"))
>        (match (assoc-ref opts 'query)
>          (('list-generations pattern)
>           (define (list-generation number)
> +           (define (current-generation? number)
> +             (let ((generation (format #f "~a-~a-link" profile number)))
> +               (string=? (readlink profile) generation)))

Could we instead of a global (current-generation-number profile)
procedure?  We’d store the number in a local variable here, to avoid
repeated ‘readlink’ calls.

Other than that I’m fine with the patch.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-24  7:21             ` Nikita Karetnikov
@ 2013-09-24 12:50               ` Ludovic Courtès
  2013-09-24 13:57                 ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-24 12:50 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>>>> I had noticed that ‘--roll-back’ doesn’t output anything with
>>>>> ‘--dry-run’, so I implemented ‘--delete-generations’ similarly.  Maybe
>>>>> it would be better to print something.  WDYT?
>
>>>> Agreed (in a separate patch.)
>
> I don’t think that I’ll have time for this before the release.  I’d
> like to be able to test the MIPS binaries.

OK, no problem.

>>>> “Delete the generations matching @var{patterns} or ... when omitted.”
>
>>>> Or what actually?  I would expect it to delete all the generations but
>>>> the current one when PATTERN is omitted, right?
>
> OK.  Should it delete the current generation when it’s specified
> explicitly, e.g., ‘--delete-generations=5’?  

Yes.

> What about other patterns?

It should do what the pattern says, including removing the current
generation.

My only concern was about the behavior of ‘--delete-generations’ without
any pattern, which should not remove the current generation IMO.

>>>>> +(define (link-to-empty-environment generation)
>>>>> +  "Link GENERATION, a string, to the empty environment."
>
>>>> s/environment/profile/ maybe?  (I know there are other inconsistencies
>>>> in these files.)
>
> OK.
>
>>>> Ideally this factorization would go in a patch of its own, before the
>>>> one that adds --delete-generations.  Is that doable for you?
>
>>> I think so.
>
> Sorry, I’m not sure what have to be changed.  (I’ve just looked
> through the module.)  Do you have time to work on this?

Nothing has to be changed; it’s just that I’d prefer to put the bits
that introduce ‘link-to-empty-environment’ in a separate patch, for
clarity.

I could do it, but it may be easier for you to do it, no?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Show which generation is the current one.
  2013-09-24 12:45               ` [PATCH] guix package: Show which generation is the current one Ludovic Courtès
@ 2013-09-24 13:55                 ` Nikita Karetnikov
  2013-09-24 14:16                   ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-24 13:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

> Could we instead of a global (current-generation-number profile)
> procedure?  We’d store the number in a local variable here, to avoid
> repeated ‘readlink’ calls.

I don’t see how the former implies the latter.  Could you expand on
this?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-24 12:50               ` Ludovic Courtès
@ 2013-09-24 13:57                 ` Nikita Karetnikov
  0 siblings, 0 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-24 13:57 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

> Nothing has to be changed; it’s just that I’d prefer to put the bits
> that introduce ‘link-to-empty-environment’ in a separate patch, for
> clarity.

> I could do it, but it may be easier for you to do it, no?

Ah, I simply misunderstood.  I’ll do it.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Show which generation is the current one.
  2013-09-24 13:55                 ` Nikita Karetnikov
@ 2013-09-24 14:16                   ` Ludovic Courtès
  2013-09-25  2:10                     ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-24 14:16 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Could we instead of a global (current-generation-number profile)
>> procedure?  We’d store the number in a local variable here, to avoid
>> repeated ‘readlink’ calls.
>
> I don’t see how the former implies the latter.  Could you expand on
> this?

I’m suggesting to have a procedure like this:

  (define (current-generation-number profile)
    ;; Return the current generation number of PROFILE.
    ...)

And then you could do:

  (let ((generation (current-generation-number profile)))
    ...)

Does that make sense?

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
                   ` (4 preceding siblings ...)
  2013-09-06  9:19 ` ‘--no-substitutes’ is ignored on i686 (was: Goals for 0.4) Nikita Karetnikov
@ 2013-09-24 21:59 ` Ludovic Courtès
  5 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-24 21:59 UTC (permalink / raw)
  To: guix-devel

ludo@gnu.org (Ludovic Courtès) skribis:

> First, I’d like to release 0.4 by (or on) GNU’s 30th birthday, which is
> on Sep. 28th [0].  On the 28th, I’d also like to have a bootable QEMU
> image built with Guix, featuring at least the init system (dmd), a
> console login, and bare utilities.
>
> What I would really like to see in 0.4:
>
>   • Guix must be usable with the old Guile 2.0.5, since that’s what some
>     distros provide.  At the GHM I realized that some people had weird
>     bugs with that Guile, notably in the substituter.  I fixed a couple
>     of bugs, but there may be others around.
>
>     So, to 2.0.5 users: please run ‘make check’, use Guix and in
>     particular the substituter, and report bugs!
>
>   • Packages: as already discussed, more packages, anything that makes
>     the distro more useful (having Git is a must.)
>     A package a day keeps the competition away.  ;-)
>
>   • Core updates: in particular libc 2.18.  Possibly switch to GCC 4.8
>     as the default compiler.
>
>   • APIs: new or extended APIs for building stand-alone images.  I’ve
>     been looking into that recently, notably with the initrd stuff.
>
>   • New ‘--list-generations’ and ‘--delete-generations’ options for
>     ‘guix package’.
>
>   • Manual: improve as we see fit; notably add a section on font usage
>     for X applications.

I think we’re almost there, so here’s a plan: we’ll merge ‘core-updates’
tomorrow (and thus I’ll postpone [0] for after 0.4).  We’ll release 0.4
on Saturday 28th (or even Friday 27th if possible, since that is the
real date).  The announcement will include a link to the QEMU image.

How does that sound?

In the meantime, bug reports are welcome!

Thanks,
Ludo’.

[0] https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00137.html

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-24 12:43             ` Generation 0 Ludovic Courtès
@ 2013-09-24 22:29               ` Nikita Karetnikov
  2013-09-25 12:50                 ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-24 22:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 283 bytes --]

What about these patches?  Should the first patch also test the
following case?

+                (let ((numbers (generation-numbers profile)))
+                  (if (equal? numbers '(0))
+                      (exit 1)
+                      (for-each list-generation numbers))))


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Exit-with-1-when-a-generation-cannot-be.patch --]
[-- Type: text/x-diff, Size: 2246 bytes --]

From f42056aa768a405a893b5846dad8f8fa576b1156 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Tue, 24 Sep 2013 22:11:16 +0000
Subject: [PATCH 1/2] guix package: Exit with 1 when a generation cannot be
 listed.

* guix/scripts/package.scm (guix-package)[process-query]: Exit with 1
  when a generation does not exist or the profile points to the zeroth
  generation.
* tests/guix-package.sh: Test the former case.
---
 guix/scripts/package.scm |   11 ++++++++---
 tests/guix-package.sh    |    4 ++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1d00e39..1f21890 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -977,11 +977,16 @@ more information.~%"))
                 (leave (_ "profile '~a' does not exist~%")
                        profile))
                ((string-null? pattern)
-                (for-each list-generation
-                          (generation-numbers profile)))
+                (let ((numbers (generation-numbers profile)))
+                  (if (equal? numbers '(0))
+                      (exit 1)
+                      (for-each list-generation numbers))))
                ((matching-generations pattern profile)
                 =>
-                (cut for-each list-generation <>))
+                (lambda (numbers)
+                  (if (null-list? numbers)
+                      (exit 1)
+                      (for-each list-generation numbers))))
                (else
                 (leave (_ "invalid syntax: ~a~%")
                        pattern)))
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index b09a9c0..f1f7ee6 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -85,6 +85,10 @@ then
     test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \
         = "  guile-bootstrap"
 
+    # Exit with 1 when a generation does not exist.
+    if guix package -p "$profile" --list-generations=42;
+    then false; else true; fi
+
     # Remove a package.
     guix package --bootstrap -p "$profile" -r "guile-bootstrap"
     test -L "$profile-3-link"
-- 
1.7.9.5


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-guix-package-Do-not-list-the-zeroth-generation.patch --]
[-- Type: text/x-diff, Size: 3062 bytes --]

From bea0168c28932921e6e2d6dcf3e9a26c555b698c Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Tue, 24 Sep 2013 22:18:09 +0000
Subject: [PATCH 2/2] guix package: Do not list the zeroth generation.

* guix/scripts/package.scm (guix-package)[process-query]: Change
  'list-generation' to not list the zeroth generation.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it, and use the
  right term when talking about generations.
---
 doc/guix.texi            |    8 ++++----
 guix/scripts/package.scm |    2 +-
 tests/guix-package.sh    |    3 +++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 90016a4..442cef2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -583,9 +583,8 @@ When combined with options such as @code{--install}, roll back occurs
 before any other actions.
 
 When rolling back from the first generation that actually contains
-installed packages, the profile is made to point to the @dfn{empty
-profile}, also known as @dfn{profile zero}---i.e., it contains no files
-apart from its own meta-data.
+installed packages, the profile is made to point to the @dfn{zeroth
+generation}, which contains no files apart from its own meta-data.
 
 Installing, removing, or upgrading packages from a generation that has
 been rolled back to overwrites previous future generations.  Thus, the
@@ -683,7 +682,8 @@ Multiple Outputs}), and the source location of its definition.
 @itemx -l [@var{pattern}]
 Return a list of generations along with their creation dates; for each
 generation, show the installed packages, with the most recently
-installed packages shown last.
+installed packages shown last.  Note that the zeroth generation is never
+shown.
 
 For each installed package, print the following items, separated by
 tabs: the name of a package, its version string, the part of the package
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1f21890..dab3d5b 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -955,7 +955,7 @@ more information.~%"))
       (match (assoc-ref opts 'query)
         (('list-generations pattern)
          (define (list-generation number)
-           (begin
+           (unless (zero? number)
              (format #t (_ "Generation ~a\t~a~%") number
                      (date->string
                       (time-utc->date
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index f1f7ee6..7130926 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -111,6 +111,9 @@ then
         test "`readlink_base "$profile"`" = "$profile-0-link"
     done
 
+    # Test that '--list-generations' does not output the zeroth generation.
+    test -z "`guix package -p "$profile" -l 0`"
+
     # Reinstall after roll-back to the empty profile.
     guix package --bootstrap -p "$profile" -e "$boot_make"
     test "`readlink_base "$profile"`" = "$profile-1-link"
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Show which generation is the current one.
  2013-09-24 14:16                   ` Ludovic Courtès
@ 2013-09-25  2:10                     ` Nikita Karetnikov
  2013-09-25 12:51                       ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-25  2:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 323 bytes --]

> I’m suggesting to have a procedure like this:

>   (define (current-generation-number profile)
>     ;; Return the current generation number of PROFILE.
>     ...)

We already have such a procedure.  It’s called ‘generation-number’.

What do you think about this patch?  Can I push it to ‘master’?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Show-which-generation-is-the-current-on.patch --]
[-- Type: text/x-diff, Size: 2449 bytes --]

From 5ed5be5c786683cd5ec86d9834afca88d965d5f0 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Wed, 25 Sep 2013 01:55:27 +0000
Subject: [PATCH] guix package: Show which generation is the current one.

* guix/scripts/package.scm (guix-package)[process-query]: Show that a
  generation is the current one if the profile points to it.
* tests/guix-package.sh: Test it.
---
 guix/scripts/package.scm |   14 +++++++++-----
 tests/guix-package.sh    |    3 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index dab3d5b..66505f1 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -956,11 +956,15 @@ more information.~%"))
         (('list-generations pattern)
          (define (list-generation number)
            (unless (zero? number)
-             (format #t (_ "Generation ~a\t~a~%") number
-                     (date->string
-                      (time-utc->date
-                       (generation-time profile number))
-                      "~b ~d ~Y ~T"))
+             (let ((header (format #f (_ "Generation ~a\t~a") number
+                                   (date->string
+                                    (time-utc->date
+                                     (generation-time profile number))
+                                    "~b ~d ~Y ~T")))
+                   (current (generation-number profile)))
+               (if (= number current)
+                   (format #t (_ "~a\t(current)~%") header)
+                   (format #t "~a~%" header)))
              (for-each (match-lambda
                         ((name version output location _)
                          (format #t "  ~a\t~a\t~a\t~a~%"
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 524ff32..5f97aff 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -119,6 +119,9 @@ then
     test "`readlink_base "$profile"`" = "$profile-1-link"
     test -x "$profile/bin/guile" && ! test -x "$profile/bin/make"
 
+    # Check that the first generation is the current one.
+    test "`guix package -p "$profile" -l 1 | cut -f3 | head -n1`" = "(current)"
+
     # Roll-back to generation 0, and install---all at once.
     guix package --bootstrap -p "$profile" --roll-back -i guile-bootstrap
     test "`readlink_base "$profile"`" = "$profile-1-link"
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-23 15:41           ` Ludovic Courtès
  2013-09-24  7:21             ` Nikita Karetnikov
@ 2013-09-25  4:21             ` Nikita Karetnikov
  2013-09-25 13:05               ` Ludovic Courtès
  1 sibling, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-25  4:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

> Oh.  I’d prefer if it would delete all generations but the current one.

> That’s a fairly useful pattern: suppose you want to make space on your
> disk (and you know you won’t need to roll back), it’d be handy to run:

>   guix package --delete-generations && guix gc

> Whereas if you have to use ranges, you end up doing something like:

>   guix package --list-generations |grep ^G
>   # check the number of the last generation...
>   guix package --delete-generations=..42 && guix gc

> Conversely, removing *all* the generations is something you’re unlikely
> to do very often.

‘--delete-generations’ could accept an additional argument, say,
‘keep-current’.  It’d be easier to implement, and I find it less
confusing.

Would you accept such a solution?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-08-29 20:42 ` Goals for 0.4 Andreas Enge
  2013-08-29 21:32   ` Ludovic Courtès
@ 2013-09-25  8:43   ` Andreas Enge
  2013-09-25 13:13     ` Ludovic Courtès
  1 sibling, 1 reply; 132+ messages in thread
From: Andreas Enge @ 2013-09-25  8:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Thu, Aug 29, 2013 at 10:42:23PM +0200, Andreas Enge wrote:
> On Thu, Aug 29, 2013 at 02:34:27PM +0200, Ludovic Courtès wrote:
> >   • Manual: improve as we see fit; notably add a section on font usage
> >     for X applications.
> I would volunteer for this one.

The main problem that gtk+ applications would not find a font unless the
user installed gs-fonts should be solved by the latest commit. I added
gs-fonts as an input to fontconfig and added it to its configuration file.

Andreas

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-24 22:29               ` Nikita Karetnikov
@ 2013-09-25 12:50                 ` Ludovic Courtès
  2013-09-25 18:07                   ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-25 12:50 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> What about these patches?  Should the first patch also test the
> following case?
>
> +                (let ((numbers (generation-numbers profile)))
> +                  (if (equal? numbers '(0))
> +                      (exit 1)
> +                      (for-each list-generation numbers))))

The first patch below already contains that snippet, so I’m not sure
what you mean.

> From f42056aa768a405a893b5846dad8f8fa576b1156 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Tue, 24 Sep 2013 22:11:16 +0000
> Subject: [PATCH 1/2] guix package: Exit with 1 when a generation cannot be
>  listed.
>
> * guix/scripts/package.scm (guix-package)[process-query]: Exit with 1
>   when a generation does not exist or the profile points to the zeroth
>   generation.
> * tests/guix-package.sh: Test the former case.

OK, please push.

> From bea0168c28932921e6e2d6dcf3e9a26c555b698c Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Tue, 24 Sep 2013 22:18:09 +0000
> Subject: [PATCH 2/2] guix package: Do not list the zeroth generation.
>
> * guix/scripts/package.scm (guix-package)[process-query]: Change
>   'list-generation' to not list the zeroth generation.
> * tests/guix-package.sh: Test it.
> * doc/guix.texi (Invoking guix package): Document it, and use the
>   right term when talking about generations.

OK, push as well.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Show which generation is the current one.
  2013-09-25  2:10                     ` Nikita Karetnikov
@ 2013-09-25 12:51                       ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-25 12:51 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> I’m suggesting to have a procedure like this:
>
>>   (define (current-generation-number profile)
>>     ;; Return the current generation number of PROFILE.
>>     ...)
>
> We already have such a procedure.  It’s called ‘generation-number’.

Oh, OK.

> What do you think about this patch?  Can I push it to ‘master’?

Yes!

> From 5ed5be5c786683cd5ec86d9834afca88d965d5f0 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Wed, 25 Sep 2013 01:55:27 +0000
> Subject: [PATCH] guix package: Show which generation is the current one.
>
> * guix/scripts/package.scm (guix-package)[process-query]: Show that a
>   generation is the current one if the profile points to it.
> * tests/guix-package.sh: Test it.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-25  4:21             ` Nikita Karetnikov
@ 2013-09-25 13:05               ` Ludovic Courtès
  2013-09-26  2:47                 ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-25 13:05 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Oh.  I’d prefer if it would delete all generations but the current one.
>
>> That’s a fairly useful pattern: suppose you want to make space on your
>> disk (and you know you won’t need to roll back), it’d be handy to run:
>
>>   guix package --delete-generations && guix gc
>
>> Whereas if you have to use ranges, you end up doing something like:
>
>>   guix package --list-generations |grep ^G
>>   # check the number of the last generation...
>>   guix package --delete-generations=..42 && guix gc
>
>> Conversely, removing *all* the generations is something you’re unlikely
>> to do very often.
>
> ‘--delete-generations’ could accept an additional argument, say,
> ‘keep-current’.  It’d be easier to implement, and I find it less
> confusing.
>
> Would you accept such a solution?

Frankly, I don’t like it.  I think the default behavior should not be to
let the user shoot themself in the foot.

WDYT?

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-25  8:43   ` Andreas Enge
@ 2013-09-25 13:13     ` Ludovic Courtès
  2013-09-26 11:35       ` Andreas Enge
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-25 13:13 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> skribis:

> On Thu, Aug 29, 2013 at 10:42:23PM +0200, Andreas Enge wrote:
>> On Thu, Aug 29, 2013 at 02:34:27PM +0200, Ludovic Courtès wrote:
>> >   • Manual: improve as we see fit; notably add a section on font usage
>> >     for X applications.
>> I would volunteer for this one.
>
> The main problem that gtk+ applications would not find a font unless the
> user installed gs-fonts should be solved by the latest commit. I added
> gs-fonts as an input to fontconfig and added it to its configuration file.

Yes, so normally installed GTK+ apps will work out of the box now.  The
only thing we could document is that fonts installed in the user profile
will automatically be picked up.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-25 12:50                 ` Ludovic Courtès
@ 2013-09-25 18:07                   ` Nikita Karetnikov
  2013-09-25 19:24                     ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-25 18:07 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

>> What about these patches?  Should the first patch also test the
>> following case?
>>
>> +                (let ((numbers (generation-numbers profile)))
>> +                  (if (equal? numbers '(0))
>> +                      (exit 1)
>> +                      (for-each list-generation numbers))))

> The first patch below already contains that snippet, so I’m not sure
> what you mean.

There are two cases:

1. A generation does not exist.

2. The profile points to the zeroth generation, and there are no other
   generations.

‘tests/guix-package.sh’ tests the first case.  Should we test the second
case too?  What would be the best way to do so?  Note that you can’t
specify the pattern in that case because of the (string-null? pattern)
bit.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-25 18:07                   ` Nikita Karetnikov
@ 2013-09-25 19:24                     ` Ludovic Courtès
  2013-09-26  2:18                       ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-25 19:24 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>>> What about these patches?  Should the first patch also test the
>>> following case?
>>>
>>> +                (let ((numbers (generation-numbers profile)))
>>> +                  (if (equal? numbers '(0))
>>> +                      (exit 1)
>>> +                      (for-each list-generation numbers))))
>
>> The first patch below already contains that snippet, so I’m not sure
>> what you mean.
>
> There are two cases:
>
> 1. A generation does not exist.
>
> 2. The profile points to the zeroth generation, and there are no other
>    generations.
>
> ‘tests/guix-package.sh’ tests the first case.  Should we test the second
> case too?  What would be the best way to do so?

The second case is valid.  Thus it’s OK for --list-generations to not
print anything, but it must exit with 0.

Likewise, --delete-generations should do nothing and exit with 0 with
the only generation that would be deleted is Generation 0.

Does it make sense?

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-25 19:24                     ` Ludovic Courtès
@ 2013-09-26  2:18                       ` Nikita Karetnikov
  2013-09-26  9:44                         ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-26  2:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 891 bytes --]

>> There are two cases:
>>
>> 1. A generation does not exist.
>>
>> 2. The profile points to the zeroth generation, and there are no other
>>    generations.
>>
>> ‘tests/guix-package.sh’ tests the first case.  Should we test the second
>> case too?  What would be the best way to do so?

> The second case is valid.  Thus it’s OK for --list-generations to not
> print anything, but it must exit with 0.

> Likewise, --delete-generations should do nothing and exit with 0 with
> the only generation that would be deleted is Generation 0.

> Does it make sense?

I was asking a different question, that is, whether we should test both
cases in ‘tests/guix-package.sh’ or it’s OK to test only the first case.
Currently, there’s a test for the first case.  (Note that by the word
“cases” I mean the ‘cond’ cases.)

Anyway, can I push this patch?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-package-Exit-with-0-when-there-is-nothing-to-li.patch --]
[-- Type: text/x-diff, Size: 1051 bytes --]

From 00188949e6c49592f6f2dc30bf21731ae142afc0 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Thu, 26 Sep 2013 02:00:06 +0000
Subject: [PATCH 1/3] guix package: Exit with 0 when there is nothing to list.

* guix/scripts/package.scm (guix-package)[process-query]: Exit with 0
  when there are no generations containing packages or no profiles.
---
 guix/scripts/package.scm |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 66505f1..ed1e72c 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -983,7 +983,7 @@ more information.~%"))
                ((string-null? pattern)
                 (let ((numbers (generation-numbers profile)))
                   (if (equal? numbers '(0))
-                      (exit 1)
+                      (exit 0)
                       (for-each list-generation numbers))))
                ((matching-generations pattern profile)
                 =>
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-25 13:05               ` Ludovic Courtès
@ 2013-09-26  2:47                 ` Nikita Karetnikov
  2013-09-26  9:49                   ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-26  2:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 186 bytes --]

> Frankly, I don’t like it.  I think the default behavior should not be to
> let the user shoot themself in the foot.

> WDYT?

OK, what about these patches?  Can I push them?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-guix-package-Add-link-to-empty-profile.patch --]
[-- Type: text/x-diff, Size: 2145 bytes --]

From 86d29a8b233d5cf6549fbcddf43b185086b7d178 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Wed, 25 Sep 2013 03:34:49 +0000
Subject: [PATCH 2/3] guix package: Add 'link-to-empty-profile'.

* guix/scripts/package.scm (link-to-empty-profile): New function.
  (roll-back): Use it.
---
 guix/scripts/package.scm |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index ed1e72c..7865027 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -214,6 +214,15 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
              (compose string->number (cut match:substring <> 1)))
       0))
 
+(define (link-to-empty-profile generation)
+  "Link GENERATION, a string, to the empty profile."
+  (let* ((drv  (profile-derivation (%store) '()))
+         (prof (derivation->output-path drv "out")))
+    (when (not (build-derivations (%store) (list drv)))
+          (leave (_ "failed to build the empty profile~%")))
+
+    (switch-symlinks generation prof)))
+
 (define (roll-back profile)
   "Roll back to the previous generation of PROFILE."
   (let* ((number              (generation-number profile))
@@ -236,13 +245,8 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
                    (_ "nothing to do: already at the empty profile~%")))
           ((or (zero? previous-number)            ; going to emptiness
                (not (file-exists? previous-generation)))
-           (let* ((drv  (profile-derivation (%store) '()))
-                  (prof (derivation->output-path drv "out")))
-             (when (not (build-derivations (%store) (list drv)))
-               (leave (_ "failed to build the empty profile~%")))
-
-             (switch-symlinks previous-generation prof)
-             (switch-link)))
+           (link-to-empty-profile previous-generation)
+           (switch-link))
           (else (switch-link)))))                 ; anything else
 
 (define (generation-time profile number)
-- 
1.7.9.5


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0003-guix-package-Add-delete-generations.patch --]
[-- Type: text/x-diff, Size: 19187 bytes --]

From c246f4a72ade85dffa95d7c598e24539896ca5a5 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Thu, 26 Sep 2013 02:36:24 +0000
Subject: [PATCH 3/3] guix package: Add '--delete-generations'.

* guix/scripts/package.scm (switch-to-previous-generation): New function.
  (roll-back): Use the new function instead of 'switch-link'.
  (show-help): Add '--delete-generations'.
  (%options): Likewise.
  (guix-package)[process-actions]: Add 'current-generation-number',
  'display-and-delete', and 'delete-generation'.  Add support for
  '--delete-generations', and reindent the code.
* tests/guix-package.sh: Test '--delete-generations'.
* doc/guix.texi (Invoking guix-package): Document '--delete-generations'.
---
 doc/guix.texi            |   10 ++
 guix/scripts/package.scm |  256 +++++++++++++++++++++++++++++-----------------
 tests/guix-package.sh    |   11 ++
 3 files changed, 185 insertions(+), 92 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 442cef2..2e6bdc5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -714,6 +714,16 @@ or months by passing an integer along with the first letter of the
 duration, e.g., @code{--list-generations=20d}.
 @end itemize
 
+@item --delete-generations[=@var{pattern}]
+@itemx -d [@var{pattern}]
+Delete all generations except the current one.  Note that the zeroth
+generation is never deleted.
+
+This command accepts the same patterns as @option{--list-generations}.
+When @var{pattern} is specified, delete the matching generations.  If
+the current generation matches, it is deleted atomically, i.e., by
+switching to the previous available generation.
+
 @end table
 
 @node Packages with Multiple Outputs
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 7865027..35a5129 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -223,6 +223,16 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
 
     (switch-symlinks generation prof)))
 
+(define (switch-to-previous-generation profile)
+  "Atomically switch PROFILE to the previous generation."
+  (let* ((number              (generation-number profile))
+         (previous-number     (previous-generation-number profile number))
+         (previous-generation (format #f "~a-~a-link"
+                                      profile previous-number)))
+    (format #t (_ "switching from generation ~a to ~a~%")
+            number previous-number)
+    (switch-symlinks profile previous-generation)))
+
 (define (roll-back profile)
   "Roll back to the previous generation of PROFILE."
   (let* ((number              (generation-number profile))
@@ -230,24 +240,18 @@ all of PACKAGES, a list of name/version/output/path/deps tuples."
          (previous-generation (format #f "~a-~a-link"
                                       profile previous-number))
          (manifest            (string-append previous-generation "/manifest")))
-
-    (define (switch-link)
-      ;; Atomically switch PROFILE to the previous generation.
-      (format #t (_ "switching from generation ~a to ~a~%")
-              number previous-number)
-      (switch-symlinks profile previous-generation))
-
-    (cond ((not (file-exists? profile))           ; invalid profile
-           (leave (_ "profile `~a' does not exist~%")
+    (cond ((not (file-exists? profile))                 ; invalid profile
+           (leave (_ "profile '~a' does not exist~%")
                   profile))
-          ((zero? number)                         ; empty profile
+          ((zero? number)                               ; empty profile
            (format (current-error-port)
                    (_ "nothing to do: already at the empty profile~%")))
-          ((or (zero? previous-number)            ; going to emptiness
+          ((or (zero? previous-number)                  ; going to emptiness
                (not (file-exists? previous-generation)))
            (link-to-empty-profile previous-generation)
-           (switch-link))
-          (else (switch-link)))))                 ; anything else
+           (switch-to-previous-generation profile))
+          (else
+           (switch-to-previous-generation profile)))))  ; anything else
 
 (define (generation-time profile number)
   "Return the creation time of a generation in the UTC format."
@@ -515,6 +519,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
   (display (_ "
   -l, --list-generations[=PATTERN]
                          list generations matching PATTERN"))
+  (display (_ "
+  -d, --delete-generations[=PATTERN]
+                         delete generations matching PATTERN"))
   (newline)
   (display (_ "
   -p, --profile=PROFILE  use PROFILE instead of the user's default profile"))
@@ -578,6 +585,10 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
                 (lambda (opt name arg result)
                   (cons `(query list-generations ,(or arg ""))
                         result)))
+        (option '(#\d "delete-generations") #f #t
+                (lambda (opt name arg result)
+                  (alist-cons 'delete-generations (or arg "")
+                              result)))
         (option '("search-paths") #f #f
                 (lambda (opt name arg result)
                   (cons `(query search-paths) result)))
@@ -828,85 +839,146 @@ more information.~%"))
                        install))))
         (_ #f)))
 
+    (define current-generation-number
+      (generation-number profile))
+
+    (define (display-and-delete number)
+      (let ((generation (format #f "~a-~a-link" profile number)))
+        (unless (zero? number)
+          (format #t (_ "deleting ~a~%") generation)
+          (delete-file generation))))
+
+    (define (delete-generation number)
+      (let* ((previous-number (previous-generation-number profile number))
+             (previous-generation (format #f "~a-~a-link"
+                                          profile previous-number)))
+        (cond ((zero? number))  ; do not delete generation 0
+              ((and (= number current-generation-number)
+                    (not (file-exists? previous-generation)))
+               (link-to-empty-profile previous-generation)
+               (switch-to-previous-generation profile)
+               (display-and-delete number))
+              ((= number current-generation-number)
+               (roll-back profile)
+               (display-and-delete number))
+              (else
+               (display-and-delete number)))))
+
     ;; First roll back if asked to.
-    (if (and (assoc-ref opts 'roll-back?) (not dry-run?))
-        (begin
-          (roll-back profile)
-          (process-actions (alist-delete 'roll-back? opts)))
-        (let* ((installed (manifest-packages (profile-manifest profile)))
-               (upgrade-regexps (filter-map (match-lambda
-                                             (('upgrade . regexp)
-                                              (make-regexp (or regexp "")))
-                                             (_ #f))
-                                            opts))
-               (upgrade  (if (null? upgrade-regexps)
-                             '()
-                             (let ((newest (find-newest-available-packages)))
-                               (filter-map (match-lambda
-                                            ((name version output path _)
-                                             (and (any (cut regexp-exec <> name)
-                                                       upgrade-regexps)
-                                                  (upgradeable? name version path)
-                                                  (find-package name
-                                                                (or output "out"))))
-                                            (_ #f))
-                                           installed))))
-               (install  (append
-                          upgrade
-                          (filter-map (match-lambda
-                                       (('install . (? package? p))
-                                        (package->tuple p))
-                                       (('install . (? store-path?))
-                                        #f)
-                                       (('install . package)
-                                        (find-package package))
-                                       (_ #f))
-                                      opts)))
-               (drv      (filter-map (match-lambda
-                                      ((name version sub-drv
-                                             (? package? package)
-                                             (deps ...))
-                                       (check-package-freshness package)
-                                       (package-derivation (%store) package))
-                                      (_ #f))
-                                     install))
-               (install* (append
-                          (filter-map (match-lambda
-                                       (('install . (? package? p))
-                                        #f)
-                                       (('install . (? store-path? path))
-                                        (let-values (((name version)
-                                                      (package-name->name+version
-                                                       (store-path-package-name
-                                                        path))))
-                                          `(,name ,version #f ,path ())))
-                                       (_ #f))
-                                      opts)
-                          (map (lambda (tuple drv)
-                                 (match tuple
-                                   ((name version sub-drv _ (deps ...))
-                                    (let ((output-path
-                                           (derivation->output-path
-                                            drv sub-drv)))
-                                      `(,name ,version ,sub-drv ,output-path
-                                              ,(canonicalize-deps deps))))))
-                               install drv)))
-               (remove   (filter-map (match-lambda
-                                      (('remove . package)
-                                       package)
-                                      (_ #f))
-                                     opts))
-               (remove*  (filter-map (cut assoc <> installed) remove))
-               (packages (append install*
-                                 (fold (lambda (package result)
-                                         (match package
-                                           ((name _ out _ ...)
-                                            (filter (negate
-                                                     (cut same-package? <>
-                                                          name out))
-                                                    result))))
-                                       (fold alist-delete installed remove)
-                                       install*))))
+    (cond ((and (assoc-ref opts 'roll-back?) (not dry-run?))
+           (begin
+             (roll-back profile)
+             (process-actions (alist-delete 'roll-back? opts))))
+          ((and (assoc-ref opts 'delete-generations)
+                (not dry-run?))
+           (filter-map
+            (match-lambda
+             (('delete-generations . pattern)
+              (cond ((not (file-exists? profile)) ; XXX: race condition
+                     (leave (_ "profile '~a' does not exist~%")
+                            profile))
+                    ((string-null? pattern)
+                     (let ((numbers (generation-numbers profile)))
+                       (if (equal? numbers '(0))
+                           (exit 0)
+                           (for-each display-and-delete
+                                     (delete current-generation-number
+                                             numbers)))))
+                    ;; Do not delete the zeroth generation.
+                    ((equal? 0 (string->number pattern))
+                     (exit 0))
+                    ((matching-generations pattern profile)
+                     =>
+                     (lambda (numbers)
+                       (if (null-list? numbers)
+                           (exit 1)
+                           (for-each delete-generation numbers))))
+                    (else
+                     (leave (_ "invalid syntax: ~a~%")
+                            pattern)))
+
+              (process-actions
+               (alist-delete 'delete-generations opts)))
+             (_ #f))
+            opts))
+          (else
+           (let* ((installed (manifest-packages (profile-manifest profile)))
+                  (upgrade-regexps (filter-map (match-lambda
+                                                (('upgrade . regexp)
+                                                 (make-regexp (or regexp "")))
+                                                (_ #f))
+                                               opts))
+                  (upgrade (if (null? upgrade-regexps)
+                               '()
+                               (let ((newest (find-newest-available-packages)))
+                                 (filter-map
+                                  (match-lambda
+                                   ((name version output path _)
+                                    (and (any (cut regexp-exec <> name)
+                                              upgrade-regexps)
+                                         (upgradeable? name version path)
+                                         (find-package name
+                                                       (or output "out"))))
+                                   (_ #f))
+                                  installed))))
+                  (install (append
+                            upgrade
+                            (filter-map (match-lambda
+                                         (('install . (? package? p))
+                                          (package->tuple p))
+                                         (('install . (? store-path?))
+                                          #f)
+                                         (('install . package)
+                                          (find-package package))
+                                         (_ #f))
+                                        opts)))
+                  (drv (filter-map (match-lambda
+                                    ((name version sub-drv
+                                           (? package? package)
+                                           (deps ...))
+                                     (check-package-freshness package)
+                                     (package-derivation (%store) package))
+                                    (_ #f))
+                                   install))
+                  (install*
+                   (append
+                    (filter-map (match-lambda
+                                 (('install . (? package? p))
+                                  #f)
+                                 (('install . (? store-path? path))
+                                  (let-values (((name version)
+                                                (package-name->name+version
+                                                 (store-path-package-name
+                                                  path))))
+                                    `(,name ,version #f ,path ())))
+                                 (_ #f))
+                                opts)
+                    (map (lambda (tuple drv)
+                           (match tuple
+                                  ((name version sub-drv _ (deps ...))
+                                   (let ((output-path
+                                          (derivation->output-path
+                                           drv sub-drv)))
+                                     `(,name ,version ,sub-drv ,output-path
+                                             ,(canonicalize-deps deps))))))
+                         install drv)))
+                  (remove (filter-map (match-lambda
+                                       (('remove . package)
+                                        package)
+                                        (_ #f))
+                                      opts))
+                  (remove* (filter-map (cut assoc <> installed) remove))
+                  (packages
+                   (append install*
+                           (fold (lambda (package result)
+                                   (match package
+                                          ((name _ out _ ...)
+                                           (filter (negate
+                                                    (cut same-package? <>
+                                                         name out))
+                                                   result))))
+                                 (fold alist-delete installed remove)
+                                 install*))))
 
           (when (equal? profile %current-profile)
             (ensure-default-profile))
@@ -950,7 +1022,7 @@ more information.~%"))
                                                count)
                                         count)
                                 (display-search-paths packages
-                                                      profile))))))))))
+                                                      profile)))))))))))
 
   (define (process-query opts)
     ;; Process any query specified by OPTS.  Return #t when a query was
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 5f97aff..fc1c072 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -142,6 +142,17 @@ then
     # Make sure LIBRARY_PATH gets listed by `--search-paths'.
     guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap
     guix package --search-paths -p "$profile" | grep LIBRARY_PATH
+
+    # Delete the third generation and check that it was actually deleted.
+    guix package -p "$profile" --delete-generations=3
+    test -z "`guix package -p "$profile" -l 3`"
+
+    # Exit with 1 when a generation does not exist.
+    if guix package -p "$profile" --delete-generations=42;
+    then false; else true; fi
+
+    # Exit with 0 when trying to delete the zeroth generation.
+    guix package -p "$profile" --delete-generations=0
 fi
 
 # Make sure the `:' syntax works.
-- 
1.7.9.5


[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: Generation 0
  2013-09-26  2:18                       ` Nikita Karetnikov
@ 2013-09-26  9:44                         ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-26  9:44 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> Anyway, can I push this patch?

Yes, please push.

> From 00188949e6c49592f6f2dc30bf21731ae142afc0 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Thu, 26 Sep 2013 02:00:06 +0000
> Subject: [PATCH 1/3] guix package: Exit with 0 when there is nothing to list.
>
> * guix/scripts/package.scm (guix-package)[process-query]: Exit with 0
>   when there are no generations containing packages or no profiles.
> ---
>  guix/scripts/package.scm |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
> index 66505f1..ed1e72c 100644
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -983,7 +983,7 @@ more information.~%"))
>                 ((string-null? pattern)
>                  (let ((numbers (generation-numbers profile)))
>                    (if (equal? numbers '(0))
> -                      (exit 1)
> +                      (exit 0)
>                        (for-each list-generation numbers))))
>                 ((matching-generations pattern profile)
>                  =>

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-26  2:47                 ` Nikita Karetnikov
@ 2013-09-26  9:49                   ` Ludovic Courtès
  2013-09-27 19:04                     ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-26  9:49 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Frankly, I don’t like it.  I think the default behavior should not be to
>> let the user shoot themself in the foot.
>
>> WDYT?
>
> OK, what about these patches?  Can I push them?
>
>
> From 86d29a8b233d5cf6549fbcddf43b185086b7d178 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Wed, 25 Sep 2013 03:34:49 +0000
> Subject: [PATCH 2/3] guix package: Add 'link-to-empty-profile'.
>
> * guix/scripts/package.scm (link-to-empty-profile): New function.
>   (roll-back): Use it.

OK, please push.

> From c246f4a72ade85dffa95d7c598e24539896ca5a5 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> Date: Thu, 26 Sep 2013 02:36:24 +0000
> Subject: [PATCH 3/3] guix package: Add '--delete-generations'.
>
> * guix/scripts/package.scm (switch-to-previous-generation): New function.

(Normally that part would go in a patch of its own since it’s
refactoring unrelated to the implementation of ‘--delete-generations’,
but that’s OK for this time.)

>   (roll-back): Use the new function instead of 'switch-link'.
>   (show-help): Add '--delete-generations'.
>   (%options): Likewise.
>   (guix-package)[process-actions]: Add 'current-generation-number',
>   'display-and-delete', and 'delete-generation'.  Add support for
>   '--delete-generations', and reindent the code.
> * tests/guix-package.sh: Test '--delete-generations'.
> * doc/guix.texi (Invoking guix-package): Document '--delete-generations'.

Looks good to me, please push!

Thanks for all the work!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-25 13:13     ` Ludovic Courtès
@ 2013-09-26 11:35       ` Andreas Enge
  2013-09-28 13:25         ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Andreas Enge @ 2013-09-26 11:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Wed, Sep 25, 2013 at 03:13:25PM +0200, Ludovic Courtès wrote:
> Yes, so normally installed GTK+ apps will work out of the box now.  The
> only thing we could document is that fonts installed in the user profile
> will automatically be picked up.

Probably, one will still need to install fontconfig. Maybe you could try
out if emacs works for you without fontconfig. It did, to my surprise,
for me.

Andreas

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-09 16:47                         ` Ludovic Courtès
@ 2013-09-27  2:16                           ` Nikita Karetnikov
  2013-09-27 19:00                             ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-27  2:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 585 bytes --]

> Instead of a URL, you can also change bootstrap.scm to refer directly to
> a local file name, like this:

>   (package
>     ...
>     (source "/home/nikita/my-guile-that-works.tar.gz")
>     ...)

I’m sorry to say that we probably won’t be able to include the MIPS
binaries in 0.4 because it takes like three days to build everything.

The attached error is raised when I’m trying to build ‘hello’.  It seems
that the code is trying to use a string as a procedure.

I can’t spend more time on this issue today, but I’ll try to look into
it tomorrow.


[-- Attachment #1.2: bootstrap-error.txt --]
[-- Type: text/plain, Size: 1345 bytes --]

Backtrace:
In guix/packages.scm:
 350: 19 [expand-input # # # ...]
 313: 18 [cache # "mips64el-linux" #<procedure thunk ()>]
 388: 17 [thunk]
In srfi/srfi-1.scm:
 576: 16 [map #<procedure a0e720 at guix/packages.scm:389:39 (t-5742)> (# # # # ...)]
In guix/packages.scm:
 350: 15 [expand-input # # # ...]
 313: 14 [cache # "mips64el-linux" #<procedure thunk ()>]
 388: 13 [thunk]
In srfi/srfi-1.scm:
 576: 12 [map #<procedure a445d0 at guix/packages.scm:389:39 (t-5742)> (# # # # ...)]
In guix/packages.scm:
 350: 11 [expand-input # # # ...]
 313: 10 [cache # "mips64el-linux" #<procedure thunk ()>]
 388: 9 [thunk]
 280: 8 [package-transitive-inputs #]
In gnu/packages/bootstrap.scm:
 163: 7 [inputs]
 163: 6 [inputs]
 163: 5 [inputs]
 163: 4 [inputs]
 163: 3 [inputs]
 163: 2 [inputs]
 139: 1 [inputs]
In unknown file:
   ?: 0 ["/home/nikita/gnuabi64-tarballs/m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/binutils-static-stripped-2.23.2-mips64el-linux-gnuabi64.tar.xz" "mips64el-linux"]

ERROR: In procedure /home/nikita/gnuabi64-tarballs/m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/binutils-static-stripped-2.23.2-mips64el-linux-gnuabi64.tar.xz:
ERROR: Wrong type to apply: "/home/nikita/gnuabi64-tarballs/m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/binutils-static-stripped-2.23.2-mips64el-linux-gnuabi64.tar.xz"

[-- Attachment #1.3: bootstrap.scm.diff --]
[-- Type: text/x-diff, Size: 14594 bytes --]

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index a1d4c7f..98d01d3 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -70,14 +71,48 @@
                      (boot url-fetch))
                     (else orig-method))))))
 
-(define (package-from-tarball name* source* program-to-test description*)
-  "Return a package that correspond to the extraction of SOURCE*.
-PROGRAM-TO-TEST is a program to run after extraction of SOURCE*, to
-check whether everything is alright."
+;; (define (package-from-tarball name* source* program-to-test description*)
+;;   "Return a package that correspond to the extraction of SOURCE*.
+;; PROGRAM-TO-TEST is a program to run after extraction of SOURCE*, to
+;; check whether everything is alright."
+;;   (package
+;;     (name name*)
+;;     (version "0")
+;;     (source #f)
+;;     (build-system trivial-build-system)
+;;     (arguments
+;;      `(#:guile ,%bootstrap-guile
+;;        #:modules ((guix build utils))
+;;        #:builder
+;;        (let ((out     (assoc-ref %outputs "out"))
+;;              (tar     (assoc-ref %build-inputs "tar"))
+;;              (xz      (assoc-ref %build-inputs "xz"))
+;;              (tarball (assoc-ref %build-inputs "tarball")))
+;;          (use-modules (guix build utils))
+
+;;          (mkdir out)
+;;          (copy-file tarball "binaries.tar.xz")
+;;          (system* xz "-d" "binaries.tar.xz")
+;;          (let ((builddir (getcwd)))
+;;            (with-directory-excursion out
+;;              (and (zero? (system* tar "xvf"
+;;                                   (string-append builddir "/binaries.tar")))
+;;                   (zero? (system* (string-append "bin/" ,program-to-test)
+;;                                   "--version"))))))))
+;;     (inputs
+;;      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
+;;        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
+;;        ("tarball" ,(bootstrap-origin (source* (%current-system))))))
+;;     (synopsis description*)
+;;     (description #f)
+;;     (home-page #f)
+;;     (license #f)))
+
+(define (install-from-tarball name* source* program-to-test synopsis*)
   (package
     (name name*)
     (version "0")
-    (source #f)
+    (source source*)
     (build-system trivial-build-system)
     (arguments
      `(#:guile ,%bootstrap-guile
@@ -102,10 +137,10 @@ check whether everything is alright."
      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
        ("tarball" ,(bootstrap-origin (source* (%current-system))))))
-    (synopsis description*)
+    (synopsis synopsis*)
     (description #f)
     (home-page #f)
-    (license #f)))
+    (license #f)))  
 
 (define package-with-bootstrap-guile
   (memoize
@@ -170,7 +205,10 @@ check whether everything is alright."
                               (xz    (->store "xz"))
                               (mkdir (->store "mkdir"))
                               (bash  (->store "bash"))
-                              (guile (->store "guile-2.0.7.tar.xz"))
+                              (guile (->store
+                                      (if (string=? (%current-system) "mips64el-linux")
+                                          "guile-2.0.9.tar.xz"
+                                          "guile-2.0.7.tar.xz")))
                               (builder
                                (add-text-to-store store
                                                   "build-bootstrap-guile.sh"
@@ -191,6 +229,7 @@ $out/bin/guile --version~%"
    (package
      (name "guile-bootstrap")
      (version "2.0")
+     ;; (source "/home/nikita/gnuabi64-tarballs/m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/guile-static-stripped-2.0.9-mips64el-linux-gnuabi64.tar.xz")
      (source #f)
      (build-system raw)
      (synopsis "Bootstrap Guile")
@@ -203,41 +242,63 @@ $out/bin/guile --version~%"
   '("http://alpha.gnu.org/gnu/guix/bootstrap"
     "http://www.fdn.fr/~lcourtes/software/guix/packages"))
 
+;; (define %bootstrap-coreutils&co
+;;   (package-from-tarball "bootstrap-binaries"
+;;                         (lambda (system)
+;;                           (origin
+;;                            (method url-fetch)
+;;                            (uri (map (cut string-append <> "/" system
+;;                                           "/20130105/static-binaries.tar.xz")
+;;                                      %bootstrap-base-urls))
+;;                            (sha256
+;;                             (match system
+;;                               ("x86_64-linux"
+;;                                (base32
+;;                                 "0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls"))
+;;                               ("i686-linux"
+;;                                (base32
+;;                                 "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))
+;;                               ("mips64el-linux"
+;;                                (base32
+;;                                 "05cbkd38vsd41dbl0lsg3zq9dhiw92dpqck3wb3a301vi2m30q3n"))))))
+;;                         "true"                    ; the program to test
+;;                         "Bootstrap binaries of Coreutils, Awk, etc."))
+
 (define %bootstrap-coreutils&co
-  (package-from-tarball "bootstrap-binaries"
-                        (lambda (system)
-                          (origin
-                           (method url-fetch)
-                           (uri (map (cut string-append <> "/" system
-                                          "/20130105/static-binaries.tar.xz")
-                                     %bootstrap-base-urls))
-                           (sha256
-                            (match system
-                              ("x86_64-linux"
-                               (base32
-                                "0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls"))
-                              ("i686-linux"
-                               (base32
-                                "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))))))
+  (install-from-tarball "bootstrap-binaries"
+                        (string-append "/home/nikita/gnuabi64-tarballs/"
+                                       "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                                       "static-binaries-0-mips64el-linux-gnuabi64.tar.xz")
                         "true"                    ; the program to test
                         "Bootstrap binaries of Coreutils, Awk, etc."))
 
+;; (define %bootstrap-binutils
+;;   (package-from-tarball "binutils-bootstrap"
+;;                         (lambda (system)
+;;                           (origin
+;;                            (method url-fetch)
+;;                            (uri (map (cut string-append <> "/" system
+;;                                           "/20130105/binutils-2.22.tar.xz")
+;;                                      %bootstrap-base-urls))
+;;                            (sha256
+;;                             (match system
+;;                               ("x86_64-linux"
+;;                                (base32
+;;                                 "1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh"))
+;;                               ("i686-linux"
+;;                                (base32
+;;                                 "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))
+;;                               ("mips64el-linux"
+;;                                (base32
+;;                                 "1kmmyfm572awzfrpwq6fgyi30cps8ifm2ibiladchd4vf8nw2blb"))))))
+;;                         "ld"                      ; the program to test
+;;                         "Bootstrap binaries of the GNU Binutils"))
+
 (define %bootstrap-binutils
-  (package-from-tarball "binutils-bootstrap"
-                        (lambda (system)
-                          (origin
-                           (method url-fetch)
-                           (uri (map (cut string-append <> "/" system
-                                          "/20130105/binutils-2.22.tar.xz")
-                                     %bootstrap-base-urls))
-                           (sha256
-                            (match system
-                              ("x86_64-linux"
-                               (base32
-                                "1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh"))
-                              ("i686-linux"
-                               (base32
-                                "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))))))
+  (install-from-tarball "binutils-bootstrap"
+                        (string-append "/home/nikita/gnuabi64-tarballs/"
+                                                  "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                                                  "binutils-static-stripped-2.23.2-mips64el-linux-gnuabi64.tar.xz")
                         "ld"                      ; the program to test
                         "Bootstrap binaries of the GNU Binutils"))
 
@@ -246,7 +307,10 @@ $out/bin/guile --version~%"
   (package
     (name "glibc-bootstrap")
     (version "0")
-    (source #f)
+    ;; (source #f)
+    (source (string-append "/home/nikita/gnuabi64-tarballs/"
+                           "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                           "glibc-stripped-2.17-mips64el-linux-gnuabi64.tar.xz"))
     (build-system trivial-build-system)
     (arguments
      `(#:guile ,%bootstrap-guile
@@ -275,20 +339,24 @@ $out/bin/guile --version~%"
     (inputs
      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
-       ("tarball" ,(bootstrap-origin
-                    (origin
-                     (method url-fetch)
-                     (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/glibc-2.17.tar.xz")
-                               %bootstrap-base-urls))
-                     (sha256
-                      (match (%current-system)
-                        ("x86_64-linux"
-                         (base32
-                          "18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3"))
-                        ("i686-linux"
-                         (base32
-                          "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88")))))))))
+       ;; ("tarball" ,(bootstrap-origin
+       ;;              (origin
+       ;;               (method url-fetch)
+       ;;               (uri (map (cut string-append <> "/" (%current-system)
+       ;;                              "/20130105/glibc-2.17.tar.xz")
+       ;;                         %bootstrap-base-urls))
+       ;;               (sha256
+       ;;                (match (%current-system)
+       ;;                  ("x86_64-linux"
+       ;;                   (base32
+       ;;                    "18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3"))
+       ;;                  ("i686-linux"
+       ;;                   (base32
+       ;;                    "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88"))
+       ;;                  ("mips64el-linux"
+       ;;                   (base32
+       ;;                    "1x88aknahgaba705wv317l1g0dx4qvrym17p7mfn6fzjzrvspwwn")))))))))
+       ("tarball" ,source)))
     (synopsis "Bootstrap binaries and headers of the GNU C Library")
     (description #f)
     (home-page #f)
@@ -300,7 +368,10 @@ $out/bin/guile --version~%"
   (package
     (name "gcc-bootstrap")
     (version "0")
-    (source #f)
+    ;; (source #f)
+    (source (string-append "/home/nikita/gnuabi64-tarballs/"
+                           "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                           "gcc-stripped-4.7.3-mips64el-linux-gnuabi64.tar.xz"))
     (build-system trivial-build-system)
     (arguments
      `(#:guile ,%bootstrap-guile
@@ -343,20 +414,24 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
        ("bash" ,(search-bootstrap-binary "bash" (%current-system)))
        ("libc" ,%bootstrap-glibc)
-       ("tarball" ,(bootstrap-origin
-                    (origin
-                     (method url-fetch)
-                     (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/gcc-4.7.2.tar.xz")
-                               %bootstrap-base-urls))
-                     (sha256
-                      (match (%current-system)
-                        ("x86_64-linux"
-                         (base32
-                          "1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px"))
-                        ("i686-linux"
-                         (base32
-                          "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2")))))))))
+       ;; ("tarball" ,(bootstrap-origin
+       ;;              (origin
+       ;;               (method url-fetch)
+       ;;               (uri (map (cut string-append <> "/" (%current-system)
+       ;;                              "/20130105/gcc-4.7.2.tar.xz")
+       ;;                         %bootstrap-base-urls))
+       ;;               (sha256
+       ;;                (match (%current-system)
+       ;;                  ("x86_64-linux"
+       ;;                   (base32
+       ;;                    "1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px"))
+       ;;                  ("i686-linux"
+       ;;                   (base32
+       ;;                    "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2"))
+       ;;                  ("mips64el-linux"
+       ;;                   (base32
+       ;;                    "053ainjcyvjp1fdchndannsjvdysk6rcphi9g7p0zr23q4i3xq9r")))))))))
+       ("tarball" ,source)))
     (native-search-paths
      (list (search-path-specification
             (variable "CPATH")

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-27  2:16                           ` Nikita Karetnikov
@ 2013-09-27 19:00                             ` Ludovic Courtès
  2013-09-29 13:27                               ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-27 19:00 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

>> Instead of a URL, you can also change bootstrap.scm to refer directly to
>> a local file name, like this:
>
>>   (package
>>     ...
>>     (source "/home/nikita/my-guile-that-works.tar.gz")
>>     ...)
>
> I’m sorry to say that we probably won’t be able to include the MIPS
> binaries in 0.4 because it takes like three days to build everything.

No problem.  We had a tight schedule, and there’ll be a 0.5 eventually
anyway.  ;-)

> The attached error is raised when I’m trying to build ‘hello’.  It seems
> that the code is trying to use a string as a procedure.
>
> I can’t spend more time on this issue today, but I’ll try to look into
> it tomorrow.

That would be a nice assignment for the hackathon.  :-)

> -(define (package-from-tarball name* source* program-to-test description*)
> -  "Return a package that correspond to the extraction of SOURCE*.
> -PROGRAM-TO-TEST is a program to run after extraction of SOURCE*, to
> -check whether everything is alright."
> +;; (define (package-from-tarball name* source* program-to-test description*)

You should keep this procedure as is...

> +;; (define %bootstrap-coreutils&co
> +;;   (package-from-tarball "bootstrap-binaries"
> +;;                         (lambda (system)
> +;;                           (origin
> +;;                            (method url-fetch)
> +;;                            (uri (map (cut string-append <> "/" system
> +;;                                           "/20130105/static-binaries.tar.xz")
> +;;                                      %bootstrap-base-urls))

... and instead modify the ‘uri’ fields like the one above...

>  (define %bootstrap-coreutils&co
> -  (package-from-tarball "bootstrap-binaries"
> -                        (lambda (system)
> -                          (origin
> -                           (method url-fetch)
> -                           (uri (map (cut string-append <> "/" system
> -                                          "/20130105/static-binaries.tar.xz")
> -                                     %bootstrap-base-urls))

... and this one, etc.

In short: anytime you see a URL or URL list, replace it with a string
containing the local file name.

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: [PATCH] guix package: Add '--delete-generations'.
  2013-09-26  9:49                   ` Ludovic Courtès
@ 2013-09-27 19:04                     ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-27 19:04 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Hello!

In the pre-release rush, I modified/fixed in commit d7ddb25 the behavior
of ‘--delete-generations’: while ‘--list-generations=20d’ should list
generations up to 20 days old, ‘--delete-generations=20d’ should delete
generations *older* than 20 days.

This is something we had overlooked, and so ‘--delete-generations=20d’
would delete generations of less than 20 days before the patch, which is
definitely not something one might want.

Anyway, thanks a lot for working on that under such constraints!

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-26 11:35       ` Andreas Enge
@ 2013-09-28 13:25         ` Ludovic Courtès
  2013-09-29 21:29           ` Alex Sassmannshausen
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-28 13:25 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Andreas Enge <andreas@enge.fr> skribis:

> On Wed, Sep 25, 2013 at 03:13:25PM +0200, Ludovic Courtès wrote:
>> Yes, so normally installed GTK+ apps will work out of the box now.  The
>> only thing we could document is that fonts installed in the user profile
>> will automatically be picked up.
>
> Probably, one will still need to install fontconfig. Maybe you could try
> out if emacs works for you without fontconfig. It did, to my surprise,
> for me.

I just upgraded my profile and remove gs-fonts, and Emacs still displays
properly.  So unless there’s an evil cache somewhere, I’d say that it works.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-27 19:00                             ` Ludovic Courtès
@ 2013-09-29 13:27                               ` Nikita Karetnikov
  2013-09-29 13:31                                 ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-29 13:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 85 bytes --]

So I changed ‘bootstrap.scm’ and got the attached error message.  Any
ideas?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: bootstrap.scm.diff --]
[-- Type: text/x-diff, Size: 6738 bytes --]

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index a1d4c7f..9151e01 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -63,12 +63,13 @@
       (fetch store url hash-algo hash
              #:guile %bootstrap-guile
              #:system system)))
-
+  (if (string? source)
+      source
   (let ((orig-method (origin-method source)))
     (origin (inherit source)
       (method (cond ((eq? orig-method url-fetch)
                      (boot url-fetch))
-                    (else orig-method))))))
+                    (else orig-method)))))))
 
 (define (package-from-tarball name* source* program-to-test description*)
   "Return a package that correspond to the extraction of SOURCE*.
@@ -170,7 +171,10 @@ check whether everything is alright."
                               (xz    (->store "xz"))
                               (mkdir (->store "mkdir"))
                               (bash  (->store "bash"))
-                              (guile (->store "guile-2.0.7.tar.xz"))
+                              (guile (->store
+                                      (if (string=? (%current-system) "mips64el-linux")
+                                          "guile-2.0.9.tar.xz"
+                                          "guile-2.0.7.tar.xz")))
                               (builder
                                (add-text-to-store store
                                                   "build-bootstrap-guile.sh"
@@ -206,38 +210,18 @@ $out/bin/guile --version~%"
 (define %bootstrap-coreutils&co
   (package-from-tarball "bootstrap-binaries"
                         (lambda (system)
-                          (origin
-                           (method url-fetch)
-                           (uri (map (cut string-append <> "/" system
-                                          "/20130105/static-binaries.tar.xz")
-                                     %bootstrap-base-urls))
-                           (sha256
-                            (match system
-                              ("x86_64-linux"
-                               (base32
-                                "0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls"))
-                              ("i686-linux"
-                               (base32
-                                "0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))))))
+                          (string-append "/home/nikita/gnuabi64-tarballs/"
+                                         "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                                         "static-binaries-0-mips64el-linux-gnuabi64.tar.xz"))
                         "true"                    ; the program to test
                         "Bootstrap binaries of Coreutils, Awk, etc."))
 
 (define %bootstrap-binutils
   (package-from-tarball "binutils-bootstrap"
                         (lambda (system)
-                          (origin
-                           (method url-fetch)
-                           (uri (map (cut string-append <> "/" system
-                                          "/20130105/binutils-2.22.tar.xz")
-                                     %bootstrap-base-urls))
-                           (sha256
-                            (match system
-                              ("x86_64-linux"
-                               (base32
-                                "1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh"))
-                              ("i686-linux"
-                               (base32
-                                "1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))))))
+                          (string-append "/home/nikita/gnuabi64-tarballs/"
+                                         "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                                         "binutils-static-stripped-2.23.2-mips64el-linux-gnuabi64.tar.xz"))
                         "ld"                      ; the program to test
                         "Bootstrap binaries of the GNU Binutils"))
 
@@ -275,20 +259,9 @@ $out/bin/guile --version~%"
     (inputs
      `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
-       ("tarball" ,(bootstrap-origin
-                    (origin
-                     (method url-fetch)
-                     (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/glibc-2.17.tar.xz")
-                               %bootstrap-base-urls))
-                     (sha256
-                      (match (%current-system)
-                        ("x86_64-linux"
-                         (base32
-                          "18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3"))
-                        ("i686-linux"
-                         (base32
-                          "08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88")))))))))
+       ("tarball" ,(string-append "/home/nikita/gnuabi64-tarballs/"
+                                  "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                                  "glibc-stripped-2.17-mips64el-linux-gnuabi64.tar.xz"))))
     (synopsis "Bootstrap binaries and headers of the GNU C Library")
     (description #f)
     (home-page #f)
@@ -343,20 +316,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
        ("xz"  ,(search-bootstrap-binary "xz" (%current-system)))
        ("bash" ,(search-bootstrap-binary "bash" (%current-system)))
        ("libc" ,%bootstrap-glibc)
-       ("tarball" ,(bootstrap-origin
-                    (origin
-                     (method url-fetch)
-                     (uri (map (cut string-append <> "/" (%current-system)
-                                    "/20130105/gcc-4.7.2.tar.xz")
-                               %bootstrap-base-urls))
-                     (sha256
-                      (match (%current-system)
-                        ("x86_64-linux"
-                         (base32
-                          "1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px"))
-                        ("i686-linux"
-                         (base32
-                          "06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2")))))))))
+       ("tarball" ,(string-append "/home/nikita/gnuabi64-tarballs/"
+                                  "m7vf579yxmif4fdp2qn1gcilfddp2m37-bootstrap-tarballs-0/"
+                                  "gcc-stripped-4.7.3-mips64el-linux-gnuabi64.tar.xz"))))
     (native-search-paths
      (list (search-path-specification
             (variable "CPATH")

[-- Attachment #1.3: bzip-error.txt --]
[-- Type: text/plain, Size: 1871 bytes --]

@ build-started /nix/store/pl2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv - mips64el-linux /nix/var/log/nix/drvs/pl//2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv.bz2
starting phase `set-paths'
environment variable `PATH' set to `/nix/store/7dqvgffz0vdpgpn0sbf35ybik51gjv8s-gcc-bootstrap-0/bin:/nix/store/8pkxhjsa7cwm79czls3g4n7p37dfgzg7-binutils-bootstrap-0/bin:/nix/store/g4rfxczhx2lcb40g0yyjnv5lwsg76y11-bootstrap-binaries-0/bin:/nix/store/g4rfxczhx2lcb40g0yyjnv5lwsg76y11-bootstrap-binaries-0/bin'
environment variable `CPATH' set to `/nix/store/gq5zyr455yci4sjl4pyzk3wmsg9bf6rz-glibc-bootstrap-0/include'
environment variable `LIBRARY_PATH' set to `/nix/store/gq5zyr455yci4sjl4pyzk3wmsg9bf6rz-glibc-bootstrap-0/lib:/nix/store/7dqvgffz0vdpgpn0sbf35ybik51gjv8s-gcc-bootstrap-0/lib'
phase `set-paths' succeeded after 0 seconds
starting phase `unpack'
tar (child): cannot run bzip2: No such file or directory
tar (child): trying lbzip2
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
phase `unpack' failed after 2 seconds
note: keeping build directory `/tmp/nix-build-make-boot0-3.82.drv-0'
builder for `/nix/store/pl2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv' failed with exit code 1
@ build-failed /nix/store/pl2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv - 1 builder for `/nix/store/pl2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv' failed with exit code 1
cannot build derivation `/nix/store/0dhfg4jhan1w7d0qzdy7vz4l1a1lmzdi-gawk-4.1.0.drv': 1 dependencies couldn't be built
cannot build derivation `/nix/store/k8xd7wi9224phnlr9q0pn30iqnkvai36-hello-2.8.drv': 1 dependencies couldn't be built
guix build: error: build failed: build of `/nix/store/k8xd7wi9224phnlr9q0pn30iqnkvai36-hello-2.8.drv' failed

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-29 13:27                               ` Nikita Karetnikov
@ 2013-09-29 13:31                                 ` Ludovic Courtès
  2013-09-29 23:18                                   ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-29 13:31 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> So I changed ‘bootstrap.scm’ and got the attached error message.  Any
> ideas?

The diff for bootstrap.scm looks good.

> @ build-started /nix/store/pl2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv - mips64el-linux /nix/var/log/nix/drvs/pl//2prx6qj1cbcf8rxs874s6r5w0zhzhs-make-boot0-3.82.drv.bz2
> starting phase `set-paths'
> environment variable `PATH' set to `/nix/store/7dqvgffz0vdpgpn0sbf35ybik51gjv8s-gcc-bootstrap-0/bin:/nix/store/8pkxhjsa7cwm79czls3g4n7p37dfgzg7-binutils-bootstrap-0/bin:/nix/store/g4rfxczhx2lcb40g0yyjnv5lwsg76y11-bootstrap-binaries-0/bin:/nix/store/g4rfxczhx2lcb40g0yyjnv5lwsg76y11-bootstrap-binaries-0/bin'
> environment variable `CPATH' set to `/nix/store/gq5zyr455yci4sjl4pyzk3wmsg9bf6rz-glibc-bootstrap-0/include'
> environment variable `LIBRARY_PATH' set to `/nix/store/gq5zyr455yci4sjl4pyzk3wmsg9bf6rz-glibc-bootstrap-0/lib:/nix/store/7dqvgffz0vdpgpn0sbf35ybik51gjv8s-gcc-bootstrap-0/lib'
> phase `set-paths' succeeded after 0 seconds
> starting phase `unpack'
> tar (child): cannot run bzip2: No such file or directory

Normally
/nix/store/g4rfxczhx2lcb40g0yyjnv5lwsg76y11-bootstrap-binaries-0/bin
should contain ‘bzip2’.  Can you check whether this is the case?

If it’s missing, can you double-check what your static-binaries.tar.xz
tarball contains?  Normally make-bootstrap.scm produces a tarball that
does include bzip2.

TIA,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: Goals for 0.4
  2013-09-28 13:25         ` Ludovic Courtès
@ 2013-09-29 21:29           ` Alex Sassmannshausen
  0 siblings, 0 replies; 132+ messages in thread
From: Alex Sassmannshausen @ 2013-09-29 21:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


>> Probably, one will still need to install fontconfig. Maybe you could try
>> out if emacs works for you without fontconfig. It did, to my surprise,
>> for me.
>
> I just upgraded my profile and remove gs-fonts, and Emacs still displays
> properly.  So unless there’s an evil cache somewhere, I’d say that it works.

I can confirm Emacs working fine on a clean install without installing
any additional font packages, which I take to confirm your findings.

Best wishes,

Alex

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-29 13:31                                 ` Ludovic Courtès
@ 2013-09-29 23:18                                   ` Nikita Karetnikov
  2013-09-30 11:32                                     ` Nikita Karetnikov
  2013-09-30 16:09                                     ` Ludovic Courtès
  0 siblings, 2 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-29 23:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

So I ran this command:

$ ./pre-inst-env guix build bootstrap-tarballs --target=mips64el-linux-gnuabi64

but it failed due to the already known problem:

/tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.18.drv-0/build/libc_pic.a: could not read symbols: Archive has no index; run ranlib to add one

Then I tried this one:

$ ./pre-inst-env guix build bootstrap-tarballs -s x86_64-linux --target=mips64el-linux-gnuabi64

which returned

guix build: error: build failed: a `x86_64-linux' is required to build `/nix/store/v68c12la3xlxii4risamhmh1fic04jq4-gcc-4.7.3.drv', but I am a `i686-linux'

How long will it take for Hydra to catch up?  There is a percentage on
hydra.gnu.org (under the word “Success”).  Is it the thing I’m looking
for?

Also, how can I check whether this particular package [1] was built or
not?

[1] http://git.savannah.gnu.org/cgit/guix.git/commit/?id=ab4fab19380138df582fdde846e7524481964c1a

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-29 23:18                                   ` Nikita Karetnikov
@ 2013-09-30 11:32                                     ` Nikita Karetnikov
  2013-09-30 16:26                                       ` Ludovic Courtès
                                                         ` (2 more replies)
  2013-09-30 16:09                                     ` Ludovic Courtès
  1 sibling, 3 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-30 11:32 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 62 bytes --]

OK, I fetched the tarballs.  Now I’m getting this error.


[-- Attachment #1.2: make-boot0.txt --]
[-- Type: text/plain, Size: 4658 bytes --]

$ ./pre-inst-env guix build -K hello

[...]

make-3.82/main.c
make-3.82/README.OS2
make-3.82/remote-cstms.c
phase `unpack' succeeded after 4 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
starting phase `patch'
applying patch `/nix/store/nf226injsfkw8ljjjfq1280jj530xbvv-make-impure-dirs.patch'
patching file read.c
Hunk #1 succeeded at 109 (offset 10 lines).
patching file remake.c
Hunk #1 succeeded at 1509 (offset 57 lines).
phase `patch' succeeded after 0 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
starting phase `patch-source-shebangs'
patch-shebang: ./config/mdate-sh: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/compile: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/config.guess: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/missing: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/mkinstalldirs: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/depcomp: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/config.rpath: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/install-sh: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/config.sub: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./tests/scripts/targets/SECONDARY: warning: no binary for interpreter `-*-perl-*-' found in $PATH
patch-shebang: ./tests/run_make_tests.pl: warning: no binary for interpreter `perl' found in $PATH
patch-shebang: ./tests/test_driver.pl: warning: no binary for interpreter `perl' found in $PATH
patch-shebang: ./tests/run_make_tests: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./tests/mkshadow: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./build.sh.in: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
patch-shebang: ./configure: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
phase `patch-source-shebangs' succeeded after 1 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
starting phase `configure'
source directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82" (relative from build: ".")
build directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82"
configure flags: ("CONFIG_SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" "SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" "--prefix=/nix/store/4ksc0dgml5158lrz3047bxn0ignw1943-make-boot0-3.82" "--enable-fast-install")
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
configure: WARNING: unrecognized options: --enable-fast-install
pwd: error retrieving current directory: getcwd: cannot access parent directories: Success
pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address
configure: error: working directory cannot be determined
phase `configure' failed after 0 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
note: keeping build directory `/tmp/nix-build-make-boot0-3.82.drv-2'
builder for `/nix/store/z7pfz91gzfamhvmlqwv6h3qv4xnk76r3-make-boot0-3.82.drv' failed with exit code 1
@ build-failed /nix/store/z7pfz91gzfamhvmlqwv6h3qv4xnk76r3-make-boot0-3.82.drv - 1 builder for `/nix/store/z7pfz91gzfamhvmlqwv6h3qv4xnk76r3-make-boot0-3.82.drv' failed with exit code 1
cannot build derivation `/nix/store/hy3bq0ylcdnd7zza9vy73hxjm8mx8fim-bzip2-1.0.6.drv': 1 dependencies couldn't be built
cannot build derivation `/nix/store/29xskak7vbrgrnjdmnp9razcc5ya2swq-hello-2.8.drv': 1 dependencies couldn't be built
guix build: error: build failed: build of `/nix/store/29xskak7vbrgrnjdmnp9razcc5ya2swq-hello-2.8.drv' failed

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-29 23:18                                   ` Nikita Karetnikov
  2013-09-30 11:32                                     ` Nikita Karetnikov
@ 2013-09-30 16:09                                     ` Ludovic Courtès
  1 sibling, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-30 16:09 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> So I ran this command:
>
> $ ./pre-inst-env guix build bootstrap-tarballs --target=mips64el-linux-gnuabi64
>
> but it failed due to the already known problem:
>
> /tmp/nix-build-glibc-cross-mips64el-linux-gnuabi64-2.18.drv-0/build/libc_pic.a: could not read symbols: Archive has no index; run ranlib to add one

That’s when cross-building from i686-linux, and that’s really a glibc
issue.

> Then I tried this one:
>
> $ ./pre-inst-env guix build bootstrap-tarballs -s x86_64-linux --target=mips64el-linux-gnuabi64
>
> which returned
>
> guix build: error: build failed: a `x86_64-linux' is required to build `/nix/store/v68c12la3xlxii4risamhmh1fic04jq4-gcc-4.7.3.drv', but I am a `i686-linux'
>
> How long will it take for Hydra to catch up?  There is a percentage on
> hydra.gnu.org (under the word “Success”).  Is it the thing I’m looking
> for?
>
> Also, how can I check whether this particular package [1] was built or
> not?

Like this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (use-modules (guix store)(guix derivations)(guix packages)(gnu packages compression))
scheme@(guile-user)> (define s (open-connection))
scheme@(guile-user)> (package-cross-derivation s bzip2 "mips64el-linux-gnuabi64")
$2 = #<derivation /nix/store/zk41hhbyfw88vzch4cnillvmgjwv9wn6-bzip2-1.0.6.drv => /nix/store/bh6xbykpjgwsn0cfzq3zzcbs9cih154k-bzip2-1.0.6 4ba0500>
scheme@(guile-user)> (has-substitutes? s (derivation->output-path $2))
$3 = #f
--8<---------------cut here---------------end--------------->8---

However:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (use-modules (gnu packages make-bootstrap))
scheme@(guile-user)> (package-cross-derivation s %bootstrap-tarballs "mips64el-linux-gnuabi64")
$4 = #<derivation /nix/store/2ng9gri40z4l1ql0r72aqvslal2fl22w-bootstrap-tarballs-0.drv => /nix/store/46s2jwp95dfqh0yv6gyww6hhnsdxd4d7-bootstrap-tarballs-0 4a77fa0>
scheme@(guile-user)> (has-substitutes? s (derivation->output-path $4))
$5 = #t
--8<---------------cut here---------------end--------------->8---

So the bootstrap tarballs, which include the fixed bzip2, should be
substitutable at this time.

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-30 11:32                                     ` Nikita Karetnikov
@ 2013-09-30 16:26                                       ` Ludovic Courtès
  2013-09-30 21:51                                         ` Nikita Karetnikov
  2013-10-07 18:47                                       ` Mark H Weaver
  2013-10-10  4:08                                       ` Mark H Weaver
  2 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-09-30 16:26 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel, Lluís Batlle

(Cc’ing Lluís who may know more.)

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> OK, I fetched the tarballs.  Now I’m getting this error.
>
>
> $ ./pre-inst-env guix build -K hello
>
> [...]
>
> make-3.82/main.c
> make-3.82/README.OS2
> make-3.82/remote-cstms.c
> phase `unpack' succeeded after 4 seconds
> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device

Could you try running the statically-linked bash from
‘static-binaries.tar.xz’ and see if the same error occurs?  Perhaps
strace it so we can see where that error comes from.

Looking at
<http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/syscalls/?cvsroot=src>,
syscalls have different numbers in n64 vs. n32.  So I suppose the kernel
needs to be compiled to support the n64 ABI?

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-30 16:26                                       ` Ludovic Courtès
@ 2013-09-30 21:51                                         ` Nikita Karetnikov
  2013-10-01  7:09                                           ` Lluís Batlle i Rossell
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-09-30 21:51 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel, Lluís Batlle

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

> Could you try running the statically-linked bash from
> ‘static-binaries.tar.xz’ and see if the same error occurs?  Perhaps
> strace it so we can see where that error comes from.

I don’t see anything similar.

> Looking at
> <http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/syscalls/?cvsroot=src>,
> syscalls have different numbers in n64 vs. n32.  So I suppose the kernel
> needs to be compiled to support the n64 ABI?

So, should I try this, or do you have other ideas?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-30 21:51                                         ` Nikita Karetnikov
@ 2013-10-01  7:09                                           ` Lluís Batlle i Rossell
  2013-10-01  7:48                                             ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Lluís Batlle i Rossell @ 2013-10-01  7:09 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

On Tue, Oct 01, 2013 at 01:51:28AM +0400, Nikita Karetnikov wrote:
> > Could you try running the statically-linked bash from
> > ‘static-binaries.tar.xz’ and see if the same error occurs?  Perhaps
> > strace it so we can see where that error comes from.
> 
> I don’t see anything similar.
> 
> > Looking at
> > <http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/syscalls/?cvsroot=src>,
> > syscalls have different numbers in n64 vs. n32.  So I suppose the kernel
> > needs to be compiled to support the n64 ABI?
> 
> So, should I try this, or do you have other ideas?

Sure the kernel, needs to have n64 support enabled, to run n64 binaries. I
imagine it would be detected at ELF header though, and not simply getting
failing syscalls.

I'm sorry, but I don't know what problem is that. Are you running a recent
kernel, first?

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01  7:09                                           ` Lluís Batlle i Rossell
@ 2013-10-01  7:48                                             ` Nikita Karetnikov
  2013-10-01  8:03                                               ` Lluís Batlle i Rossell
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-10-01  7:48 UTC (permalink / raw)
  To: Lluís Batlle i Rossell; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

> Sure the kernel, needs to have n64 support enabled, to run n64 binaries. I
> imagine it would be detected at ELF header though, and not simply getting
> failing syscalls.

> I'm sorry, but I don't know what problem is that. Are you running a recent
> kernel, first?

Linux-libre 3.5.3 from gNewSense.  Which version would you recommend?

Also, I remember that it was necessary to disable CONFIG_EXT4_FS and
CONFIG_EXT4_USE_FOR_EXT23.  Is it fixed now?  Do you have a working
config for Linux-libre?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01  7:48                                             ` Nikita Karetnikov
@ 2013-10-01  8:03                                               ` Lluís Batlle i Rossell
  2013-10-01  8:55                                                 ` Nikita Karetnikov
  0 siblings, 1 reply; 132+ messages in thread
From: Lluís Batlle i Rossell @ 2013-10-01  8:03 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

On Tue, Oct 01, 2013 at 11:48:48AM +0400, Nikita Karetnikov wrote:
> > Sure the kernel, needs to have n64 support enabled, to run n64 binaries. I
> > imagine it would be detected at ELF header though, and not simply getting
> > failing syscalls.
> 
> > I'm sorry, but I don't know what problem is that. Are you running a recent
> > kernel, first?
> 
> Linux-libre 3.5.3 from gNewSense.  Which version would you recommend?
> 
> Also, I remember that it was necessary to disable CONFIG_EXT4_FS and
> CONFIG_EXT4_USE_FOR_EXT23.  Is it fixed now?  Do you have a working
> config for Linux-libre?

In fact I was reluctant to raise again the ext4 topic ;) But I think 3.5.3 has a
broken readdir() syscall in ext4. I think it's not a problem of kernel options
active. You simply have to avoid using ext4 (or even ext3, I can't recall).

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01  8:03                                               ` Lluís Batlle i Rossell
@ 2013-10-01  8:55                                                 ` Nikita Karetnikov
  2013-10-01  8:59                                                   ` Nikita Karetnikov
  2013-10-01  9:30                                                   ` Lluís Batlle i Rossell
  0 siblings, 2 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-10-01  8:55 UTC (permalink / raw)
  To: Lluís Batlle i Rossell; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]

> In fact I was reluctant to raise again the ext4 topic ;) But I think 3.5.3 has a
> broken readdir() syscall in ext4. I think it's not a problem of kernel options
> active. You simply have to avoid using ext4 (or even ext3, I can't recall).

In the past, I was using EXT3 with CONFIG_EXT4_USE_FOR_EXT23, and there
were problems with OOM Killer.  That was fixed by switching to
CONFIG_EXT3_FS.

I’ve recently tried to compile several versions of Linux-libre.  I used
‘/proc/config.gz’ but changed the mentioned options.  Whenever I tried,
I was getting multiple warnings, “a variable is defined but is not used”
or something like that.  I can’t remember the last time when I
configured a kernel myself.  So I’m not sure whether such warnings are
tolerable or not.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01  8:55                                                 ` Nikita Karetnikov
@ 2013-10-01  8:59                                                   ` Nikita Karetnikov
  2013-10-01  9:30                                                   ` Lluís Batlle i Rossell
  1 sibling, 0 replies; 132+ messages in thread
From: Nikita Karetnikov @ 2013-10-01  8:59 UTC (permalink / raw)
  To: Lluís Batlle i Rossell; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

> I was getting multiple warnings, “a variable is defined but is not used”
> or something like that.

Or “unbound variable”; I can’t remember.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01  8:55                                                 ` Nikita Karetnikov
  2013-10-01  8:59                                                   ` Nikita Karetnikov
@ 2013-10-01  9:30                                                   ` Lluís Batlle i Rossell
  2013-10-01 10:06                                                     ` Nikita Karetnikov
  1 sibling, 1 reply; 132+ messages in thread
From: Lluís Batlle i Rossell @ 2013-10-01  9:30 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

On Tue, Oct 01, 2013 at 12:55:53PM +0400, Nikita Karetnikov wrote:
> > In fact I was reluctant to raise again the ext4 topic ;) But I think 3.5.3 has a
> > broken readdir() syscall in ext4. I think it's not a problem of kernel options
> > active. You simply have to avoid using ext4 (or even ext3, I can't recall).
> 
> In the past, I was using EXT3 with CONFIG_EXT4_USE_FOR_EXT23, and there
> were problems with OOM Killer.  That was fixed by switching to
> CONFIG_EXT3_FS.
> 
> I’ve recently tried to compile several versions of Linux-libre.  I used
> ‘/proc/config.gz’ but changed the mentioned options.  Whenever I tried,
> I was getting multiple warnings, “a variable is defined but is not used”
> or something like that.  I can’t remember the last time when I
> configured a kernel myself.  So I’m not sure whether such warnings are
> tolerable or not.

AH, ok. I have no idea. I also seem to recall that gNewSense had only o32
support, years ago. And not any n32/n64. Can it be?

I'd simply try to avoid ext4 or even ext3, without changing the kernel. I don't
know of linux-libre, but you need something newer than 3.7 I think, to get the
ext* fix.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01 10:06                                                     ` Nikita Karetnikov
@ 2013-10-01 10:04                                                       ` Lluís Batlle i Rossell
  2013-10-01 11:25                                                         ` Ludovic Courtès
  0 siblings, 1 reply; 132+ messages in thread
From: Lluís Batlle i Rossell @ 2013-10-01 10:04 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

On Tue, Oct 01, 2013 at 02:06:06PM +0400, Nikita Karetnikov wrote:
> > I also seem to recall that gNewSense had only o32 support, years
> > ago. And not any n32/n64. Can it be?
> 
> I think this is correct.
> 
> > I'd simply try to avoid ext4 or even ext3, without changing the kernel. I don't
> > know of linux-libre, but you need something newer than 3.7 I think, to get the
> > ext* fix.
> 
> OK, what do you recommend: Ext2 or something else?

In theory, anything should work. :)
I'd personally go for reiserfs or jfs.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01  9:30                                                   ` Lluís Batlle i Rossell
@ 2013-10-01 10:06                                                     ` Nikita Karetnikov
  2013-10-01 10:04                                                       ` Lluís Batlle i Rossell
  0 siblings, 1 reply; 132+ messages in thread
From: Nikita Karetnikov @ 2013-10-01 10:06 UTC (permalink / raw)
  To: Lluís Batlle i Rossell; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

> I also seem to recall that gNewSense had only o32 support, years
> ago. And not any n32/n64. Can it be?

I think this is correct.

> I'd simply try to avoid ext4 or even ext3, without changing the kernel. I don't
> know of linux-libre, but you need something newer than 3.7 I think, to get the
> ext* fix.

OK, what do you recommend: Ext2 or something else?

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01 10:04                                                       ` Lluís Batlle i Rossell
@ 2013-10-01 11:25                                                         ` Ludovic Courtès
  2013-10-01 11:56                                                           ` Lluís Batlle i Rossell
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-10-01 11:25 UTC (permalink / raw)
  To: Lluís Batlle i Rossell; +Cc: guix-devel

Lluís Batlle i Rossell <viric@viric.name> skribis:

> On Tue, Oct 01, 2013 at 02:06:06PM +0400, Nikita Karetnikov wrote:
>> > I also seem to recall that gNewSense had only o32 support, years
>> > ago. And not any n32/n64. Can it be?
>> 
>> I think this is correct.
>> 
>> > I'd simply try to avoid ext4 or even ext3, without changing the kernel. I don't
>> > know of linux-libre, but you need something newer than 3.7 I think, to get the
>> > ext* fix.
>> 
>> OK, what do you recommend: Ext2 or something else?
>
> In theory, anything should work. :)
> I'd personally go for reiserfs or jfs.

Lluís is an ext[234] skeptic, so take it with a grain of salt.  ;-)

More importantly: Lluís, is there a Linux configuration option to enable
n64 support?  How does that work?

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-01 11:25                                                         ` Ludovic Courtès
@ 2013-10-01 11:56                                                           ` Lluís Batlle i Rossell
  0 siblings, 0 replies; 132+ messages in thread
From: Lluís Batlle i Rossell @ 2013-10-01 11:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Tue, Oct 01, 2013 at 01:25:39PM +0200, Ludovic Courtès wrote:
> Lluís Batlle i Rossell <viric@viric.name> skribis:
> 
> > On Tue, Oct 01, 2013 at 02:06:06PM +0400, Nikita Karetnikov wrote:
> >> > I also seem to recall that gNewSense had only o32 support, years
> >> > ago. And not any n32/n64. Can it be?
> >> 
> >> I think this is correct.
> >> 
> >> > I'd simply try to avoid ext4 or even ext3, without changing the kernel. I don't
> >> > know of linux-libre, but you need something newer than 3.7 I think, to get the
> >> > ext* fix.
> >> 
> >> OK, what do you recommend: Ext2 or something else?
> >
> > In theory, anything should work. :)
> > I'd personally go for reiserfs or jfs.
> 
> Lluís is an ext[234] skeptic, so take it with a grain of salt.  ;-)

Hey, I pushed hard to get the fix of ext4 upstream. I even had a temporary patch
in nixpkgs to keep using ext4. :)

> More importantly: Lluís, is there a Linux configuration option to enable
> n64 support?  How does that work?

I think there is a simple option in the kernel to enable. I can't recall what it
is exactly.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-30 11:32                                     ` Nikita Karetnikov
  2013-09-30 16:26                                       ` Ludovic Courtès
@ 2013-10-07 18:47                                       ` Mark H Weaver
  2013-10-07 19:39                                         ` Ludovic Courtès
  2013-10-10  4:08                                       ` Mark H Weaver
  2 siblings, 1 reply; 132+ messages in thread
From: Mark H Weaver @ 2013-10-07 18:47 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> writes:

> OK, I fetched the tarballs.  Now I’m getting this error.
>
>
> $ ./pre-inst-env guix build -K hello
>
> [...]
>
> make-3.82/main.c
> make-3.82/README.OS2
> make-3.82/remote-cstms.c
> phase `unpack' succeeded after 4 seconds
> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
> starting phase `patch'
> applying patch `/nix/store/nf226injsfkw8ljjjfq1280jj530xbvv-make-impure-dirs.patch'
> patching file read.c
> Hunk #1 succeeded at 109 (offset 10 lines).
> patching file remake.c
> Hunk #1 succeeded at 1509 (offset 57 lines).
> phase `patch' succeeded after 0 seconds
> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
> starting phase `patch-source-shebangs'
> patch-shebang: ./config/mdate-sh: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/compile: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/config.guess: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/missing: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/mkinstalldirs: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/depcomp: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/config.rpath: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/install-sh: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./config/config.sub: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./tests/scripts/targets/SECONDARY: warning: no binary for interpreter `-*-perl-*-' found in $PATH
> patch-shebang: ./tests/run_make_tests.pl: warning: no binary for interpreter `perl' found in $PATH
> patch-shebang: ./tests/test_driver.pl: warning: no binary for interpreter `perl' found in $PATH
> patch-shebang: ./tests/run_make_tests: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./tests/mkshadow: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./build.sh.in: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> patch-shebang: ./configure: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
> phase `patch-source-shebangs' succeeded after 1 seconds
> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
> starting phase `configure'
> source directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82" (relative from build: ".")
> build directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82"
> configure flags: ("CONFIG_SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" "SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" "--prefix=/nix/store/4ksc0dgml5158lrz3047bxn0ignw1943-make-boot0-3.82" "--enable-fast-install")
> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
> configure: WARNING: unrecognized options: --enable-fast-install
> pwd: error retrieving current directory: getcwd: cannot access parent directories: Success
> pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address
> configure: error: working directory cannot be determined
> phase `configure' failed after 0 seconds
[...]

I've run into the same problem, using bootstrap binaries I cross-built
myself based on my "wip-loongson" branch.

I can run the cross-build bootstrap binaries outside of guix-builder,
and they seem to work fine.  I've tested 'bash' and 'guile', among other
things.  The "shell-init" problem seems to be specific to the
environment within guix-builder.

I'm at a bit of a loss of how best to debug problems that only happen
within guix-builder.  Any suggestions?

     Mark

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-07 18:47                                       ` Mark H Weaver
@ 2013-10-07 19:39                                         ` Ludovic Courtès
  2013-10-08 23:03                                           ` Mark H Weaver
  0 siblings, 1 reply; 132+ messages in thread
From: Ludovic Courtès @ 2013-10-07 19:39 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> Nikita Karetnikov <nikita@karetnikov.org> writes:
>
>> OK, I fetched the tarballs.  Now I’m getting this error.
>>
>>
>> $ ./pre-inst-env guix build -K hello
>>
>> [...]
>>
>> make-3.82/main.c
>> make-3.82/README.OS2
>> make-3.82/remote-cstms.c
>> phase `unpack' succeeded after 4 seconds
>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>> starting phase `patch'
>> applying patch `/nix/store/nf226injsfkw8ljjjfq1280jj530xbvv-make-impure-dirs.patch'
>> patching file read.c
>> Hunk #1 succeeded at 109 (offset 10 lines).
>> patching file remake.c
>> Hunk #1 succeeded at 1509 (offset 57 lines).
>> phase `patch' succeeded after 0 seconds
>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>> starting phase `patch-source-shebangs'
>> patch-shebang: ./config/mdate-sh: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/compile: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/config.guess: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/missing: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/mkinstalldirs: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/depcomp: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/config.rpath: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/install-sh: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./config/config.sub: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./tests/scripts/targets/SECONDARY: warning: no binary for interpreter `-*-perl-*-' found in $PATH
>> patch-shebang: ./tests/run_make_tests.pl: warning: no binary for interpreter `perl' found in $PATH
>> patch-shebang: ./tests/test_driver.pl: warning: no binary for interpreter `perl' found in $PATH
>> patch-shebang: ./tests/run_make_tests: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./tests/mkshadow: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./build.sh.in: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> patch-shebang: ./configure: changing `/bin/sh' to `/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>> phase `patch-source-shebangs' succeeded after 1 seconds
>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>> starting phase `configure'
>> source directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82" (relative from build: ".")
>> build directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82"
>> configure flags: ("CONFIG_SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" "SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash" "--prefix=/nix/store/4ksc0dgml5158lrz3047bxn0ignw1943-make-boot0-3.82" "--enable-fast-install")
>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>> configure: WARNING: unrecognized options: --enable-fast-install
>> pwd: error retrieving current directory: getcwd: cannot access parent directories: Success
>> pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address
>> configure: error: working directory cannot be determined
>> phase `configure' failed after 0 seconds
> [...]
>
> I've run into the same problem, using bootstrap binaries I cross-built
> myself based on my "wip-loongson" branch.
>
> I can run the cross-build bootstrap binaries outside of guix-builder,
> and they seem to work fine.  I've tested 'bash' and 'guile', among other
> things.  The "shell-init" problem seems to be specific to the
> environment within guix-builder.

Good, that’s consistent.  :-)

> I'm at a bit of a loss of how best to debug problems that only happen
> within guix-builder.  Any suggestions?

Bruce force:

  strace -f -p $(pidof guix-daemon) -o log &
  guix build -e '(@@ (gnu packages base) gnu-make-boot0)'
  grep -E '(ENOTTY|getcwd)' log

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-07 19:39                                         ` Ludovic Courtès
@ 2013-10-08 23:03                                           ` Mark H Weaver
  2013-10-09  6:53                                             ` Mark H Weaver
  2013-10-09 10:39                                             ` Ludovic Courtès
  0 siblings, 2 replies; 132+ messages in thread
From: Mark H Weaver @ 2013-10-08 23:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 8042 bytes --]

ludo@gnu.org (Ludovic Courtès) writes:

> Mark H Weaver <mhw@netris.org> skribis:
>
>> Nikita Karetnikov <nikita@karetnikov.org> writes:
>>
>>> OK, I fetched the tarballs.  Now I’m getting this error.
>>>
>>>
>>> $ ./pre-inst-env guix build -K hello
>>>
>>> [...]
>>>
>>> make-3.82/main.c
>>> make-3.82/README.OS2
>>> make-3.82/remote-cstms.c
>>> phase `unpack' succeeded after 4 seconds
>>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>>> starting phase `patch'
>>> applying patch `/nix/store/nf226injsfkw8ljjjfq1280jj530xbvv-make-impure-dirs.patch'
>>> patching file read.c
>>> Hunk #1 succeeded at 109 (offset 10 lines).
>>> patching file remake.c
>>> Hunk #1 succeeded at 1509 (offset 57 lines).
>>> phase `patch' succeeded after 0 seconds
>>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>>> starting phase `patch-source-shebangs'
>>> patch-shebang: ./config/mdate-sh: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/compile: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/config.guess: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/missing: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/mkinstalldirs: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/depcomp: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/config.rpath: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/install-sh: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./config/config.sub: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./tests/scripts/targets/SECONDARY: warning: no binary for interpreter `-*-perl-*-' found in $PATH
>>> patch-shebang: ./tests/run_make_tests.pl: warning: no binary for interpreter `perl' found in $PATH
>>> patch-shebang: ./tests/test_driver.pl: warning: no binary for interpreter `perl' found in $PATH
>>> patch-shebang: ./tests/run_make_tests: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./tests/mkshadow: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./build.sh.in: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> patch-shebang: ./configure: changing `/bin/sh' to
>>> /nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/sh'
>>> phase `patch-source-shebangs' succeeded after 1 seconds
>>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>>> starting phase `configure'
>>> source directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82" (relative from build: ".")
>>> build directory: "/tmp/nix-build-make-boot0-3.82.drv-2/make-3.82"
>>> configure flags:
>>> ("CONFIG_SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash"
>>> "SHELL=/nix/store/3q8kihrw6zg9v2c364c0kdgz2nfmkwnf-bootstrap-binaries-0/bin/bash"
>>> "--prefix=/nix/store/4ksc0dgml5158lrz3047bxn0ignw1943-make-boot0-3.82"
>>> "--enable-fast-install")
>>> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
>>> configure: WARNING: unrecognized options: --enable-fast-install
>>> pwd: error retrieving current directory: getcwd: cannot access parent directories: Success
>>> pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address
>>> configure: error: working directory cannot be determined
>>> phase `configure' failed after 0 seconds
>> [...]
>>
>> I've run into the same problem, using bootstrap binaries I cross-built
>> myself based on my "wip-loongson" branch.
>>
>> I can run the cross-build bootstrap binaries outside of guix-builder,
>> and they seem to work fine.  I've tested 'bash' and 'guile', among other
>> things.  The "shell-init" problem seems to be specific to the
>> environment within guix-builder.
>
> Good, that’s consistent.  :-)
>
>> I'm at a bit of a loss of how best to debug problems that only happen
>> within guix-builder.  Any suggestions?
>
> Bruce force:
>
>   strace -f -p $(pidof guix-daemon) -o log &
>   guix build -e '(@@ (gnu packages base) gnu-make-boot0)'
>   grep -E '(ENOTTY|getcwd)' log

Thanks.  Since 'strace' doesn't support MIPS N64 well, and also because
I think N32 is a more desirable target for now, I started bootstrapping
for MIPS N32, and ran this test again.  Same problem.

Using 'strace', I determined that 'pwd' is failing because the inode
numbers reported by 'stat' and 'getdents64' are inconsistent.

'pwd' works (roughly) as follows: it uses 'stat' to determine the inode
number of the current directory, and then reads the parent directory
looking for the entry whose inode matches the inode of the current
directory.  It repeats this process until it reaches the root node.

In this case, because the inode numbers are inconsistent, it fails to
find an entry in the parent directory whose inode matches.

I've looked at the inode numbers in binary and hex, and they're not
getting munged in any simple way that's immediately obvious to me.

See below for details.  Any ideas?

      Mark


Here are the inode numbers as reported by ls -lia:

--8<---------------cut here---------------start------------->8---
mhw:/tmp$ ls -lia nix-build-make-boot0-3.82.drv-0/
total 16
7274550 drwxr-xr-x 3 guix-builder1 guix-builder 4096 Oct  8 17:19 .
7072375 drwxrwxrwt 9 root          root         4096 Oct  8 17:19 ..
7272956 -rw-r--r-- 1 guix-builder1 guix-builder 1141 Oct  8 17:19 environment-variables
7274551 drwxr-xr-x 8 guix-builder1 guix-builder 4096 Oct  8 17:19 make-3.82
--8<---------------cut here---------------end--------------->8---

Here's a summary of what the 'strace' output tells me:

* The initial stat(".") syscall reports inode 7274551, which corresponds
  to "/tmp/nix-build-make-boot0-3.82.drv-0/make-3.82", as expected.

* stat("/") reports inode 1073173, which looks WRONG.

* stat("..") reports inode 7274550, which corresponds to
  "/tmp/nix-build-make-boot0-3.82.drv-0", as expected.

* reading the contents of ".." reports inode numbers that all look
  correct, including "make-3.82" with inode 7274551, the same as ".".
  Thus 'pwd' concludes that its result will end with "/make-3.82".

* stat("../..") reports inode 1073174, which looks WRONG.

* reading the contents of "../.." reports inode numbers that all look
  WRONG:

   "nix-build-make-boot0-3.82.drv-0" with inode 1073325
   ".." with inode 1073173
   "." with inode 1073174

  None of these match the inode of "..", so 'pwd' fails.

Note that the inode for ".." matches the inode returned by stat("/").

Also note that there are two inode numbers reported for
/tmp/nix-build-make-boot0-3.82.drv-0:

      7274550 (0x6F0036)
  and 1073325 (0x1060AD)

My suspicion is that my kernel (linux-libre-2.6.39.1) and Guix's glibc
are not playing nicely together.  However, Guix's glibc was configured
to support kernels as early as 2.6.30, and the same 'pwd' executable
that fails within 'guix-daemon' seems to work outside of it, even when
run within a chroot.

  Any ideas?
     Mark


[-- Attachment #2: guix build output --]
[-- Type: text/plain, Size: 15837 bytes --]

mhw:~/guix$ ./pre-inst-env guix build -K -e '(@@ (gnu packages base) gnu-make-boot0)'
The following derivation will be built:
   /nix/store/781gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv
@ build-started /nix/store/781gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv - mips64el-linux /usr/var/log/nix/drvs/78//1gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv.bz2
starting phase `set-paths'
environment variable `PATH' set to `/nix/store/r9yjx8jqy7kddwwxhf55vhr7vyasslib-gcc-bootstrap-0/bin:/nix/store/y89p6q0b8g6hkr51kwzgz4lk4h71f9bh-binutils-bootstrap-0/bin:/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin:/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin'
environment variable `CPATH' set to `/nix/store/2w4mry5mgnms92zimivhi82bb38mba3a-glibc-bootstrap-0/include'
environment variable `LIBRARY_PATH' set to `/nix/store/2w4mry5mgnms92zimivhi82bb38mba3a-glibc-bootstrap-0/lib:/nix/store/r9yjx8jqy7kddwwxhf55vhr7vyasslib-gcc-bootstrap-0/lib'
phase `set-paths' succeeded after 1 seconds
starting phase `unpack'
make-3.82/
make-3.82/vmsfunctions.c
make-3.82/getopt.h
make-3.82/make.1
make-3.82/job.c
make-3.82/COPYING
make-3.82/readme.vms
make-3.82/remake.c
make-3.82/commands.h
make-3.82/README
make-3.82/rule.c
make-3.82/config.ami
make-3.82/misc.c
make-3.82/gettext.h
make-3.82/config.h.W32
make-3.82/Makefile.DOS
make-3.82/build_w32.bat
make-3.82/make.lnk
make-3.82/vmsify.c
make-3.82/glob/
make-3.82/glob/glob.h
make-3.82/glob/COPYING.LIB
make-3.82/glob/fnmatch.h
make-3.82/glob/fnmatch.c
make-3.82/glob/SCOPTIONS
make-3.82/glob/Makefile.am
make-3.82/glob/SMakefile
make-3.82/glob/configure.bat
make-3.82/glob/Makefile.ami
make-3.82/glob/Makefile.in
make-3.82/glob/glob.c
make-3.82/glob/ChangeLog
make-3.82/subproc.bat
make-3.82/README.W32
make-3.82/getopt.c
make-3.82/read.c
make-3.82/configure.in
make-3.82/debug.h
make-3.82/amiga.c
make-3.82/version.c
make-3.82/dir.c
make-3.82/make_msvc_net2003.sln
make-3.82/hash.c
make-3.82/w32/
make-3.82/w32/Makefile
make-3.82/w32/pathstuff.c
make-3.82/w32/include/
make-3.82/w32/include/dirent.h
make-3.82/w32/include/w32err.h
make-3.82/w32/include/pathstuff.h
make-3.82/w32/include/sub_proc.h
make-3.82/w32/Makefile.am
make-3.82/w32/compat/
make-3.82/w32/compat/dirent.c
make-3.82/w32/.deps/
make-3.82/w32/.deps/libw32_a-pathstuff.Po
make-3.82/w32/.deps/libw32_a-w32err.Po
make-3.82/w32/.deps/libw32_a-sub_proc.Po
make-3.82/w32/.deps/libw32_a-misc.Po
make-3.82/w32/Makefile.in
make-3.82/w32/subproc/
make-3.82/w32/subproc/w32err.c
make-3.82/w32/subproc/misc.c
make-3.82/w32/subproc/NMakefile
make-3.82/w32/subproc/proc.h
make-3.82/w32/subproc/sub_proc.c
make-3.82/w32/subproc/build.bat
make-3.82/dep.h
make-3.82/file.c
make-3.82/job.h
make-3.82/NMakefile
make-3.82/variable.h
make-3.82/expand.c
make-3.82/dosbuild.bat
make-3.82/amiga.h
make-3.82/filedef.h
make-3.82/make_msvc_net2003.vcproj
make-3.82/configh.dos
make-3.82/strcache.c
make-3.82/doc/
make-3.82/doc/make.info
make-3.82/doc/make.info-1
make-3.82/doc/stamp-vti
make-3.82/doc/make.info-2
make-3.82/doc/fdl.texi
make-3.82/doc/Makefile.am
make-3.82/doc/version.texi
make-3.82/doc/make-stds.texi
make-3.82/doc/Makefile.in
make-3.82/doc/make.texi
make-3.82/signame.c
make-3.82/make.h
make-3.82/function.c
make-3.82/variable.c
make-3.82/ABOUT-NLS
make-3.82/INSTALL
make-3.82/makefile.vms
make-3.82/config/
make-3.82/config/stdint_h.m4
make-3.82/config/install-sh
make-3.82/config/wchar_t.m4
make-3.82/config/lib-prefix.m4
make-3.82/config/lib-ld.m4
make-3.82/config/texinfo.tex
make-3.82/config/inttypes-pri.m4
make-3.82/config/mdate-sh
make-3.82/config/mkinstalldirs
make-3.82/config/isc-posix.m4
make-3.82/config/gettext.m4
make-3.82/config/size_max.m4
make-3.82/config/intdiv0.m4
make-3.82/config/lcmessage.m4
make-3.82/config/compile
make-3.82/config/dospaths.m4
make-3.82/config/codeset.m4
make-3.82/config/printf-posix.m4
make-3.82/config/config.rpath
make-3.82/config/inttypes_h.m4
make-3.82/config/ulonglong.m4
make-3.82/config/iconv.m4
make-3.82/config/signed.m4
make-3.82/config/inttypes.m4
make-3.82/config/lib-link.m4
make-3.82/config/longdouble.m4
make-3.82/config/depcomp
make-3.82/config/xsize.m4
make-3.82/config/progtest.m4
make-3.82/config/Makefile.am
make-3.82/config/longlong.m4
make-3.82/config/po.m4
make-3.82/config/uintmax_t.m4
make-3.82/config/intmax.m4
make-3.82/config/Makefile.in
make-3.82/config/config.sub
make-3.82/config/glibc21.m4
make-3.82/config/nls.m4
make-3.82/config/ChangeLog
make-3.82/config/config.guess
make-3.82/config/wint_t.m4
make-3.82/config/missing
make-3.82/SCOPTIONS
make-3.82/alloca.c
make-3.82/makefile.com
make-3.82/configure
make-3.82/hash.h
make-3.82/acinclude.m4
make-3.82/arscan.c
make-3.82/rule.h
make-3.82/NEWS
make-3.82/Makefile.am
make-3.82/po/
make-3.82/po/gl.gmo
make-3.82/po/en@quot.header
make-3.82/po/stamp-po
make-3.82/po/nl.gmo
make-3.82/po/id.po
make-3.82/po/it.po
make-3.82/po/pl.po
make-3.82/po/es.po
make-3.82/po/LINGUAS
make-3.82/po/Makevars
make-3.82/po/sv.po
make-3.82/po/he.gmo
make-3.82/po/sv.gmo
make-3.82/po/ja.gmo
make-3.82/po/ru.po
make-3.82/po/ko.gmo
make-3.82/po/ko.po
make-3.82/po/ja.po
make-3.82/po/Makefile.in.in
make-3.82/po/de.gmo
make-3.82/po/es.gmo
make-3.82/po/be.po
make-3.82/po/pt_BR.po
make-3.82/po/be.gmo
make-3.82/po/vi.po
make-3.82/po/it.gmo
make-3.82/po/uk.po
make-3.82/po/tr.po
make-3.82/po/hr.gmo
make-3.82/po/POTFILES.in
make-3.82/po/fr.po
make-3.82/po/da.gmo
make-3.82/po/tr.gmo
make-3.82/po/he.po
make-3.82/po/nl.po
make-3.82/po/make.pot
make-3.82/po/vi.gmo
make-3.82/po/zh_CN.gmo
make-3.82/po/fi.po
make-3.82/po/ga.gmo
make-3.82/po/insert-header.sin
make-3.82/po/remove-potcdate.sin
make-3.82/po/quot.sed
make-3.82/po/fi.gmo
make-3.82/po/hr.po
make-3.82/po/id.gmo
make-3.82/po/ru.gmo
make-3.82/po/fr.gmo
make-3.82/po/lt.po
make-3.82/po/en@boldquot.header
make-3.82/po/pt_BR.gmo
make-3.82/po/Rules-quot
make-3.82/po/de.po
make-3.82/po/boldquot.sed
make-3.82/po/lt.gmo
make-3.82/po/da.po
make-3.82/po/ga.po
make-3.82/po/uk.gmo
make-3.82/po/gl.po
make-3.82/po/pl.gmo
make-3.82/po/ChangeLog
make-3.82/po/zh_CN.po
make-3.82/README.customs
make-3.82/commands.c
make-3.82/vpath.c
make-3.82/remote-stub.c
make-3.82/SMakefile
make-3.82/tests/
make-3.82/tests/COPYING
make-3.82/tests/README
make-3.82/tests/mkshadow
make-3.82/tests/test_driver.pl
make-3.82/tests/run_make_tests.pl
make-3.82/tests/NEWS
make-3.82/tests/scripts/
make-3.82/tests/scripts/misc/
make-3.82/tests/scripts/misc/general1
make-3.82/tests/scripts/misc/general3
make-3.82/tests/scripts/misc/close_stdout
make-3.82/tests/scripts/misc/general2
make-3.82/tests/scripts/misc/general4
make-3.82/tests/scripts/variables/
make-3.82/tests/scripts/variables/undefine
make-3.82/tests/scripts/variables/CURDIR
make-3.82/tests/scripts/variables/MAKEFILES
make-3.82/tests/scripts/variables/flavors
make-3.82/tests/scripts/variables/LIBPATTERNS
make-3.82/tests/scripts/variables/INCLUDE_DIRS
make-3.82/tests/scripts/variables/MFILE_LIST
make-3.82/tests/scripts/variables/define
make-3.82/tests/scripts/variables/negative
make-3.82/tests/scripts/variables/MAKELEVEL
make-3.82/tests/scripts/variables/private
make-3.82/tests/scripts/variables/DEFAULT_GOAL
make-3.82/tests/scripts/variables/automatic
make-3.82/tests/scripts/variables/MAKE_RESTARTS
make-3.82/tests/scripts/variables/MAKEFLAGS
make-3.82/tests/scripts/variables/MAKE
make-3.82/tests/scripts/variables/special
make-3.82/tests/scripts/variables/SHELL
make-3.82/tests/scripts/variables/MAKECMDGOALS
make-3.82/tests/scripts/functions/
make-3.82/tests/scripts/functions/if
make-3.82/tests/scripts/functions/dir
make-3.82/tests/scripts/functions/addsuffix
make-3.82/tests/scripts/functions/error
make-3.82/tests/scripts/functions/foreach
make-3.82/tests/scripts/functions/wildcard
make-3.82/tests/scripts/functions/andor
make-3.82/tests/scripts/functions/findstring
make-3.82/tests/scripts/functions/join
make-3.82/tests/scripts/functions/call
make-3.82/tests/scripts/functions/basename
make-3.82/tests/scripts/functions/shell
make-3.82/tests/scripts/functions/filter-out
make-3.82/tests/scripts/functions/addprefix
make-3.82/tests/scripts/functions/sort
make-3.82/tests/scripts/functions/abspath
make-3.82/tests/scripts/functions/origin
make-3.82/tests/scripts/functions/word
make-3.82/tests/scripts/functions/notdir
make-3.82/tests/scripts/functions/flavor
make-3.82/tests/scripts/functions/warning
make-3.82/tests/scripts/functions/eval
make-3.82/tests/scripts/functions/realpath
make-3.82/tests/scripts/functions/substitution
make-3.82/tests/scripts/functions/value
make-3.82/tests/scripts/functions/suffix
make-3.82/tests/scripts/functions/strip
make-3.82/tests/scripts/targets/
make-3.82/tests/scripts/targets/FORCE
make-3.82/tests/scripts/targets/INTERMEDIATE
make-3.82/tests/scripts/targets/PHONY
make-3.82/tests/scripts/targets/DEFAULT
make-3.82/tests/scripts/targets/ONESHELL
make-3.82/tests/scripts/targets/POSIX
make-3.82/tests/scripts/targets/SECONDARY
make-3.82/tests/scripts/targets/SILENT
make-3.82/tests/scripts/targets/clean
make-3.82/tests/scripts/options/
make-3.82/tests/scripts/options/dash-e
make-3.82/tests/scripts/options/dash-f
make-3.82/tests/scripts/options/warn-undefined-variables
make-3.82/tests/scripts/options/dash-q
make-3.82/tests/scripts/options/dash-C
make-3.82/tests/scripts/options/dash-B
make-3.82/tests/scripts/options/dash-I
make-3.82/tests/scripts/options/symlinks
make-3.82/tests/scripts/options/dash-k
make-3.82/tests/scripts/options/eval
make-3.82/tests/scripts/options/dash-l
make-3.82/tests/scripts/options/dash-t
make-3.82/tests/scripts/options/dash-W
make-3.82/tests/scripts/options/dash-n
make-3.82/tests/scripts/options/general
make-3.82/tests/scripts/features/
make-3.82/tests/scripts/features/echoing
make-3.82/tests/scripts/features/mult_rules
make-3.82/tests/scripts/features/patternrules
make-3.82/tests/scripts/features/comments
make-3.82/tests/scripts/features/se_implicit
make-3.82/tests/scripts/features/escape
make-3.82/tests/scripts/features/order_only
make-3.82/tests/scripts/features/vpath3
make-3.82/tests/scripts/features/statipattrules
make-3.82/tests/scripts/features/vpathplus
make-3.82/tests/scripts/features/vpath
make-3.82/tests/scripts/features/quoting
make-3.82/tests/scripts/features/varnesting
make-3.82/tests/scripts/features/override
make-3.82/tests/scripts/features/include
make-3.82/tests/scripts/features/export
make-3.82/tests/scripts/features/recursion
make-3.82/tests/scripts/features/patspecific_vars
make-3.82/tests/scripts/features/default_names
make-3.82/tests/scripts/features/mult_targets
make-3.82/tests/scripts/features/vpath2
make-3.82/tests/scripts/features/reinvoke
make-3.82/tests/scripts/features/conditionals
make-3.82/tests/scripts/features/se_explicit
make-3.82/tests/scripts/features/se_statpat
make-3.82/tests/scripts/features/double_colon
make-3.82/tests/scripts/features/errors
make-3.82/tests/scripts/features/parallelism
make-3.82/tests/scripts/features/vpathgpath
make-3.82/tests/scripts/features/targetvars
make-3.82/tests/scripts/test_template
make-3.82/tests/run_make_tests
make-3.82/tests/ChangeLog
make-3.82/configure.bat
make-3.82/ar.c
make-3.82/Makefile.ami
make-3.82/config.h.in
make-3.82/config.h-vms
make-3.82/aclocal.m4
make-3.82/README.Amiga
make-3.82/getloadavg.c
make-3.82/build.sh.in
make-3.82/implicit.c
make-3.82/vmsjobs.c
make-3.82/Makefile.in
make-3.82/getopt1.c
make-3.82/README.DOS
make-3.82/vmsdir.h
make-3.82/ChangeLog
make-3.82/AUTHORS
make-3.82/default.c
make-3.82/main.c
make-3.82/README.OS2
make-3.82/remote-cstms.c
phase `unpack' succeeded after 5 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
starting phase `patch'
applying patch `/nix/store/nf226injsfkw8ljjjfq1280jj530xbvv-make-impure-dirs.patch'
patching file read.c
Hunk #1 succeeded at 109 (offset 10 lines).
patching file remake.c
Hunk #1 succeeded at 1509 (offset 57 lines).
phase `patch' succeeded after 0 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
starting phase `patch-source-shebangs'
patch-shebang: ./build.sh.in: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/compile: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/config.guess: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/config.rpath: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/config.sub: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/depcomp: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/install-sh: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/mdate-sh: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/missing: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./config/mkinstalldirs: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./configure: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./tests/mkshadow: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./tests/run_make_tests: changing `/bin/sh' to `/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/sh'
patch-shebang: ./tests/run_make_tests.pl: warning: no binary for interpreter `perl' found in $PATH
patch-shebang: ./tests/scripts/targets/SECONDARY: warning: no binary for interpreter `-*-perl-*-' found in $PATH
patch-shebang: ./tests/test_driver.pl: warning: no binary for interpreter `perl' found in $PATH
phase `patch-source-shebangs' succeeded after 1 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
starting phase `configure'
source directory: "/tmp/nix-build-make-boot0-3.82.drv-0/make-3.82" (relative from build: ".")
build directory: "/tmp/nix-build-make-boot0-3.82.drv-0/make-3.82"
configure flags: ("CONFIG_SHELL=/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/bash" "SHELL=/nix/store/i1fls9ylxvx1f4lnd9hph90v50v24id3-bootstrap-binaries-0/bin/bash" "--prefix=/nix/store/m3p9ikv278gcim9is5mpw39nzdsva4qz-make-boot0-3.82" "--enable-fast-install")
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
configure: WARNING: unrecognized options: --enable-fast-install
pwd: error retrieving current directory: getcwd: cannot access parent directories: Success
pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address
configure: error: working directory cannot be determined
phase `configure' failed after 2 seconds
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Inappropriate ioctl for device
note: keeping build directory `/tmp/nix-build-make-boot0-3.82.drv-0'
builder for `/nix/store/781gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv' failed with exit code 1
@ build-failed /nix/store/781gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv - 1 builder for `/nix/store/781gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv' failed with exit code 1
guix build: error: build failed: build of `/nix/store/781gad2ab772cygwaaby71i0bx0hshsm-make-boot0-3.82.drv' failed
mhw:~/guix$ 

[-- Attachment #3: strace output of the 'pwd' command --]
[-- Type: text/plain, Size: 6360 bytes --]

26444 close(255)                        = 0
26444 rt_sigprocmask(SIG_SETMASK, [], NULL, 16) = 0
26444 rt_sigaction(SIGTSTP, {SIG_DFL, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], 0}, {SIG_DFL, [], 0}, 16) = 0
26444 rt_sigaction(SIGTTIN, {SIG_DFL, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], 0}, {SIG_DFL, [], 0}, 16) = 0
26444 rt_sigaction(SIGTTOU, {SIG_DFL, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], 0}, {SIG_DFL, [], 0}, 16) = 0
26444 rt_sigaction(SIGINT, {SIG_DFL, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], SA_NOCLDSTOP}, {SIG_DFL, [], SA_NOCLDSTOP}, 16) = 0
26444 rt_sigaction(SIGQUIT, {SIG_DFL, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], SA_NOCLDSTOP}, {SIG_DFL, [], SA_NOCLDSTOP}, 16) = 0
26444 rt_sigaction(SIGCHLD, {0x10000000, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], 0}, {0x10000000, [], SA_RESTART|SA_SIGINFO|0x2e3b0}, 16) = 0
26444 rt_sigaction(SIGCHLD, {0x10000000, [RT_69 RT_70 RT_71 RT_73 RT_74 RT_76 RT_77 RT_78 RT_84 RT_93], SA_RESTART|SA_SIGINFO|0x2e3b0}, {0x10000000, [], 0}, 16) = 0
26444 dup2(4, 1)                        = 1
26444 close(4)                          = 0
26444 close(3)                          = 0
26444 stat(".", {st_dev=makedev(8, 5), st_ino=7274551, st_mode=S_IFDIR|0755, st_nlink=8, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:59, st_ctime=2013/10/08-17:19:59}) = 0
26444 stat("/", {st_dev=makedev(8, 5), st_ino=1073173, st_mode=S_IFDIR|0755, st_nlink=7, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:49, st_mtime=2013/10/08-17:19:49, st_ctime=2013/10/08-17:19:49}) = 0
26444 stat("..", {st_dev=makedev(8, 5), st_ino=7274550, st_mode=S_IFDIR|0700, st_nlink=3, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:55, st_mtime=2013/10/08-17:19:50, st_ctime=2013/10/08-17:19:50}) = 0
26444 openat(AT_FDCWD, "..", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
26444 brk(0x101a4000)                   = 0x101a4000
26444 getdents64(3, {{d_ino=7072375, d_off=800767772, d_type=DT_DIR, d_reclen=24, d_name=".."} {d_ino=7272956, d_off=822117209, d_type=DT_REG, d_reclen=48, d_name="environment-variables"} {d_ino=7274550, d_off=1489961354, d_type=DT_DIR, d_reclen=24, d_name="."} {d_ino=7274551, d_off=2147483647, d_type=DT_DIR, d_reclen=32, d_name="make-3.82"}}, 32768) = 128
26444 lstat("../make-3.82", {st_dev=makedev(8, 5), st_ino=7274551, st_mode=S_IFDIR|0755, st_nlink=8, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:59, st_ctime=2013/10/08-17:19:59}) = 0
26444 brk(0x1019c000)                   = 0x1019c000
26444 close(3)                          = 0
26444 stat("../..", {st_dev=makedev(8, 5), st_ino=1073174, st_mode=S_IFDIR|S_ISVTX|0777, st_nlink=3, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:49, st_ctime=2013/10/08-17:19:49}) = 0
26444 openat(AT_FDCWD, "../..", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
26444 getdents64(3, {{d_ino=1073325, d_off=786063326, d_type=DT_DIR, d_reclen=56, d_name="nix-build-make-boot0-3.82.drv-0"} {d_ino=1073173, d_off=822117209, d_type=DT_DIR, d_reclen=24, d_name=".."} {d_ino=1073174, d_off=2147483647, d_type=DT_DIR, d_reclen=24, d_name="."}}, 32768) = 104
26444 getdents64(3, {}, 32768)          = 0
26444 close(3)                          = 0
26444 write(2, "pwd: error retrieving current di"..., 91) = 91
26444 stat(".", {st_dev=makedev(8, 5), st_ino=7274551, st_mode=S_IFDIR|0755, st_nlink=8, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:59, st_ctime=2013/10/08-17:19:59}) = 0
26444 stat(NULL, 0x7fcca9b0)            = -1 EFAULT (Bad address)
26444 stat(".", {st_dev=makedev(8, 5), st_ino=7274551, st_mode=S_IFDIR|0755, st_nlink=8, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:59, st_ctime=2013/10/08-17:19:59}) = 0
26444 stat("/", {st_dev=makedev(8, 5), st_ino=1073173, st_mode=S_IFDIR|0755, st_nlink=7, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:49, st_mtime=2013/10/08-17:19:49, st_ctime=2013/10/08-17:19:49}) = 0
26444 stat("..", {st_dev=makedev(8, 5), st_ino=7274550, st_mode=S_IFDIR|0700, st_nlink=3, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:55, st_mtime=2013/10/08-17:19:50, st_ctime=2013/10/08-17:19:50}) = 0
26444 openat(AT_FDCWD, "..", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
26444 getdents64(3, {{d_ino=7072375, d_off=800767772, d_type=DT_DIR, d_reclen=24, d_name=".."} {d_ino=7272956, d_off=822117209, d_type=DT_REG, d_reclen=48, d_name="environment-variables"} {d_ino=7274550, d_off=1489961354, d_type=DT_DIR, d_reclen=24, d_name="."} {d_ino=7274551, d_off=2147483647, d_type=DT_DIR, d_reclen=32, d_name="make-3.82"}}, 32768) = 128
26444 lstat("../make-3.82", {st_dev=makedev(8, 5), st_ino=7274551, st_mode=S_IFDIR|0755, st_nlink=8, st_uid=1001, st_gid=1002, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:59, st_ctime=2013/10/08-17:19:59}) = 0
26444 close(3)                          = 0
26444 stat("../..", {st_dev=makedev(8, 5), st_ino=1073174, st_mode=S_IFDIR|S_ISVTX|0777, st_nlink=3, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=4096, st_atime=2013/10/08-17:19:56, st_mtime=2013/10/08-17:19:49, st_ctime=2013/10/08-17:19:49}) = 0
26444 openat(AT_FDCWD, "../..", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
26444 getdents64(3, {{d_ino=1073325, d_off=786063326, d_type=DT_DIR, d_reclen=56, d_name="nix-build-make-boot0-3.82.drv-0"} {d_ino=1073173, d_off=822117209, d_type=DT_DIR, d_reclen=24, d_name=".."} {d_ino=1073174, d_off=2147483647, d_type=DT_DIR, d_reclen=24, d_name="."}}, 32768) = 104
26444 getdents64(3, {}, 32768)          = 0
26444 close(3)                          = 0
26444 write(2, "pwd: error retrieving current di"..., 95) = 95
26444 exit_group(1)                     = ?
26444 +++ exited with 1 +++

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-08 23:03                                           ` Mark H Weaver
@ 2013-10-09  6:53                                             ` Mark H Weaver
  2013-10-09 10:42                                               ` Ludovic Courtès
  2013-10-09 10:39                                             ` Ludovic Courtès
  1 sibling, 1 reply; 132+ messages in thread
From: Mark H Weaver @ 2013-10-09  6:53 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

I wrote:
> Here are the inode numbers as reported by ls -lia:
>
> mhw:/tmp$ ls -lia nix-build-make-boot0-3.82.drv-0/
> total 16
> 7274550 drwxr-xr-x 3 guix-builder1 guix-builder 4096 Oct  8 17:19 .
> 7072375 drwxrwxrwt 9 root          root         4096 Oct  8 17:19 ..
> 7272956 -rw-r--r-- 1 guix-builder1 guix-builder 1141 Oct  8 17:19 environment-variables
> 7274551 drwxr-xr-x 8 guix-builder1 guix-builder 4096 Oct  8 17:19 make-3.82
>
> Here's a summary of what the 'strace' output tells me:
>
> * The initial stat(".") syscall reports inode 7274551, which corresponds
>   to "/tmp/nix-build-make-boot0-3.82.drv-0/make-3.82", as expected.
>
> * stat("/") reports inode 1073173, which looks WRONG.

Actually, this turned out to be correct.

> * stat("..") reports inode 7274550, which corresponds to
>   "/tmp/nix-build-make-boot0-3.82.drv-0", as expected.
>
> * reading the contents of ".." reports inode numbers that all look
>   correct, including "make-3.82" with inode 7274551, the same as ".".
>   Thus 'pwd' concludes that its result will end with "/make-3.82".
>
> * stat("../..") reports inode 1073174, which looks WRONG.

This is also correct.

> * reading the contents of "../.." reports inode numbers that all look
>   WRONG:
>
>    "nix-build-make-boot0-3.82.drv-0" with inode 1073325

This is the entry that reports the wrong inode number.  Note that this
is a bind mount that mirrors /tmp/nix-build-make-boot0-3.82.drv-0 .

I guess that <CHROOT>/tmp/nix-build-make-boot0-3.82.drv-0 should have
the same inode as <CHROOT>/tmp/nix-build-make-boot0-3.82.drv-0/. , but
apparently that is not the case from within guix-daemon, even though it
_is_ the case when I set up the chroot manually using "mount --bind".

One notable difference between the chroot I set up is that the bind
mounts I created were part of the global namespace, whereas guix-daemon
restricts the bind mounts to a private namespace.

My initial hypothesis is that this is a namespace-related bug in Linux
(the kernel).  In case it has already been fixed, I will first work on
upgrading Linux to 3.10.15 (and if that fails, 3.11.x).

Any other ideas?

     Mark

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-08 23:03                                           ` Mark H Weaver
  2013-10-09  6:53                                             ` Mark H Weaver
@ 2013-10-09 10:39                                             ` Ludovic Courtès
  1 sibling, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-10-09 10:39 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Hi Mark,

Thanks for the thorough analysis.

Mark H Weaver <mhw@netris.org> skribis:

> My suspicion is that my kernel (linux-libre-2.6.39.1) and Guix's glibc
> are not playing nicely together.  However, Guix's glibc was configured
> to support kernels as early as 2.6.30, and the same 'pwd' executable
> that fails within 'guix-daemon' seems to work outside of it, even when
> run within a chroot.

Could it have something to do with bind mounts?

The method ‘DerivationGoal::initChild()’ in libstore/build.cc is what
sets up the chroot environment.  The /tmp/nix-build-* directory is
itself bind-mounted in the chroot.

So:

> * The initial stat(".") syscall reports inode 7274551, which corresponds
>   to "/tmp/nix-build-make-boot0-3.82.drv-0/make-3.82", as expected.
> 
> * stat("/") reports inode 1073173, which looks WRONG.
> 
> * stat("..") reports inode 7274550, which corresponds to
>   "/tmp/nix-build-make-boot0-3.82.drv-0", as expected.
> 
> * reading the contents of ".." reports inode numbers that all look
>   correct, including "make-3.82" with inode 7274551, the same as ".".
>   Thus 'pwd' concludes that its result will end with "/make-3.82".
> 
> * stat("../..") reports inode 1073174, which looks WRONG.
> 
> * reading the contents of "../.." reports inode numbers that all look
>   WRONG:
> 
>    "nix-build-make-boot0-3.82.drv-0" with inode 1073325
>    ".." with inode 1073173
>    "." with inode 1073174
> 
>   None of these match the inode of "..", so 'pwd' fails.

Could it be that stat("/") reports the inode of the underlying root?

Can you try this in a REPL (assuming the bootstrap Guile works):

  (use-modules (guix store) (guix monads) (guix utils)
               (gnu packages bootstrap) (guix packages))
  (define (test)
    (derivation-expression "test" (%current-system)
                           '(and
                             (equal?
                              (pk 'root (stat:ino (stat "/")))
                              (pk 'dotdotdotdot (stat:ino (stat "../.."))))
                             (equal?
                              (pk 'dotdot (stat:ino (stat "..")))
                              (pk 'tmp (stat:ino (stat "/tmp"))))
                             (equal?
                              (pk 'dot (stat:ino (stat ".")))
                              (pk 'tmpdir (stat:ino (stat "/tmp/nix-build-test.drv-0"))))
                             (mkdir %output))
                           '()))
  
  
  (define s (open-connection))
  (define drv
    (run-with-store s (test)
                    #:guile-for-build (package-derivation s %bootstrap-guile)))
  (build-derivations s drv)

If that test fails, that most likely indicates a bug in Linux-Libre.

BTW, were you able to run (some of) ‘make check’?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-10-09  6:53                                             ` Mark H Weaver
@ 2013-10-09 10:42                                               ` Ludovic Courtès
  0 siblings, 0 replies; 132+ messages in thread
From: Ludovic Courtès @ 2013-10-09 10:42 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> This is the entry that reports the wrong inode number.  Note that this
> is a bind mount that mirrors /tmp/nix-build-make-boot0-3.82.drv-0 .
>
> I guess that <CHROOT>/tmp/nix-build-make-boot0-3.82.drv-0 should have
> the same inode as <CHROOT>/tmp/nix-build-make-boot0-3.82.drv-0/. , but
> apparently that is not the case from within guix-daemon, even though it
> _is_ the case when I set up the chroot manually using "mount --bind".

OK.

> One notable difference between the chroot I set up is that the bind
> mounts I created were part of the global namespace, whereas guix-daemon
> restricts the bind mounts to a private namespace.
>
> My initial hypothesis is that this is a namespace-related bug in Linux
> (the kernel).  In case it has already been fixed, I will first work on
> upgrading Linux to 3.10.15 (and if that fails, 3.11.x).

Sounds like a good idea to start with.

Also, you could fiddle with libstore/build.cc–e.g., by removing
CLONE_NEWNS from the ‘clone’ flags–to try to isolate the bug.

Ludo’.

^ permalink raw reply	[flat|nested] 132+ messages in thread

* Re: MIPS64/N64 support
  2013-09-30 11:32                                     ` Nikita Karetnikov
  2013-09-30 16:26                                       ` Ludovic Courtès
  2013-10-07 18:47                                       ` Mark H Weaver
@ 2013-10-10  4:08                                       ` Mark H Weaver
  2 siblings, 0 replies; 132+ messages in thread
From: Mark H Weaver @ 2013-10-10  4:08 UTC (permalink / raw)
  To: Nikita Karetnikov; +Cc: guix-devel

Nikita Karetnikov <nikita@karetnikov.org> writes:

> OK, I fetched the tarballs.  Now I’m getting this error.
>
>
> $ ./pre-inst-env guix build -K hello
>
> [...]
>
> make-3.82/main.c
> make-3.82/README.OS2
> make-3.82/remote-cstms.c
> phase `unpack' succeeded after 4 seconds
[...]
> pwd: error retrieving current directory: getcwd: cannot access parent directories: Success
> pwd: error retrieving current directory: getcwd: cannot access parent directories: Bad address
> configure: error: working directory cannot be determined
> phase `configure' failed after 0 seconds
[...]

FYI, I found a simple workaround for this problem: make sure that /tmp
and /nix/store are not on the same filesystem.  I'll write more later,
but in the meantime this workaround is allowing me to successfully
bootstrap Guix on my YeeLoong, using the N32 ABI.

      Mark

^ permalink raw reply	[flat|nested] 132+ messages in thread

end of thread, other threads:[~2013-10-10  4:09 UTC | newest]

Thread overview: 132+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29 12:34 Goals for 0.4 Ludovic Courtès
2013-08-29 13:16 ` Nikita Karetnikov
2013-08-29 13:36   ` Ludovic Courtès
2013-08-30 17:55     ` Nikita Karetnikov
2013-08-30 18:31       ` Ludovic Courtès
2013-08-31 16:40         ` Nikita Karetnikov
2013-08-31 18:05           ` Ludovic Courtès
2013-08-31 20:34             ` Jose E. Marchesi
2013-08-31 21:07               ` Ludovic Courtès
2013-09-01 23:16                 ` New ‘--list-generations’ and ‘--delete-generations’ options (was: Goals for 0.4) Nikita Karetnikov
2013-09-02  9:08                   ` New ‘--list-generations’ and ‘--delete-generations’ options Ludovic Courtès
2013-09-05  1:30                     ` Nikita Karetnikov
2013-09-05 20:00                       ` Ludovic Courtès
2013-09-05 21:14                         ` Nikita Karetnikov
2013-09-07 19:34                           ` Ludovic Courtès
2013-09-08 10:59                             ` Nikita Karetnikov
2013-09-08 20:22                               ` Ludovic Courtès
2013-09-09  9:17                                 ` Nikita Karetnikov
2013-09-09 16:55                                   ` Ludovic Courtès
2013-09-11  5:16                                     ` Nikita Karetnikov
2013-09-11 21:25                                       ` Ludovic Courtès
2013-09-12  9:17                                         ` Nikita Karetnikov
2013-09-12 12:26                                           ` Ludovic Courtès
2013-09-13 14:44                                             ` Nikita Karetnikov
2013-09-13 21:29                                               ` Ludovic Courtès
2013-09-16 11:12                                                 ` Nikita Karetnikov
2013-09-16 12:16                                                   ` Ludovic Courtès
2013-09-18  0:43                                                     ` PRELIMINARY: [PATCH] guix package: Add '--list-generations' Nikita Karetnikov
2013-09-18 17:35                                                       ` Nikita Karetnikov
2013-09-18 21:32                                                       ` Ludovic Courtès
2013-09-19  0:49                                                         ` Nikita Karetnikov
2013-09-19  9:39                                                           ` Ludovic Courtès
2013-09-19 11:48                                                             ` Nikita Karetnikov
2013-09-19 12:13                                                               ` Ludovic Courtès
2013-09-21 20:39                                                                 ` Ludovic Courtès
2013-09-18 21:35                                                       ` PRELIMINARY: " Ludovic Courtès
2013-09-22 19:19     ` [PATCH] guix package: Add '--delete-generations' Nikita Karetnikov
2013-09-22 20:15       ` Generation 0 (was: [PATCH] guix package: Add '--delete-generations'.) Nikita Karetnikov
2013-09-22 21:15         ` Generation 0 Ludovic Courtès
2013-09-23 10:14           ` Nikita Karetnikov
2013-09-23 15:42             ` Ludovic Courtès
2013-09-24  0:54           ` Nikita Karetnikov
2013-09-24  5:56             ` [PATCH] guix package: Show which generation is the current one. (was: Generation 0) Nikita Karetnikov
2013-09-24 12:45               ` [PATCH] guix package: Show which generation is the current one Ludovic Courtès
2013-09-24 13:55                 ` Nikita Karetnikov
2013-09-24 14:16                   ` Ludovic Courtès
2013-09-25  2:10                     ` Nikita Karetnikov
2013-09-25 12:51                       ` Ludovic Courtès
2013-09-24 12:43             ` Generation 0 Ludovic Courtès
2013-09-24 22:29               ` Nikita Karetnikov
2013-09-25 12:50                 ` Ludovic Courtès
2013-09-25 18:07                   ` Nikita Karetnikov
2013-09-25 19:24                     ` Ludovic Courtès
2013-09-26  2:18                       ` Nikita Karetnikov
2013-09-26  9:44                         ` Ludovic Courtès
2013-09-22 20:55       ` [PATCH] guix package: Add '--delete-generations' Ludovic Courtès
2013-09-23 10:11         ` Nikita Karetnikov
2013-09-23 15:41           ` Ludovic Courtès
2013-09-24  7:21             ` Nikita Karetnikov
2013-09-24 12:50               ` Ludovic Courtès
2013-09-24 13:57                 ` Nikita Karetnikov
2013-09-25  4:21             ` Nikita Karetnikov
2013-09-25 13:05               ` Ludovic Courtès
2013-09-26  2:47                 ` Nikita Karetnikov
2013-09-26  9:49                   ` Ludovic Courtès
2013-09-27 19:04                     ` Ludovic Courtès
2013-09-03 19:21   ` MIPS64/N64 support (was: Goals for 0.4) Nikita Karetnikov
2013-09-03 20:45     ` MIPS64/N64 support Ludovic Courtès
2013-09-04  0:35       ` Nikita Karetnikov
2013-09-04 12:18         ` Ludovic Courtès
2013-09-06  8:35           ` Nikita Karetnikov
2013-09-06  9:46             ` Ludovic Courtès
2013-09-07  2:45               ` Nikita Karetnikov
2013-09-07 12:57                 ` Ludovic Courtès
2013-09-08 14:21                   ` Nikita Karetnikov
2013-09-08 19:54                     ` Ludovic Courtès
2013-09-09  5:38                       ` Nikita Karetnikov
2013-09-09 16:47                         ` Ludovic Courtès
2013-09-27  2:16                           ` Nikita Karetnikov
2013-09-27 19:00                             ` Ludovic Courtès
2013-09-29 13:27                               ` Nikita Karetnikov
2013-09-29 13:31                                 ` Ludovic Courtès
2013-09-29 23:18                                   ` Nikita Karetnikov
2013-09-30 11:32                                     ` Nikita Karetnikov
2013-09-30 16:26                                       ` Ludovic Courtès
2013-09-30 21:51                                         ` Nikita Karetnikov
2013-10-01  7:09                                           ` Lluís Batlle i Rossell
2013-10-01  7:48                                             ` Nikita Karetnikov
2013-10-01  8:03                                               ` Lluís Batlle i Rossell
2013-10-01  8:55                                                 ` Nikita Karetnikov
2013-10-01  8:59                                                   ` Nikita Karetnikov
2013-10-01  9:30                                                   ` Lluís Batlle i Rossell
2013-10-01 10:06                                                     ` Nikita Karetnikov
2013-10-01 10:04                                                       ` Lluís Batlle i Rossell
2013-10-01 11:25                                                         ` Ludovic Courtès
2013-10-01 11:56                                                           ` Lluís Batlle i Rossell
2013-10-07 18:47                                       ` Mark H Weaver
2013-10-07 19:39                                         ` Ludovic Courtès
2013-10-08 23:03                                           ` Mark H Weaver
2013-10-09  6:53                                             ` Mark H Weaver
2013-10-09 10:42                                               ` Ludovic Courtès
2013-10-09 10:39                                             ` Ludovic Courtès
2013-10-10  4:08                                       ` Mark H Weaver
2013-09-30 16:09                                     ` Ludovic Courtès
2013-08-29 15:49 ` Goals for 0.4 Amirouche Boubekki
2013-08-29 20:04   ` Ludovic Courtès
2013-08-30 16:09     ` Cyprien Nicolas
2013-08-30 17:40       ` Amirouche Boubekki
2013-08-30 19:31       ` Overlays Ludovic Courtès
2013-08-30 20:42         ` Overlays Nikita Karetnikov
2013-08-30 21:21           ` Overlays Ludovic Courtès
2013-08-31 10:56             ` Overlays Amirouche Boubekki
2013-08-31 15:57               ` Overlays Ludovic Courtès
2013-08-29 20:42 ` Goals for 0.4 Andreas Enge
2013-08-29 21:32   ` Ludovic Courtès
2013-09-25  8:43   ` Andreas Enge
2013-09-25 13:13     ` Ludovic Courtès
2013-09-26 11:35       ` Andreas Enge
2013-09-28 13:25         ` Ludovic Courtès
2013-09-29 21:29           ` Alex Sassmannshausen
2013-09-02 17:33 ` Cyril Roelandt
2013-09-02 19:38   ` Ludovic Courtès
2013-09-02 19:40     ` Cyril Roelandt
2013-09-02 21:35       ` Ludovic Courtès
2013-09-06  9:19 ` ‘--no-substitutes’ is ignored on i686 (was: Goals for 0.4) Nikita Karetnikov
2013-09-06  9:59   ` ‘--no-substitutes’ is ignored on i686 Ludovic Courtès
2013-09-07  8:43     ` Nikita Karetnikov
2013-09-07 13:00       ` Ludovic Courtès
2013-09-08 11:53         ` Nikita Karetnikov
2013-09-08 11:51           ` Cyril Roelandt
2013-09-08 13:22             ` Nikita Karetnikov
2013-09-24 21:59 ` Goals for 0.4 Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).