[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: prefetch tarballs in a batch
From: |
Ludovic Courtès |
Subject: |
Re: Proposal: prefetch tarballs in a batch |
Date: |
Thu, 10 Apr 2014 10:21:31 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Nikita Karetnikov <address@hidden> skribis:
> So, in order to add a tarball to the store, one can write:
>
> $ ./pre-inst-env guile
> scheme@(guile-user)> ,use (guix store) (guix packages) (guix derivations)
> (gnu packages wget)
> scheme@(guile-user)> (define s (open-connection))
> scheme@(guile-user)> (package-source-derivation s (package-source wget))
> $1 = #<derivation
> /gnu/store/jf4hzf16akk7bjidpr6im3wamfnr5rpv-wget-1.15.tar.xz.drv =>
> /gnu/store/qz9vm8802v6pi69ci2kgnvfivrkr085r-wget-1.15.tar.xz 1922cd0>
> scheme@(guile-user)> (build-derivations s (list $1))
> $2 = #t
> scheme@(guile-user)> (file-exists? (derivation->output-path $1))
> $3 = #t
>
> And to get a list of inputs (including the implicit ones):
>
> scheme@(guile-user)> ,use (srfi srfi-26)
> scheme@(guile-user)> (for-each (cut format #t "~a~%" <>) (derivation-inputs
> (package-derivation s wget)))
> #<<derivation-input> path:
> "/gnu/store/divcaakxh5zhgpkih3paxb6znmnpbzhw-guile-2.0.11.drv"
> sub-derivations: ("out")>
> #<<derivation-input> path:
> "/gnu/store/jf4hzf16akk7bjidpr6im3wamfnr5rpv-wget-1.15.tar.xz.drv"
> sub-derivations: ("out")>
> #<<derivation-input> path:
> "/gnu/store/rx5kn39gcc0vm4hwr81kcwpxgybx2yay-perl-5.16.1.drv"
> sub-derivations: ("out")>
Yup, but note that the you don’t need to actually build the derivation
to traverse it (IOW the ‘build-derivations’ call is not needed.)
> I’m planning to do the same for every input. But a couple of things are
> not clear:
>
> 1. Should the recursion stop when ‘fixed-output-derivation?’ returns #t?
I think so. In general fixed-output derivations are the things you
would like to pre-fetch; so you would typically call ‘build-derivations’
on these to do the actual pre-fetching.
> 2. I’d like to use ‘package-source-derivation’ (see above) in order to
> get a tarball. Is it possible to get a <package> type from
> <derivation>? If not, what are my options?
No: as the manual so nicely says ;-), “derivations are to package
definitions what assembly is to C programs.”
What I would imagine is something like:
(define (derivations-to-prefetch store drv)
"Return the list of fixed-output derivations that DRV depends on,
directly or indirectly."
...)
And then you would just pass the result of this procedure to
‘build-derivations’, which would download anything not already present.
Does that make sense?
Ludo’.
- Re: Proposal: prefetch tarballs in a batch, Nikita Karetnikov, 2014/04/01
- Re: Proposal: prefetch tarballs in a batch, Ludovic Courtès, 2014/04/02
- Re: Proposal: prefetch tarballs in a batch, Nikita Karetnikov, 2014/04/02
- Re: Proposal: prefetch tarballs in a batch, Ludovic Courtès, 2014/04/03
- Re: Proposal: prefetch tarballs in a batch, Nikita Karetnikov, 2014/04/09
- Re: Proposal: prefetch tarballs in a batch,
Ludovic Courtès <=
- Re: Proposal: prefetch tarballs in a batch, Nikita Karetnikov, 2014/04/12
- Re: Proposal: prefetch tarballs in a batch, Ludovic Courtès, 2014/04/12
- Re: Proposal: prefetch tarballs in a batch, Nikita Karetnikov, 2014/04/24
- Re: Proposal: prefetch tarballs in a batch, Ludovic Courtès, 2014/04/25
- Re: Proposal: prefetch tarballs in a batch, Ludovic Courtès, 2014/04/25