all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* G-exp that makes use of guile-ini
@ 2023-10-10 17:54 Fabio Natali
  0 siblings, 0 replies; 7+ messages in thread
From: Fabio Natali @ 2023-10-10 17:54 UTC (permalink / raw)
  To: help-guix

Hi! 👋🌈

I've been struggling with the following g-expression that makes use of
the guile-ini library.

#+begin_src scheme :noeval
(use-modules (gnu packages guile-xyz)
             (guix gexp))

(define foo
  (computed-file
   "foo"
   (with-imported-modules '((guix build utils))
     (with-extensions (list guile-ini guile-smc guile-lib)
       #~(begin
           (use-modules (guix build utils)
                        (ini))
           (call-with-output-file #$output
             (lambda (output)
               (format output
                       (ini->scm #$(local-file "/tmp/config.ini"))))))))))

foo
#+end_src

Here's the error I get when building the expression with =guix build -f
foo.scm=:

#+begin_src text
/gnu/store/7rscxhk9gzshkn6bq4nfrl9l6bp67w18-inetutils-2.3/bin/logger: cannot connect: No such file or directory
Backtrace:
           7 (primitive-load "/gnu/store/8bk15mj4w4065wzdl6kx7z4542a?")
In ice-9/ports.scm:
   433:17  6 (call-with-output-file _ _ #:binary _ #:encoding _)
In ice-9/eval.scm:
    159:9  5 (_ #(#(#<directory (guile-user) 7ffff77f7c80>) #<outp?>))
In ini.scm:
    47:20  4 (ini->scm _ #:read-comments? _ #:debug-mode? _)
In smc/fsm.scm:
   465:31  3 (_ #<fsm current-state: read statistics: 0/0 7ffff76dd?> ?)
In ice-9/boot-9.scm:
   260:13  2 (for-each #<procedure 7ffff784a420 at smc/core/log.scm?> ?)
   260:13  1 (for-each #<procedure 7ffff784a3f0 at smc/core/log.scm?> ?)
In smc/core/log.scm:
    165:6  0 (_ _ _ _ _)

smc/core/log.scm:165:6: Could not log a message
#+end_src

Any idea whether:

- this is guile-ini's expected behaviour, just set the scm logger to a
  value that makes sense in the context of the builder
- it's actually as easy as creating the missing folder in the builder
- make sure some logging facility (which one? :)) is available to the
  builder
- this could be a bug (or a little imperfection) in either guile-ini or
  guile-smc?

Any other idea?

Cheers, ta, Fabio.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G-exp that makes use of guile-ini
@ 2023-10-10 22:33 Fabio Natali
  2023-10-11  7:03 ` Artyom V. Poptsov
  0 siblings, 1 reply; 7+ messages in thread
From: Fabio Natali @ 2023-10-10 22:33 UTC (permalink / raw)
  To: help-guix

Fabio Natali wrote:
> I've been struggling with the following g-expression that makes use of
> the guile-ini library.

Quick update, this works well:

#+begin_src scheme :noeval
(use-modules (gnu packages guile-xyz)
	     (guix gexp))

(define foo
  (computed-file
   "foo"
   (with-imported-modules '((guix build utils))
     (with-extensions (list guile-ini guile-smc guile-lib)
       #~(begin
           (use-modules (guix build utils)
			(ice-9 pretty-print)
			(ini)
			(smc core log))
	   (mkdir-p "/tmp")
	   (smc-log-init! "file" `((file . "/tmp/test")))
	   (call-with-output-file #$output
	     (lambda (output)
	       (pretty-print
		(call-with-input-file #$(local-file "/tmp/config.ini")
		  ini->scm)
		output))))))))

foo
#+end_src

Now, that was just a stripped down version of what I need to do though!

The real gexp uses =(open-pipe* OPEN_READ command ...)= instead, where
=command= is a script that calls guile-ini (and therefore guile-smc, and
therefore the logger). I can't use =smc-log-init!= the same way
then... I'll keep you posted if something comes to mind.

Cheers, F.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G-exp that makes use of guile-ini
  2023-10-10 22:33 G-exp that makes use of guile-ini Fabio Natali
@ 2023-10-11  7:03 ` Artyom V. Poptsov
  0 siblings, 0 replies; 7+ messages in thread
From: Artyom V. Poptsov @ 2023-10-11  7:03 UTC (permalink / raw)
  To: 87il7epdli.fsf; +Cc: help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 1706 bytes --]

Hello,

FWIW, there was a similar issue with Guile-DSV:

   https://github.com/artyom-poptsov/guile-dsv/issues/10

The difference is that Guile-DSV API allows to set the Guile-SMC logging 
driver

and its options.


I've added the same functionality to the Guile-INI API:

https://github.com/artyom-poptsov/guile-ini/commit/82ff585070e656f66f874293327fa541382f95ed


Please check if it works for you.


Thanks,


- avp


On 11.10.2023 01:33, Fabio Natali wrote:
> Fabio Natali wrote:
>> I've been struggling with the following g-expression that makes use of
>> the guile-ini library.
> Quick update, this works well:
>
> #+begin_src scheme :noeval
> (use-modules (gnu packages guile-xyz)
> 	     (guix gexp))
>
> (define foo
>    (computed-file
>     "foo"
>     (with-imported-modules '((guix build utils))
>       (with-extensions (list guile-ini guile-smc guile-lib)
>         #~(begin
>             (use-modules (guix build utils)
> 			(ice-9 pretty-print)
> 			(ini)
> 			(smc core log))
> 	   (mkdir-p "/tmp")
> 	   (smc-log-init! "file" `((file . "/tmp/test")))
> 	   (call-with-output-file #$output
> 	     (lambda (output)
> 	       (pretty-print
> 		(call-with-input-file #$(local-file "/tmp/config.ini")
> 		  ini->scm)
> 		output))))))))
>
> foo
> #+end_src
>
> Now, that was just a stripped down version of what I need to do though!
>
> The real gexp uses =(open-pipe* OPEN_READ command ...)= instead, where
> =command= is a script that calls guile-ini (and therefore guile-smc, and
> therefore the logger). I can't use =smc-log-init!= the same way
> then... I'll keep you posted if something comes to mind.
>
> Cheers, F.
>

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7031 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G-exp that makes use of guile-ini
@ 2023-10-11  7:56 Fabio Natali
  2023-10-11  8:01 ` Artyom V. Poptsov
  2023-10-11 20:03 ` Artyom V. Poptsov
  0 siblings, 2 replies; 7+ messages in thread
From: Fabio Natali @ 2023-10-11  7:56 UTC (permalink / raw)
  To: help-guix

Artyom V. Poptsov wrote:
> I've added the same functionality to the Guile-INI API

This is brilliant, thanks Artyom. Do you think you might be willing to
release it as 0.5.4? If so, I'll be glad to bump the Guix package
accordingly.

Thanks, best, F.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G-exp that makes use of guile-ini
  2023-10-11  7:56 Fabio Natali
@ 2023-10-11  8:01 ` Artyom V. Poptsov
  2023-10-11 20:03 ` Artyom V. Poptsov
  1 sibling, 0 replies; 7+ messages in thread
From: Artyom V. Poptsov @ 2023-10-11  8:01 UTC (permalink / raw)
  To: 2242f6c4-9a96-44f7-85bc-66470051a31e, help-guix


[-- Attachment #1.1.1: Type: text/plain, Size: 422 bytes --]

> Do you think you might be willing to
> release it as 0.5.4?

Yeah, sure, just a bit later.

- avp

On 11.10.2023 10:56, Fabio Natali wrote:
> Artyom V. Poptsov wrote:
>> I've added the same functionality to the Guile-INI API
> This is brilliant, thanks Artyom. Do you think you might be willing to
> release it as 0.5.4? If so, I'll be glad to bump the Guix package
> accordingly.
>
> Thanks, best, F.
>

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7031 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G-exp that makes use of guile-ini
  2023-10-11  7:56 Fabio Natali
  2023-10-11  8:01 ` Artyom V. Poptsov
@ 2023-10-11 20:03 ` Artyom V. Poptsov
  1 sibling, 0 replies; 7+ messages in thread
From: Artyom V. Poptsov @ 2023-10-11 20:03 UTC (permalink / raw)
  To: 2242f6c4-9a96-44f7-85bc-66470051a31e, help-guix


[-- Attachment #1.1: Type: text/plain, Size: 606 bytes --]

Hello,

I've released Guile-INI 0.5.4:
   https://github.com/artyom-poptsov/guile-ini/releases/tag/v0.5.4

- avp

On 11.10.2023 10:56, Fabio Natali wrote:
> Artyom V. Poptsov wrote:
>> I've added the same functionality to the Guile-INI API
> 
> This is brilliant, thanks Artyom. Do you think you might be willing to
> release it as 0.5.4? If so, I'll be glad to bump the Guix package
> accordingly.
> 
> Thanks, best, F.
> 

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G-exp that makes use of guile-ini
@ 2023-10-12 10:07 Fabio Natali
  0 siblings, 0 replies; 7+ messages in thread
From: Fabio Natali @ 2023-10-12 10:07 UTC (permalink / raw)
  To: help-guix

Artyom Poptsov wrote:
> I've released Guile-INI 0.5.4

Thanks Artyom! Here's a micro-patch to update it on Guix:

https://lists.gnu.org/archive/html/guix-patches/2023-10/msg00680.html

Have a lovely day. Cheers, F.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-12 10:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 22:33 G-exp that makes use of guile-ini Fabio Natali
2023-10-11  7:03 ` Artyom V. Poptsov
  -- strict thread matches above, loose matches on Subject: below --
2023-10-12 10:07 Fabio Natali
2023-10-11  7:56 Fabio Natali
2023-10-11  8:01 ` Artyom V. Poptsov
2023-10-11 20:03 ` Artyom V. Poptsov
2023-10-10 17:54 Fabio Natali

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.