all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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-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

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-14 22:23 Having a problem invoking curl only when using guix pull Brian Woodcox
2019-05-16  3:13 ` ison
2019-05-16 21:49 ` Brian Woodcox
  -- strict thread matches above, loose matches on Subject: below --
2019-05-16 22:53 Brian Woodcox
2019-05-17  0:21 ` John Soo
2019-05-17  0:31   ` Brian Woodcox
2019-05-17  1:04   ` Tobias Geerinckx-Rice

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.