guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

<derivation> objects supplant ‘.drv’ file names in the API


From: Ludovic Courtès
Subject: <derivation> objects supplant ‘.drv’ file names in the API
Date: Wed, 18 Sep 2013 23:03:24 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Commit 59688fc introduces notable changes: ‘derivation’,
‘build-expression->derivation’, ‘package-derivation’ and similar
procedures now return a single value, which is a <derivation> object
(previously they would return two values: the .drv file name, and the
<derivation> object.)  The <derivation> object embeds its .drv file name
now:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(gnu packages emacs)
scheme@(guile-user)> ,use(guix store)
scheme@(guile-user)> ,use(guix packages)
scheme@(guile-user)> (define s (open-connection))
scheme@(guile-user)> (package-derivation s emacs)
$2 = #<derivation /nix/store/2lfkipm8ydbv3wmj5ryk49nh4hbmwj6w-emacs-24.3.drv => 
/nix/store/1hkq0q72bki73aa21rakzcffq81vihs1-emacs-24.3 2b2db40>
scheme@(guile-user)> (package-cross-derivation s emacs 
"mips64el-linux-gnuabi64")
$3 = #<derivation /nix/store/fc2i5f4kdr3af1h05xjpc7j4h7zqp6k0-emacs-24.3.drv => 
/nix/store/r478bpdq3mjpci7gsxchjs31xcpgw4f3-emacs-24.3 3af9aa0>
--8<---------------cut here---------------end--------------->8---

So the API only sees <derivation> objects now, with the exception of a
few RPCs (defined in (guix store)), which still pass .drv file names to
the daemon.

I think that makes the API much nicer, as can be seen in the tests/*
files changed in this patch.  It also avoids costs that we previously
had, such as repeated calls ‘derivation-path->output-path’, which has to
parse a .drv file entirely just to extract its output paths (though the
costs were hidden through memoization.)

Comments welcome, and please report any problems you may have!

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]