Subject: [bug#57365] [PATCH] gnu: guile-smc: Update to 0.5.0

From: "Artyom V. Poptsov" <[email-masked]>
Date: Sat, 27 Aug 2022 06:15:59 +0300

Hello Mathieu,

Thanks for my patch review!

> What is this patch about? Can't it be upstreamed?

As you can see from the package description of Guile-SMC 0.3.0 there was
already a problem with logging; I just tried to fix that patch for the
current release.

Guile-SMC tries to log to the syslog by default but it seems that this
option is not working in Guix, so we need another way to log the
messages.  Or it may be that I just overlooked something.

I wasn't able to use "<rotating-log>" anymore as Guile-SMC now uses
custom microsecond-resolution logging backend (which is required for the
FSM profiler to work properly.)  The problem is that this backend does
not work well with "<rotating-log>".  With the new snipped Guile-SMC
uses its "<port-log/us>" class to log the messages to
"/tmp/smc.log.<number>" file.

I wish we had more advanced logging functionality in GNU Guile core
modules but that a discussion for another thread I think.

For now I agree that this snipped looks a bit hacky but that is the
solution a I came up with trying to fix things fast.

If you have any ideas on how to improve the snippet (or the logging in
Guile-SMC for that matter), I'm all ears.

Meanwhile I try to do something with Guile-SMC logging myself.

> You need to describe it in the commit message:
>
> [native-inputs]: Add help2man.

> Ditto:
>
> [inputs]: Use the new inputs style.

Done.

Here's the updated patch.
From be2605d82a44f22391b831a7090ff3ae5956d545 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <[email-masked]>
Date: Tue, 23 Aug 2022 21:10:13 +0300
Subject: [PATCH 1/2] gnu: guile-smc: Update to 0.5.0.

* gnu/packages/guile-xyz.scm (guile-smc): Update to 0.5.0.
  [native-inputs]: Add help2man.
  [inputs]: Use the new inputs style.
---
 gnu/packages/guile-xyz.scm | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index a85c7e0fc4..69f629638b 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4796,7 +4796,7 @@ (define-public guile-gitlab
 (define-public guile-smc
   (package
     (name "guile-smc")
-    (version "0.3.0")
+    (version "0.5.0")
     (source
      (origin
        (method git-fetch)
@@ -4806,7 +4806,7 @@ (define-public guile-smc
        (file-name (string-append name "-" version))
        (sha256
         (base32
-         "0szkjmasi70m1vppck7nhdxg4lnxzjq6mihi6r1552s8sxm5z008"))))
+         "03imz9bfvvj8xnwxjaw7b26capvlwq921kqq5yzlzv15ngidky72"))))
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags '("GUILE_AUTO_COMPILE=0")     ;to prevent guild warnings
@@ -4829,12 +4829,11 @@ (define-public guile-smc
                 (format #f
                         "#:init-value \"~a/bin/logger\""
                         (assoc-ref inputs "inetutils")))
-             (("\\(add-handler! %logger %syslog\\)")
-              (string-append
-               "(add-handler! %logger\n"
-               "              (make <rotating-log>\n"
-               "                    #:file-name \"smc.log\"))\n")))
-             #t))
+               (("\\(add-handler! %logger %syslog\\)")
+                (string-append
+                 "(add-handler! %logger\n"
+                 "              (make <port-log/us>\n"
+                 "                    #:port (open-file \"/tmp/smc.log\" \"a+\")))\n")))))
          (add-after 'install 'wrap-program
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out       (assoc-ref outputs "out"))
@@ -4854,12 +4853,12 @@ (define-public guile-smc
                     ,(string-append guile-lib go)))))
              #t)))))
     (native-inputs
-     (list autoconf automake pkg-config texinfo))
+     (list autoconf automake pkg-config texinfo help2man))
     (inputs
-     `(("bash"      ,bash-minimal)
-       ("guile"     ,guile-3.0)
-       ("guile-lib" ,guile-lib)
-       ("inetutils" ,inetutils)))
+     (list bash-minimal
+           guile-3.0
+           guile-lib
+           inetutils))
     (home-page "https://github.com/artyom-poptsov/guile-smc")
     (synopsis "GNU Guile state machine compiler")
     (description
-- 
2.34.1

- Artyom

-- 
Artyom "avp" Poptsov <[email-masked]>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F