guix-devel
[Top][All Lists]
Advanced

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

Re: Stepping through Guix code (REPL)


From: Ludovic Courtès
Subject: Re: Stepping through Guix code (REPL)
Date: Tue, 23 Jun 2015 14:45:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Pjotr Prins <address@hidden> skribis:

> Q1: 
>
>   
> https://www.gnu.org/software/guile/manual/html_node/Single-Stepping-through-a-Procedure_0027s-Code.html#Single-Stepping-through-a-Procedure_0027s-Code

This is a stale page from the Guile 1.8 manual; I’ve removed it now.

See
<https://www.gnu.org/software/guile/manual/html_node/Interactive-Debugging.html>
for the up-to-date documentation.

> But when it comes to the higher-level git-fetch in git-download.scm I
> fail to run that. I am trying something like
>
>   (define-module (gnu packages bioinformatics-test)
>     #:use-module (gnu packages bioinformatics)
>     #:use-module (guix)
>     #:use-module (guix git-download)
>     #:use-module (guix hash)
>     #:use-module (guix base32)
>     )
>
>   (define s (open-connection))
>   (define ref (git-reference
>                  (url "some_source.git")
>                  (commit "c003c1e")
>                  ))
>
>   (git-fetch ref 'sha256
>                   (base32
>                    "0yvkv7pnigvcifas3vcr8sk87xrrb8y9nh9v1yx2p43k0xz1q8vz")
>                   "mypackage")
>
> Which does not give errors, but there is no result (supposedly it calls into
> the earlier git-fetch). The monadic thing is beyond me, so can someone tell me
> how to run this git-fetch procedure from REPL? :)

‘git-fetch’ from (guix git-download) is a “monadic procedure”.  So if
you call it like this, it immediately returns a something like:

  $3 = #<procedure 44cd190 at guix/git-download.scm:89:2 (state)>

The reason is that it needs to be called in a “special way” (its monadic
result must be “bound”) to have any effect:
<https://www.gnu.org/software/guix/manual/html_node/The-Store-Monad.html>.

At the REPL, you can use the ‘enter-store-monad’ command:

--8<---------------cut here---------------start------------->8---
scheme@(gnu packages bioinformatics-test)> ,enter-store-monad
store-monad@(gnu packages bioinformatics-test) [1]>   (git-fetch ref 'sha256
                  (base32
                   "0yvkv7pnigvcifas3vcr8sk87xrrb8y9nh9v1yx2p43k0xz1q8vz")
                  "mypackage")
$4 = #<derivation /gnu/store/fmpk2sck6ny5dgyx12s539qcadzky24n-mypackage.drv => 
/gnu/store/k6q69arfmsm116a8hfkqqahm0ddzacjc-mypackage 50b9e10>
--8<---------------cut here---------------end--------------->8---

Here $4 is a derivation object, and calling ‘built-derivations’ on it
actually starts the build process (which fails here because of the bogus
URL):

--8<---------------cut here---------------start------------->8---
store-monad@(gnu packages bioinformatics-test) [1]> (built-derivations (list 
$4))
building path(s) `/gnu/store/fid19bds4rak2zn8pzfhrjdcpmqwhjn4-module-import'
building path(s) 
`/gnu/store/vf1pmac8yz2g0d4ln5ibwg0xaffdrnpq-module-import-compiled'
building path(s) `/gnu/store/k6q69arfmsm116a8hfkqqahm0ddzacjc-mypackage'
fatal: repository 'some_source.git' does not exist
environment variable `PATH' unset
builder for `/gnu/store/fmpk2sck6ny5dgyx12s539qcadzky24n-mypackage.drv' failed 
to produce output path `/gnu/store/k6q69arfmsm116a8hfkqqahm0ddzacjc-mypackage'
guix/store.scm:627:0: In procedure build-things:
guix/store.scm:627:0: Throw to key `srfi-34' with args `(#<condition 
&nix-protocol-error [message: "build of 
`/gnu/store/fmpk2sck6ny5dgyx12s539qcadzky24n-mypackage.drv' failed" status: 1] 
4cc61b0>)'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
--8<---------------cut here---------------end--------------->8---

Alternately, you can use ‘run-with-store’, as in:

  (run-with-store s
    (git-fetch ref ...))

HTH,
Ludo’.



reply via email to

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