[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guix-based build tool
From: |
Ricardo Wurmus |
Subject: |
Re: Guix-based build tool |
Date: |
Fri, 20 Apr 2018 22:13:49 +0200 |
User-agent: |
mu4e 1.0; emacs 25.3.1 |
Hi Catonano,
> I am experimenting with this line
>
> (system* "guile" "-c" "(use-modules (commonmark)) (exit ((lambda () 0)))")
>
> If it finds the module it returns 0
>
> Otherwise it returns a different number
>
> I copied some bits for a configure script for a Guile project instrumented
> with the Autotools
>
> I could use an example of usage of "status:Exit-val"
>
> The Guile manual says:
>
> Return the exit status value, as would be set if a process ended
> normally through a call to ‘exit’ or ‘_exit’, if any, otherwise
> ‘#f’.
>
> this is not enouhg for me to understand
>
> In which scenario is thhis function supposed to be used ? In order to do
> what ?
> An example would be of great help
With this procedure you can obtain the return status for “system*”.
Here’s an example:
--8<---------------cut here---------------start------------->8---
(display "Checking for commonmarl...")
(let ((status
(parameterize ((current-error-port (%make-void-port "w")))
(status:exit-val (system* "guile" "-c"
"(begin (use-modules (commonmarl))
(exit 0))")))))
(display (if (zero? status)
"Success!"
"Oh no!"))
(newline))
--8<---------------cut here---------------end--------------->8---
> Anyway: Is this the idiomatic way ?
>
> Or maybe I should use some try catch form wrapping some module loading
> instruction ?
> Without launching a different guile process ?
There are advantages to spawning a new guile process. One is that
whatever modules you may have loaded for your tool won’t affect the
check. It’s possible that your tool bundles a bunch of modules, but
when Guile is spawned in a pure environment it won’t be able to load
these modules. You may want to fail the configure test then.
On the other hand, it’s ugly to pass a Guile programme as a string to
system*, when you could do that instead with pure Guile. I haven’t
thought enough about this to give a recommendation either way.
--
Ricardo
- Re: Guix-based build tool, (continued)
- Re: Guix-based build tool, julien lepiller, 2018/04/09
- Re: Guix-based build tool, Catonano, 2018/04/11
- Re: Guix-based build tool, Christopher Lemmer Webber, 2018/04/16
- Re: Guix-based build tool, Chris Marusich, 2018/04/17
- Re: Guix-based build tool, Ludovic Courtès, 2018/04/18
- Re: Guix-based build tool, Ludovic Courtès, 2018/04/18
- Re: Guix-based build tool, Catonano, 2018/04/19
- Re: Guix-based build tool, Catonano, 2018/04/20
- Re: Guix-based build tool, Catonano, 2018/04/20
- Re: Guix-based build tool, Ludovic Courtès, 2018/04/23
- Re: Guix-based build tool,
Ricardo Wurmus <=
Re: a blog post, Erik Edrosa, 2018/04/06
Re: a blog post, Hartmut Goebel, 2018/04/07
Re: a blog post, Chris Marusich, 2018/04/08