guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] gnu: curl: Add ca-bundle to config.


From: Ricardo Wurmus
Subject: Re: [PATCH] gnu: curl: Add ca-bundle to config.
Date: Thu, 5 Jan 2017 16:24:14 +0100
User-agent: mu4e 0.9.16; emacs 25.1.1

ng0 <address@hidden> writes:

>> how can I make this valid:
>>
>>    (arguments
>>     `(#:configure-flags '("--enable-ipv6" "--with-gnutls" "--without-libssh2"
>>                           "--without-libmetalink" "--without-winidn"
>>                           "--without-librtmp" "--without-nghttp2"
>>                           "--without-nss" "--without-cyassl"
>>                           "--without-polarssl" "--without-ssl"
>>                           "--without-winssl" "--without-darwinssl"
>>                           "--disable-sspi" "--disable-ntlm-wb"
>>                           "--disable-ldap" "--disable-rtsp" "--disable-dict"
>>                           "--disable-telnet" "--disable-tftp" 
>> "--disable-pop3"
>>                           "--disable-imap" "--disable-smtp" 
>> "--disable-gopher"
>>                           "--disable-file" "--disable-ftp" "--disable-smb"
>>                           (string-append
>>                            "--with-ca-bundle="
>>                            (string-append (assoc-ref %build-inputs 
>> "nss-certs")
>>                                           
>> "/etc/ssl/certs/ca-certificates.crt")))
>>
>> The string-append is not valid here.
>
> Solved, by using "(list" here.

The reason why this didn’t work is because you’re expecting code to be
evaluated inside of an “inert” expression.

(+ 1 2) is evaluated right away and the result is 3

'(+ 1 2) is a quoted expression, so it’s just a list of '+, 1, and 2.
Think of the ' as “DATA MODE”

`(+ 1 2) is a quasiquoted expression.  Think of the backtick as a toggle
switch.  When it’s up it means “DATA MODE”, when it is down (,) it means
“CODE MODE”.

Example:

    `(+ 1 2 ,(string->number "4"))

this means: DATA MODE + 1 2 CODE MODE (string->number "4")

so you get a list with the following contents: '+, 1, 2, and the number 4.

Your configure flags above are a quoted list, so everything that follows
is just data.  “string-append” is not special, it’s just another symbol
in the list.  You can try this in the REPL to convince yourself that
this is how quoting works.

Note the difference between:

    `(#:configure-flags '("foo" "bar"
                          (string-append "baz" "lightyear")))

and

    `(#:configure-flags '("foo" "bar"
                          ,(string-append "baz" "lightyear")))

The comma (“unquote”) flips the toggle switch and the expression is
evaluated.

Using “list” just means that you are not using quotation at all.


One final note:

>>                           (string-append
>>                            "--with-ca-bundle="
>>                            (string-append (assoc-ref %build-inputs 
>> "nss-certs")
>>                                           
>> "/etc/ssl/certs/ca-certificates.crt")))

That’s really not pretty.  You don’t need to nest string-append
expressions.

    (string-append "this" "and" "that")

returns the same value as

    (string-append "this" (string-append "and" "that"))

~~ Ricardo



reply via email to

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