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

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

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?

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

  reply	other threads:[~2014-04-09 22:34 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 [this message]
2014-04-10  8:21             ` Ludovic Courtès
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=87ha62dtmh.fsf@karetnikov.org \
    --to=nikita@karetnikov.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.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).