GNU bug report logs - #49685
[PATCH] gnu: Add task-spooler.

Previous Next

Package: guix-patches;

Reported by: Ivan Gankevich <i.gankevich <at> spbu.ru>

Date: Wed, 21 Jul 2021 18:38:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49685 in the body.
You can then email your comments to 49685 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#49685; Package guix-patches. (Wed, 21 Jul 2021 18:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Gankevich <i.gankevich <at> spbu.ru>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 21 Jul 2021 18:38:02 GMT) Full text and rfc822 format available.

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

From: Ivan Gankevich <i.gankevich <at> spbu.ru>
To: guix-patches <at> gnu.org
Cc: Ivan Gankevich <i.gankevich <at> spbu.ru>
Subject: [PATCH] gnu: Add task-spooler.
Date: Wed, 21 Jul 2021 21:35:05 +0300
* gnu/packages/task-runners.scm (task-spooler): New variable.
---
 gnu/packages/task-runners.scm | 58 +++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/task-runners.scm b/gnu/packages/task-runners.scm
index 49a07fa3bd..5b47076696 100644
--- a/gnu/packages/task-runners.scm
+++ b/gnu/packages/task-runners.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Stefan Reichör <stefan <at> xsteve.at>
+;;; Copyright © 2021 Ivan Gankevich <i.gankevich <at> spbu.ru>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,8 +20,12 @@
 (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 (gnu packages compression)
   #:use-module (gnu packages golang)
+  #:use-module (gnu packages mail)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system go))
 
 (define-public run
@@ -47,3 +52,56 @@
 using a Runfile.")
     (home-page "https://github.com/TekWizely/run")
     (license license:expat)))
+
+(define-public task-spooler
+  (package
+    (name "task-spooler")
+    (version "1.0.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "https://vicerveza.homeunix.net/~viric/soft/ts/ts-" version ".tar.gz"))
+        (sha256 (base32 "0y32sm2i2jxs88c307h76449fynk75p9qfw1k11l5ixrn03z67pl"))))
+    (build-system gnu-build-system)
+    (arguments
+      `(#:make-flags
+        (let ((c-flags "-g -O2"))
+          (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+                "CC=gcc"
+                (string-append "CFLAGS=" c-flags)
+                (string-append "LDFLAGS=" c-flags)))
+        #:phases
+        (modify-phases %standard-phases
+          (delete 'configure) ;; no configuration script
+          (add-after 'unpack 'rename-and-patch-paths
+            (lambda _
+              ;; 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\"" (which "gzip"))))
+              (substitute* "list.c"
+                (("/bin/sh\\b") (which "sh")))
+              (substitute* "env.c"
+                (("execlp\\(\"/bin/sh\"") (format #f "execlp(\"~a\"" (which "sh"))))
+              (substitute* "mail.c"
+                (("execl\\(\"/usr/sbin/sendmail\"")
+                 (format #f "execl(\"~a/usr/sbin/sendmail\""
+                         (assoc-ref %build-inputs "sendmail"))))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (setenv "PATH" (string-join (list (getenv "PATH") (getcwd)) ":"))
+                (invoke "./testbench.sh")))))))
+    (inputs
+      `(("gzip" ,gzip)
+        ("sendmail" ,sendmail)))
+    (synopsis "UNIX task queue system")
+    (description "Task spooler let users run shell commands asynchronously
+one after the other in a separate process.")
+    (home-page "https://vicerveza.homeunix.net/~viric/soft/ts/")
+    (license license:gpl2+)))
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#49685; Package guix-patches. (Wed, 21 Jul 2021 19:01:01 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Ivan Gankevich <i.gankevich <at> spbu.ru>, 49685 <at> debbugs.gnu.org
Subject: Re: [bug#49685] [PATCH] gnu: Add task-spooler.
Date: Wed, 21 Jul 2021 21:00:26 +0200
[Message part 1 (text/plain, inline)]
Ivan Gankevich schreef op wo 21-07-2021 om 21:35 [+0300]:
> +(define-public task-spooler
> +  (package
> +    (name "task-spooler")
> +    (version "1.0.1")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (string-append
> +               "https://vicerveza.homeunix.net/~viric/soft/ts/ts-" version ".tar.gz"))
> +        (sha256 (base32 "0y32sm2i2jxs88c307h76449fynk75p9qfw1k11l5ixrn03z67pl"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +      `(#:make-flags
> +        (let ((c-flags "-g -O2"))
> +          (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
> +                "CC=gcc"

This shoul be ,(string-append "CC=" (cc-for-target)), such that the cross-compiler
is used when cross-compililng.

> +                (string-append "CFLAGS=" c-flags)
> +                (string-append "LDFLAGS=" c-flags)))

Why are you adding "-g -O2" to LDFLAGS? I understand adding it to CFLAGS,
but I don't see why it would be added to CFLAGS.

> +        #:phases
> +        (modify-phases %standard-phases
> +          (delete 'configure) ;; no configuration script
> +          (add-after 'unpack 'rename-and-patch-paths
> +            (lambda _
> +              ;; 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\"" (which "gzip"))))

This needs to be (search-input-file "bin/gzip") instead of (which "gzip")
for cross-compilation purposes ('which' searches for a native "gzip" in $PATH)
'search-input-file' is not yet defined on 'master' (it's only on 'core-updates'
currently), so you could do something like

  (string-append (assoc-ref inputs "gzip") "/bin/gzip")

> +              (substitute* "list.c"
> +                (("/bin/sh\\b") (which "sh")))

Ditto (and you need to add "bash-minimal" to "inputs").

> +              (substitute* "env.c"
> +                (("execlp\\(\"/bin/sh\"") (format #f "execlp(\"~a\"" (which "sh"))))

Ditto.

> +              (substitute* "mail.c"
> +                (("execl\\(\"/usr/sbin/sendmail\"")
> +                 (format #f "execl(\"~a/usr/sbin/sendmail\""
> +                         (assoc-ref %build-inputs "sendmail"))))))

If you fix 'sendemail' to install things in "sbin" instead of
"usr/sbin", then you can do (search-input-file inputs "bin/sendmail").

> +          (replace 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (setenv "PATH" (string-join (list (getenv "PATH") (getcwd)) ":"))

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#49685; Package guix-patches. (Fri, 23 Jul 2021 18:20:02 GMT) Full text and rfc822 format available.

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

From: Ivan Gankevich <i.gankevich <at> spbu.ru>
To: 49685 <at> debbugs.gnu.org
Cc: Ivan Gankevich <i.gankevich <at> spbu.ru>
Subject: [PATCH] gnu: sendmail: Install executables to $prefix/sbin and
 $prefix/bin directories.
Date: Fri, 23 Jul 2021 21:15:39 +0300
Currently "sendmail" installs executables to $PREFIX/usr/sbin and
$PREFIX/usr/bin directories. This patch changes them to $PREFIX/sbin and
$PREFIX/bin respectively. Also this patch fixes broken symlinks in
$PREFIX/bin and updates package definitions that use old sendmail paths.

* gnu/packages/mail.scm (sendmail): Set new paths.
 [arguments]<#:phases>{replace-/usr}: Remove /usr prefix.
 [arguments]<#:phases>{post-install}: Fix broken symlinks
 [arguments]<#:phases>{configure}: Set paths without /usr prefix.
* gnu/packages/mail.scm (claws-mail): Use new sendmail paths.
* gnu/packages/version-control.scm (python-git-multimail): Use new
  sendmail paths.
---
 gnu/packages/mail.scm            | 28 ++++++++++++++++++++++++----
 gnu/packages/version-control.scm |  2 +-
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index f0f1540cc9..a76a56694c 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1635,7 +1635,7 @@ compresses it.")
              (let* ((mailutils (assoc-ref inputs "mailutils"))
                     (inc (string-append mailutils "/bin/mu-mh/inc"))
                     (send-mail (assoc-ref inputs "sendmail"))
-                    (sendmail (string-append send-mail "/usr/sbin/sendmail")))
+                    (sendmail (string-append send-mail "/sbin/sendmail")))
                (substitute* "src/common/defs.h"
                  (("/usr/bin/mh/inc") inc)
                  (("/usr/sbin/sendmail") sendmail)))))
@@ -2881,6 +2881,13 @@ powerful user customization features.")
              (substitute* "devtools/bin/Build"
                (("SHELL=/bin/sh") (string-append "SHELL=" (which "sh"))))
              #t))
+         (add-before 'build 'replace-/usr
+           (lambda _
+             (substitute*
+               '("devtools/OS/Linux"
+                 "cf/ostype/mklinux.m4"
+                 "cf/ostype/linux.m4")
+               (("/usr/sbin") "/sbin"))))
          (replace 'configure
            (lambda _
 
@@ -2892,6 +2899,11 @@ powerful user customization features.")
              (with-output-to-file "devtools/Site/site.config.m4"
                (lambda ()
                  (format #t "
+define(`confEBINDIR', `/sbin')
+define(`confSBINDIR', `/sbin')
+define(`confMBINDIR', `/sbin')
+define(`confUBINDIR', `/bin')
+define(`confLINKS', `')
 define(`confCC', `gcc')
 define(`confOPTIMIZE', `-g -O2')
 define(`confLIBS', `-lresolv')
@@ -2910,13 +2922,21 @@ define(`confINST_DEP', `')
          (add-before 'install 'pre-install
            (lambda _
              (let ((out (assoc-ref %outputs "out")))
-               (mkdir-p (string-append out "/usr/bin"))
-               (mkdir-p (string-append out "/usr/sbin"))
+               (mkdir-p (string-append out "/bin"))
+               (mkdir-p (string-append out "/sbin"))
                (mkdir-p (string-append out "/etc/mail"))
                (setenv "DESTDIR" out)
                (with-directory-excursion "cf/cf"
                  (invoke "sh" "Build" "install-cf"))
-               #t))))
+               #t)))
+         (add-after 'install 'post-install
+           (lambda _
+               ;; Make symbolic links manually, because build script uses
+               ;; absolute paths for them and ignores DESTDIR.
+               (for-each
+                 (lambda (name)
+                   (symlink "../sbin/sendmail" (string-append %output "/bin/" name)))
+                 '("hoststat" "newaliases" "mailq" "purgestat")))))
        ;; There is no make check.  There are some post installation tests, but those
        ;; require root privileges
        #:tests? #f))
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 7c1dbe8b26..814a87904e 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1036,7 +1036,7 @@ a built-in cache to decrease server I/O pressure.")
                                "'"))
                (("/usr/sbin/sendmail")
                 (string-append (assoc-ref inputs "sendmail")
-                               "/usr/sbin/sendmail")))
+                               "/sbin/sendmail")))
              #t)))))
     (inputs
      `(("git" ,git)
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#49685; Package guix-patches. (Fri, 23 Jul 2021 18:20:02 GMT) Full text and rfc822 format available.

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

From: Ivan Gankevich <i.gankevich <at> spbu.ru>
To: 49685 <at> debbugs.gnu.org
Cc: Ivan Gankevich <i.gankevich <at> spbu.ru>
Subject: [PATCH] gnu: Add task-spooler.
Date: Fri, 23 Jul 2021 21:19:03 +0300
* gnu/packages/task-runners.scm (task-spooler): New variable.
---
 gnu/packages/task-runners.scm | 64 +++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/gnu/packages/task-runners.scm b/gnu/packages/task-runners.scm
index 49a07fa3bd..237a6ec1b6 100644
--- a/gnu/packages/task-runners.scm
+++ b/gnu/packages/task-runners.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Stefan Reichör <stefan <at> xsteve.at>
+;;; Copyright © 2021 Ivan Gankevich <i.gankevich <at> spbu.ru>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,8 +20,14 @@
 (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)
+  #:use-module (gnu packages mail)
+  #:use-module (guix build-system gnu)
   #:use-module (guix build-system go))
 
 (define-public run
@@ -47,3 +54,60 @@
 using a Runfile.")
     (home-page "https://github.com/TekWizely/run")
     (license license:expat)))
+
+(define-public task-spooler
+  (package
+    (name "task-spooler")
+    (version "1.0.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "https://vicerveza.homeunix.net/~viric/soft/ts/ts-" version ".tar.gz"))
+        (sha256 (base32 "0y32sm2i2jxs88c307h76449fynk75p9qfw1k11l5ixrn03z67pl"))))
+    (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))
+                (string-append "CFLAGS=" c-flags)))
+        #:phases
+        (modify-phases %standard-phases
+          (delete 'configure) ;; no configuration script
+          (add-after 'unpack 'rename-and-patch-paths
+            (lambda _
+              ;; 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* "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"))))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (setenv "PATH" (string-join (list (getenv "PATH") (getcwd)) ":"))
+                (invoke "./testbench.sh")))))))
+    (inputs
+      `(("bash" ,bash-minimal)
+        ("gzip" ,gzip)
+        ("sendmail" ,sendmail)))
+    (synopsis "UNIX task queue system")
+    (description "Task spooler let users run shell commands asynchronously
+one after the other in a separate process.")
+    (home-page "https://vicerveza.homeunix.net/~viric/soft/ts/")
+    (license license:gpl2+)))
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#49685; Package guix-patches. (Fri, 23 Jul 2021 18:23:01 GMT) Full text and rfc822 format available.

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

From: Ivan Gankevich <i.gankevich <at> spbu.ru>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 49685 <at> debbugs.gnu.org
Subject: Re: [bug#49685] [PATCH] gnu: Add task-spooler.
Date: Fri, 23 Jul 2021 21:22:52 +0300
>> +    (arguments
>> +      `(#:make-flags
>> +        (let ((c-flags "-g -O2"))
>> +          (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
>> +                "CC=gcc"
>
>This shoul be ,(string-append "CC=" (cc-for-target)), such that the cross-compiler
>is used when cross-compililng.

Fixed!


>> +                (string-append "CFLAGS=" c-flags)
>> +                (string-append "LDFLAGS=" c-flags)))
>
>Why are you adding "-g -O2" to LDFLAGS? I understand adding it to CFLAGS,
>but I don't see why it would be added to CFLAGS.

You’re right. Removed LDFLAGS.


>> +              ;; Patch gzip/sendmail/shell paths.
>> +              (substitute* "execute.c"
>> +                (("execlp\\(\"gzip\"") (format #f "execlp(\"~a\"" (which "gzip"))))
>
>This needs to be (search-input-file "bin/gzip") instead of (which "gzip")
>for cross-compilation purposes ('which' searches for a native "gzip" in $PATH)
>'search-input-file' is not yet defined on 'master' (it's only on 'core-updates'
>currently), so you could do something like
>
>  (string-append (assoc-ref inputs "gzip") "/bin/gzip")

Changed “which” to “string-append” here and everywhere else.


>If you fix 'sendemail' to install things in "sbin" instead of
>"usr/sbin", then you can do (search-input-file inputs "bin/sendmail").

I’ve sent a separate patch that fixes /sbin and /bin directories for “sendmail”.

Thank you for the review, Maxime!




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 10 Aug 2021 15:21:01 GMT) Full text and rfc822 format available.

Notification sent to Ivan Gankevich <i.gankevich <at> spbu.ru>:
bug acknowledged by developer. (Tue, 10 Aug 2021 15:21:01 GMT) Full text and rfc822 format available.

Message #22 received at 49685-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Ivan Gankevich <i.gankevich <at> spbu.ru>
Cc: 49685-done <at> debbugs.gnu.org
Subject: Re: bug#49685: [PATCH] gnu: Add task-spooler.
Date: Tue, 10 Aug 2021 17:20:40 +0200
Hi,

Ivan Gankevich <i.gankevich <at> spbu.ru> skribis:

> Currently "sendmail" installs executables to $PREFIX/usr/sbin and
> $PREFIX/usr/bin directories. This patch changes them to $PREFIX/sbin and
> $PREFIX/bin respectively. Also this patch fixes broken symlinks in
> $PREFIX/bin and updates package definitions that use old sendmail paths.
>
> * gnu/packages/mail.scm (sendmail): Set new paths.
>  [arguments]<#:phases>{replace-/usr}: Remove /usr prefix.
>  [arguments]<#:phases>{post-install}: Fix broken symlinks
>  [arguments]<#:phases>{configure}: Set paths without /usr prefix.
> * gnu/packages/mail.scm (claws-mail): Use new sendmail paths.
> * gnu/packages/version-control.scm (python-git-multimail): Use new
>   sendmail paths.

That’s a much welcome change!  Applied.

> * gnu/packages/task-runners.scm (task-spooler): New variable.

Applied as well.

Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Sep 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 224 days ago.

Previous Next


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