GNU bug report logs - #78022
[PATCH 0/8] Fix kaldi-based packages

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Wed, 23 Apr 2025 23:00:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 78022 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 78022 <at> debbugs.gnu.org
Cc: Nicolas Graves <ngraves <at> ngraves.fr>
Subject: [PATCH 8/8] gnu: kaldi-gstreamer-server: Fix build, cleanup tests.
Date: Thu, 24 Apr 2025 01:08:12 +0200
* gnu/packages/machine-learning.scm (kaldi-gstreamer-server):
  [origin]<snippet>: Remove test files.
  [arguments]<phases>: Migrate from GObject.MainLoop to GLib.MainLoop
  in 'build phase.  Adapt to the absence of test files.  Improve the
  wrap part of 'install phase.
  [inputs]: Add gstreamer, gst-plugins-base, gst-plugins-good, kaldi.
  They are necessary for proper install/wrapping.
---
 gnu/packages/machine-learning.scm | 45 +++++++++++++++++++------------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index fb583e93273..9a8dee28191 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -3217,10 +3217,18 @@ (define-public kaldi-gstreamer-server
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "1iijq8jmgdxr7961inal1ggs496ymxradm51m4sqx8vl983x14y8"))))
+                  "1iijq8jmgdxr7961inal1ggs496ymxradm51m4sqx8vl983x14y8"))
+                ;; XXX: Tests are broken beyond repair and are mingled in the
+                ;; source directory.  Remove them to avoid installing them.
+                ;; See https://github.com/nicolas-graves/kaldi-gstreamer-server
+                ;; for a fork that tries to repair them, to no avail.
+                (snippet #~(for-each delete-file
+                                     '("kaldigstserver/test-buffer.py"
+                                       "kaldigstserver/decoder_test.py"
+                                       "kaldigstserver/decoder2_test.py")))))
       (build-system gnu-build-system)
       (arguments
-       `(#:tests? #f ; there are no tests that can be run automatically
+       `(#:tests? #f
          #:modules ((guix build utils)
                     (guix build gnu-build-system)
                     (srfi srfi-26))
@@ -3228,7 +3236,11 @@ (define-public kaldi-gstreamer-server
          (modify-phases %standard-phases
            (delete 'configure)
            (replace 'build
-             (lambda* (#:key outputs #:allow-other-keys)
+             (lambda _
+               ;; Migrate to Glib.MainLoop.
+               (substitute* (find-files "kaldigstserver" "\\.py")
+                 (("GObject\\.threads_init\\(\\)") "")
+                 (("GObject") "GLib"))
                ;; Disable hash randomization to ensure the generated .pycs
                ;; are reproducible.
                (setenv "PYTHONHASHSEED" "0")
@@ -3237,10 +3249,6 @@ (define-public kaldi-gstreamer-server
                  (substitute* "master_server.py"
                    (("\\.replace\\('\\\\.*") ")"))
 
-                 ;; This is a Python 2 file
-                 (delete-file "decoder_test.py")
-                 (delete-file "test-buffer.py")
-
                  (for-each (lambda (file)
                              (apply invoke
                                     `("python"
@@ -3267,19 +3275,18 @@ (define-public kaldi-gstreamer-server
                  (let* ((server (string-append bin "/kaldi-gst-server"))
                         (client (string-append bin "/kaldi-gst-client"))
                         (worker (string-append bin "/kaldi-gst-worker"))
-                        (PYTHONPATH (getenv "GUIX_PYTHONPATH"))
-                        (GST_PLUGIN_PATH (string-append
-                                          (assoc-ref inputs "gst-kaldi-nnet2-online")
-                                          "/lib/gstreamer-1.0:${GST_PLUGIN_PATH}"))
                         (wrap (lambda (wrapper what)
                                 (with-output-to-file wrapper
                                   (lambda _
-                                    (format #t
-                                            "#!~a
+                                    (format #t "#!~a
 export GUIX_PYTHONPATH=~a
-export GST_PLUGIN_PATH=~a
-exec ~a ~a/~a \"$@\"~%"
-                                            (which "bash") PYTHONPATH GST_PLUGIN_PATH
+export GI_TYPELIB_PATH=~a:${GI_TYPELIB_PATH}
+export GST_PLUGIN_SYSTEM_PATH=~a:${GST_PLUGIN_SYSTEM_PATH}
+exec ~a ~a~a \"$@\"~%"
+                                            (which "bash")
+                                            (getenv "GUIX_PYTHONPATH")
+                                            (getenv "GI_TYPELIB_PATH")
+                                            (getenv "GST_PLUGIN_SYSTEM_PATH")
                                             (which "python") share what)))
                                 (chmod wrapper #o555))))
                    (for-each wrap
@@ -3288,7 +3295,11 @@ (define-public kaldi-gstreamer-server
                                    "client.py"
                                    "worker.py")))))))))
       (inputs
-       (list gst-kaldi-nnet2-online
+       (list gstreamer
+             gst-kaldi-nnet2-online
+             gst-plugins-base
+             gst-plugins-good
+             kaldi
              python-wrapper
              python-pygobject
              python-pyyaml
-- 
2.49.0





This bug report was last modified 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.