Message ID | 20210721183504.9388-1-i.gankevich@spbu.ru |
---|---|
State | Accepted |
Headers | show |
Series | [bug#49685] gnu: Add task-spooler. | expand |
Context | Check | Description |
---|---|---|
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
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.
>> + (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!
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@xsteve.at> +;;; Copyright © 2021 Ivan Gankevich <i.gankevich@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+)))