unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* 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
* 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-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
* 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

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-12 10:07 G-exp that makes use of guile-ini Fabio Natali
  -- strict thread matches above, loose matches on Subject: below --
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 22:33 Fabio Natali
2023-10-11  7:03 ` Artyom V. Poptsov
2023-10-10 17:54 Fabio Natali

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).