task-runners.scm 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2021 Stefan Reichör <stefan@xsteve.at>
  3. ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu packages task-runners)
  20. #:use-module ((guix licenses) #:prefix license:)
  21. #:use-module (guix packages)
  22. #:use-module (guix download)
  23. #:use-module (guix git-download)
  24. #:use-module (guix utils)
  25. #:use-module (gnu packages bash)
  26. #:use-module (gnu packages compression)
  27. #:use-module (gnu packages golang)
  28. #:use-module (gnu packages mail)
  29. #:use-module (guix build-system gnu)
  30. #:use-module (guix build-system go))
  31. (define-public run
  32. (package
  33. (name "run")
  34. (version "0.7.2")
  35. (source
  36. (origin
  37. (method git-fetch)
  38. (uri (git-reference
  39. (url "https://github.com/TekWizely/run")
  40. (commit (string-append "v" version))))
  41. (file-name (git-file-name name version))
  42. (sha256
  43. (base32 "17n11lqhywq4z62w2rakdq80v7mxf83rgln19vj4v4nxpwd2hjjw"))))
  44. (build-system go-build-system)
  45. (propagated-inputs
  46. `(("go-github-com-tekwizely-go-parsing" ,go-github-com-tekwizely-go-parsing)))
  47. (arguments
  48. `(#:import-path "github.com/tekwizely/run"))
  49. (synopsis "Easily manage and invoke small scripts and wrappers")
  50. (description
  51. "Run is a tool to easily manage and invoke small scripts and wrappers by
  52. using a Runfile.")
  53. (home-page "https://github.com/TekWizely/run")
  54. (license license:expat)))
  55. (define-public task-spooler
  56. (package
  57. (name "task-spooler")
  58. (version "1.0.1")
  59. (source
  60. (origin
  61. (method url-fetch)
  62. (uri (string-append
  63. "https://vicerveza.homeunix.net/~viric/soft/ts/ts-" version ".tar.gz"))
  64. (sha256 (base32 "0y32sm2i2jxs88c307h76449fynk75p9qfw1k11l5ixrn03z67pl"))))
  65. (build-system gnu-build-system)
  66. (arguments
  67. `(#:make-flags
  68. (let ((c-flags "-g -O2"))
  69. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  70. ,(string-append "CC=" (cc-for-target))
  71. (string-append "CFLAGS=" c-flags)))
  72. #:phases
  73. (modify-phases %standard-phases
  74. (delete 'configure) ;; no configuration script
  75. (add-after 'unpack 'rename-and-patch-paths
  76. (lambda _
  77. ;; Rename "ts" to "tsp" to not interfere with "ts" command
  78. ;; from moreutils package.
  79. (rename-file "ts.1" "tsp.1");
  80. (substitute* '("Makefile" "testbench.sh")
  81. (("\\bts\\b") "tsp"))
  82. ;; Patch gzip/sendmail/shell paths.
  83. (substitute* "execute.c"
  84. (("execlp\\(\"gzip\"")
  85. (format #f "execlp(\"~a/bin/gzip\""
  86. (assoc-ref %build-inputs "gzip"))))
  87. (substitute* "list.c"
  88. (("/bin/sh\\b") (which "sh")))
  89. (substitute* "env.c"
  90. (("execlp\\(\"/bin/sh\"")
  91. (format #f "execlp(\"~a/bin/sh\""
  92. (assoc-ref %build-inputs "bash"))))
  93. (substitute* "mail.c"
  94. (("execl\\(\"/usr/sbin/sendmail\"")
  95. (format #f "execl(\"~a/sbin/sendmail\""
  96. (assoc-ref %build-inputs "sendmail"))))))
  97. (replace 'check
  98. (lambda* (#:key tests? #:allow-other-keys)
  99. (when tests?
  100. (setenv "PATH" (string-join (list (getenv "PATH") (getcwd)) ":"))
  101. (invoke "./testbench.sh")))))))
  102. (inputs
  103. `(("bash" ,bash-minimal)
  104. ("gzip" ,gzip)
  105. ("sendmail" ,sendmail)))
  106. (synopsis "UNIX task queue system")
  107. (description "Task spooler lets users run shell commands asynchronously
  108. one after the other in a separate process.")
  109. (home-page "https://vicerveza.homeunix.net/~viric/soft/ts/")
  110. (license license:gpl2+)))