* Having a problem invoking curl only when using guix pull
@ 2019-05-14 22:23 Brian Woodcox
2019-05-16 3:13 ` ison
2019-05-16 21:49 ` Brian Woodcox
0 siblings, 2 replies; 7+ messages in thread
From: Brian Woodcox @ 2019-05-14 22:23 UTC (permalink / raw)
To: help-guix
Hi,
I’m having problems with a piece of code.
;; Retrieve git commit date
(define get-commit-date (lambda _
(let* ((out (open-input-pipe (format #f "curl --silent '~a'" %api-url)))
(str (get-string-all out))
(queryResults (json-string->scm str))
(date (cdr (hash-get-handle (cdr (hash-get-handle (cdr (hash-get-handle queryResults "commit")) "author")) "date"))))
(display "Contacting github for commit date...\n")
(close-pipe out)
date)))
This code sits above my package code and I use it to dynamically populate my some values when building my package.
Everything works great and I can install the package locally without any problems.
My issue occurs if I try to issue a guix pull to bring this in through a separate channel.
When I do that I always get /gnu/store/…-bash-minimal-4.4.23/bin/bash: curl: command not found.
Any help would be greatly appreciated.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Having a problem invoking curl only when using guix pull
2019-05-14 22:23 Brian Woodcox
@ 2019-05-16 3:13 ` ison
2019-05-16 21:49 ` Brian Woodcox
1 sibling, 0 replies; 7+ messages in thread
From: ison @ 2019-05-16 3:13 UTC (permalink / raw)
To: Brian Woodcox; +Cc: help-guix
Perhaps all you need is to include the curl package in your package's
native-inputs field.
Also as a side note, I'm not entirely sure if using open-input-pipe would be
considered good practice for packages as far as reproducibility is concerned.
Perhaps someone else can comment on that.
But another option you might want to consider is using the built in web modules.
For example:
#:use-module (web client)
#:use-module (web uri)
...
(let* ((out (call-with-values (lambda () (http-get (string->uri %api-url)))
(lambda (response body) body)))
...
I'm not sure if that's the most elegant way to do it, but it seems to work.
There's also a curl module for guile, although I'm not sure if guix will let you
import it or not.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Having a problem invoking curl only when using guix pull
2019-05-14 22:23 Brian Woodcox
2019-05-16 3:13 ` ison
@ 2019-05-16 21:49 ` Brian Woodcox
1 sibling, 0 replies; 7+ messages in thread
From: Brian Woodcox @ 2019-05-16 21:49 UTC (permalink / raw)
To: help-guix
>
> Hi,
>
> I’m having problems with a piece of code.
>
> ;; Retrieve git commit date
> (define get-commit-date (lambda _
> (let* ((out (open-input-pipe (format #f "curl --silent '~a'" %api-url)))
> (str (get-string-all out))
> (queryResults (json-string->scm str))
> (date (cdr (hash-get-handle (cdr (hash-get-handle (cdr (hash-get-handle queryResults "commit")) "author")) "date"))))
> (display "Contacting github for commit date...\n")
> (close-pipe out)
> date)))
>
> This code sits above my package code and I use it to dynamically populate my some values when building my package.
>
> Everything works great and I can install the package locally without any problems.
>
> My issue occurs if I try to issue a guix pull to bring this in through a separate channel.
>
> When I do that I always get /gnu/store/…-bash-minimal-4.4.23/bin/bash: curl: command not found.
>
> Any help would be greatly appreciated.
>
> Thanks.
>
So I’ve worked on this further and I was able to get the curl command to run.
In the end, it turns out that the networking service is not available when building a package.
It’s probably not worth the trouble to make it work.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Having a problem invoking curl only when using guix pull
@ 2019-05-16 22:53 Brian Woodcox
2019-05-17 0:21 ` John Soo
0 siblings, 1 reply; 7+ messages in thread
From: Brian Woodcox @ 2019-05-16 22:53 UTC (permalink / raw)
To: help-guix, ison
> Perhaps all you need is to include the curl package in your package's
> native-inputs field.
>
> Also as a side note, I'm not entirely sure if using open-input-pipe would be
> considered good practice for packages as far as reproducibility is concerned.
> Perhaps someone else can comment on that.
> But another option you might want to consider is using the built in web modules.
> For example:
>
> #:use-module (web client)
> #:use-module (web uri)
> ...
> (let* ((out (call-with-values (lambda () (http-get (string->uri %api-url)))
> (lambda (response body) body)))
> ...
>
> I'm not sure if that's the most elegant way to do it, but it seems to work.
> There's also a curl module for guile, although I'm not sure if guix will let you
> import it or not.
Hi ison,
Unfortunately that doesn’t work, due to tls not being available.
See the bug I reported here —> https://lists.gnu.org/archive/html/bug-guile/2019-04/msg00008.html <https://lists.gnu.org/archive/html/bug-guile/2019-04/msg00008.html>
Thanks for the effort though.
Brian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Having a problem invoking curl only when using guix pull
2019-05-16 22:53 Having a problem invoking curl only when using guix pull Brian Woodcox
@ 2019-05-17 0:21 ` John Soo
2019-05-17 0:31 ` Brian Woodcox
2019-05-17 1:04 ` Tobias Geerinckx-Rice
0 siblings, 2 replies; 7+ messages in thread
From: John Soo @ 2019-05-17 0:21 UTC (permalink / raw)
To: Brian Woodcox; +Cc: help-guix
Hi Brian,
Others may correct me if I’m wrong here, but during the build phase, network io is off limits. This is since there is not way to reliably guarantee the contents of things gotten over the network remain unchanged between builds, and so would break the immutability guarantees of the package system.
Again, I could be wrong, I hope others will correct me.
- John
On May 16, 2019, at 3:53 PM, Brian Woodcox <bw@inskydata.com> wrote:
>> Perhaps all you need is to include the curl package in your package's
>> native-inputs field.
>>
>> Also as a side note, I'm not entirely sure if using open-input-pipe would be
>> considered good practice for packages as far as reproducibility is concerned.
>> Perhaps someone else can comment on that.
>> But another option you might want to consider is using the built in web modules.
>> For example:
>>
>> #:use-module (web client)
>> #:use-module (web uri)
>> ...
>> (let* ((out (call-with-values (lambda () (http-get (string->uri %api-url)))
>> (lambda (response body) body)))
>> ...
>>
>> I'm not sure if that's the most elegant way to do it, but it seems to work.
>> There's also a curl module for guile, although I'm not sure if guix will let you
>> import it or not.
>
> Hi ison,
>
> Unfortunately that doesn’t work, due to tls not being available.
>
> See the bug I reported here —> https://lists.gnu.org/archive/html/bug-guile/2019-04/msg00008.html <https://lists.gnu.org/archive/html/bug-guile/2019-04/msg00008.html>
>
> Thanks for the effort though.
>
> Brian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Having a problem invoking curl only when using guix pull
2019-05-17 0:21 ` John Soo
@ 2019-05-17 0:31 ` Brian Woodcox
2019-05-17 1:04 ` Tobias Geerinckx-Rice
1 sibling, 0 replies; 7+ messages in thread
From: Brian Woodcox @ 2019-05-17 0:31 UTC (permalink / raw)
To: John Soo; +Cc: help-guix
> On May 16, 2019, at 6:21 PM, John Soo <jsoo1@asu.edu> wrote:
>
> Hi Brian,
>
> Others may correct me if I’m wrong here, but during the build phase, network io is off limits. This is since there is not way to reliably guarantee the contents of things gotten over the network remain unchanged between builds, and so would break the immutability guarantees of the package system.
>
> Again, I could be wrong, I hope others will correct me.
>
> - John
>
Hi John,
I believe you are probably correct.
I thought I would be creative :)
Brian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Having a problem invoking curl only when using guix pull
2019-05-17 0:21 ` John Soo
2019-05-17 0:31 ` Brian Woodcox
@ 2019-05-17 1:04 ` Tobias Geerinckx-Rice
1 sibling, 0 replies; 7+ messages in thread
From: Tobias Geerinckx-Rice @ 2019-05-17 1:04 UTC (permalink / raw)
To: John Soo; +Cc: help-guix
[-- Attachment #1: Type: text/plain, Size: 813 bytes --]
John,
John Soo wrote:
> Others may correct me if I’m wrong here, but during the build
> phase, network io is off limits. This is since there is not way
> to reliably guarantee the contents of things gotten over the
> network remain unchanged between builds, and so would break the
> immutability guarantees of the package system.
>
> Again, I could be wrong, I hope others will correct me.
You are one hundred percent correct.
The exception to this rule are ‘fixed-output derivations’ such as
url-fetch, which may fetch whatever they want from anywhere as
long as the end result matches a provided hash.
These same restrictions do not apply to ‘host-side’ Scheme code,
however. One can use the phase of the moon to generate a package
record.
Kind regards,
T G-R
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-05-17 1:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-16 22:53 Having a problem invoking curl only when using guix pull Brian Woodcox
2019-05-17 0:21 ` John Soo
2019-05-17 0:31 ` Brian Woodcox
2019-05-17 1:04 ` Tobias Geerinckx-Rice
-- strict thread matches above, loose matches on Subject: below --
2019-05-14 22:23 Brian Woodcox
2019-05-16 3:13 ` ison
2019-05-16 21:49 ` Brian Woodcox
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).