[bug#76489] gnu: task-spooler: Update to 1.0.3.

Message ID 87o6yt3n9b.fsf@ngraves.fr
State New
Headers
Series [bug#76489] gnu: task-spooler: Update to 1.0.3. |

Commit Message

Nicolas Graves Feb. 22, 2025, 5:19 p.m. UTC
  * gnu/packages/task-runners.scm: Sort modules.
(task-spooler): Update to 1.0.3.
[arguments]: Rewrite using gexps. Improve 'check phase.
[inputs]: Improve style.
---
 gnu/packages/task-runners.scm | 67 ++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 32 deletions(-)
  

Comments

Sharlatan Hellseher March 7, 2025, 9:39 p.m. UTC | #1
Hi,

Thanks for the patch.

Pushed yours as un-modified because the package built just fine, and add
styling adjustment in the following commit.

Pushed to master:
a5182cf20aa * gnu: task-spooler: Improve style, fix lint warnings.
dd03c5f9c9a * gnu: task-spooler: Update to 1.0.3.

--
Oleg
  

Patch

diff --git a/gnu/packages/task-runners.scm b/gnu/packages/task-runners.scm
index eb64f432e8..5c9e058f20 100644
--- a/gnu/packages/task-runners.scm
+++ b/gnu/packages/task-runners.scm
@@ -2,6 +2,7 @@ 
 ;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,17 +20,18 @@ 
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages task-runners)
-  #:use-module ((guix licenses) #:prefix license:)
-  #:use-module (guix packages)
-  #:use-module (guix download)
-  #:use-module (guix git-download)
-  #:use-module (guix utils)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages golang-xyz)
   #:use-module (gnu packages mail)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system go))
+  #:use-module (guix build-system go)
+  #:use-module (guix download)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix utils))
 
 (define-public run
   (package
@@ -63,54 +65,55 @@  (define-public run
 (define-public task-spooler
   (package
     (name "task-spooler")
-    (version "1.0.1")
+    (version "1.0.3")
     (source
       (origin
         (method url-fetch)
         (uri (string-append
-               "https://vicerveza.homeunix.net/~viric/soft/ts/ts-" version ".tar.gz"))
-        (sha256 (base32 "0y32sm2i2jxs88c307h76449fynk75p9qfw1k11l5ixrn03z67pl"))))
+              "https://vicerveza.homeunix.net/~viric/soft/ts/ts-"
+              version ".tar.gz"))
+        (sha256
+         (base32 "0a5l8bjq869lvqys3amsil933vmm9b387axp1jv3bi9xah8k70zs"))))
     (build-system gnu-build-system)
     (arguments
-      `(#:make-flags
-        (let ((c-flags "-g -O2"))
-          (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
-                ,(string-append "CC=" (cc-for-target))
+     (list
+      #:make-flags
+      #~(let ((c-flags "-g -O2"))
+          (list (string-append "PREFIX=" #$output)
+                #$(string-append "CC=" (cc-for-target))
                 (string-append "CFLAGS=" c-flags)))
-        #:phases
-        (modify-phases %standard-phases
+      #:phases
+      #~(modify-phases %standard-phases
           (delete 'configure) ;; no configuration script
           (add-after 'unpack 'rename-and-patch-paths
-            (lambda _
+            (lambda* (#:key inputs #:allow-other-keys)
               ;; Rename "ts" to "tsp" to not interfere with "ts" command
               ;; from moreutils package.
               (rename-file "ts.1" "tsp.1");
               (substitute* '("Makefile" "testbench.sh")
                 (("\\bts\\b") "tsp"))
               ;; Patch gzip/sendmail/shell paths.
-              (substitute* "execute.c"
-                (("execlp\\(\"gzip\"")
-                 (format #f "execlp(\"~a/bin/gzip\""
-                         (assoc-ref %build-inputs "gzip"))))
+              (substitute* '("execute.c" "list.c")
+                (("execlp\\(\"(gzip|sh)\"" all exe)
+                 (format #f "execlp(~s"
+                         (search-input-file
+                          inputs (string-append "/bin/" exe)))))
               (substitute* "list.c"
                 (("/bin/sh\\b") (which "sh")))
-              (substitute* "env.c"
-                (("execlp\\(\"/bin/sh\"")
-                 (format #f "execlp(\"~a/bin/sh\""
-                         (assoc-ref %build-inputs "bash"))))
               (substitute* "mail.c"
                 (("execl\\(\"/usr/sbin/sendmail\"")
-                 (format #f "execl(\"~a/sbin/sendmail\""
-                         (assoc-ref %build-inputs "sendmail"))))))
+                 (format #f "execl(~s"
+                         (search-input-file inputs "/sbin/sendmail"))))))
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (setenv "PATH" (string-join (list (getenv "PATH") (getcwd)) ":"))
-                (invoke "./testbench.sh")))))))
+              (if tests?
+                  (begin
+                    (setenv "PATH"
+                            (string-append (getenv "PATH") ":" (getcwd)))
+                    (invoke "./testbench.sh"))
+                  (format #t "test suite not run ~%")))))))
     (inputs
-      `(("bash" ,bash-minimal)
-        ("gzip" ,gzip)
-        ("sendmail" ,sendmail)))
+     (list bash-minimal gzip sendmail))
     (synopsis "UNIX task queue system")
     (description "Task spooler lets users run shell commands asynchronously
 one after the other in a separate process.")