Eric Bavier <ericbav...@gmail.com> skribis: > This patch is intended mostly for discussion. It was brought up again > on IRC yesterday the idea of prefetching package source into the store > in order to be able to hack on guix offline.
Excellent! > +(define (package-source* package) > + "List package-source but returns its results as a list" > + (list (package-source package))) What about using the plural, ‘package-sources’, which makes it clear that it returns a list? > +(define (package-direct-source package) > + "Return all source origins associated with PACKAGE; including origins in Likewise, plural. > +(define (package-transitive-source package) > + "Return PACKAGE's direct sources, and its input sources, recursively." Ditto. > I've tested this patch by building e.g. gmsh (which I did not already > have in the store):: > > $ guix build --source=transitive gmsh > [...] > <disconnect network> > $ guix build gmsh Neat! This is indeed the use case that had been discussed with Nikita a while back. > The build succeeded after building the glu, glproto, fltk, and > xf86vidmodeproto inputs from source. I haven't yet tried making a > change that would require rebootstrapping while offline. I think the > idea is that this should work. Yes. > What I'd like to get some feedback on: > > 1. Adding an optional argument to `guix build --source` currently breaks > `guix build -S foo`, since the option parsing thinks "foo" is the > argument for -S. I'm not sure how this could be reconciled. I think this is a problem, perhaps because I’m used to ‘guix build -S foo’ and I wouldn’t want to do more typing for something like this. ;-) I can think of two options to work around it: 1. Add a separate option, say, --sources={transitive,all,package}. 2. Make it a separate command, say ‘guix prefetch’ with just the option ‘--sources={transitive,all}’. WDYT? > 2. There might be clearer user/developer-facing names for the arguments. I think that’s fine. > 3. Am I understanding the use-case? I think so. Andreas notes that when one just plans to modify a leaf package while on the train, running something like ‘guix environment the-leaf -E true’ is enough to fetch the dependencies of that package. But I think that’s a slightly different use case anyway. Thanks, Ludo’.