unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: guix-devel@gnu.org
Subject: Re: Proposal: prefetch tarballs in a batch
Date: Thu, 10 Apr 2014 10:21:31 +0200	[thread overview]
Message-ID: <87vbuhbnn8.fsf@gnu.org> (raw)
In-Reply-To: <87ha62dtmh.fsf@karetnikov.org> (Nikita Karetnikov's message of "Thu, 10 Apr 2014 02:29:26 +0400")

Nikita Karetnikov <nikita@karetnikov.org> 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’.

  reply	other threads:[~2014-04-10  8:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 23:25 Proposal: prefetch tarballs in a batch Nikita Karetnikov
2014-03-28 13:23 ` Ludovic Courtès
2014-04-01 23:23   ` Nikita Karetnikov
2014-04-02 12:57     ` Ludovic Courtès
2014-04-02 22:37       ` Nikita Karetnikov
2014-04-03  7:24         ` Ludovic Courtès
2014-04-09 22:29           ` Nikita Karetnikov
2014-04-10  8:21             ` Ludovic Courtès [this message]
2014-04-12 20:19               ` Nikita Karetnikov
2014-04-12 22:44                 ` Ludovic Courtès
2014-04-24 21:20                   ` Nikita Karetnikov
2014-04-25 11:51                     ` Ludovic Courtès
2014-04-25 12:04                     ` Ludovic Courtès
2014-05-06 12:37                       ` Nikita Karetnikov
2014-05-06 20:02                         ` Ludovic Courtès
2014-05-07 23:14                           ` Nikita Karetnikov
2014-05-08 16:35                             ` Ludovic Courtès
2014-05-11 14:52                               ` Nikita Karetnikov
2014-05-11 19:17                                 ` Ludovic Courtès
2014-09-02 21:06                                   ` Ludovic Courtès
2014-09-02 22:05                                     ` Nikita Karetnikov
2014-09-02 21:04                               ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vbuhbnn8.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=nikita@karetnikov.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).