[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: prefetch tarballs in a batch
From: |
Nikita Karetnikov |
Subject: |
Re: Proposal: prefetch tarballs in a batch |
Date: |
Thu, 10 Apr 2014 02:29:26 +0400 |
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")>
[…]
Then ‘read-derivation’ can be used to “turn” a <derivation-input> type into
<derivation>:
scheme@(guile-user)> ,use (srfi srfi-1)
scheme@(guile-user)> (call-with-input-file (derivation-input-path (first
(derivation-inputs (package-derivation s wget)))) read-derivation)
$4 = #<derivation /gnu/store/divcaakxh5zhgpkih3paxb6znmnpbzhw-guile-2.0.11.drv
=> /gnu/store/6mfc9dhala2mnkmc8xjyjzc04mxwym26-guile-2.0.11-debug
/gnu/store/1r1097pd7842mf3fpyhfn86wdrilx73q-guile-2.0.11 1922fa0>
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?
Or should I use a different function for the base case?
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?
pgpbK9zY3i_y3.pgp
Description: PGP signature
- 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 <=
- Re: Proposal: prefetch tarballs in a batch, Ludovic Courtès, 2014/04/10
- 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