projects/guix·blob master · refs

640 lines · 26.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2017, 2019-2020, 2022, 2023 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014, 2015, 2018 Mark H Weaver <[email protected]>
4;;; Copyright © 2015, 2017 Leo Famulari <[email protected]>
5;;; Copyright © 2016, 2017, 2018, 2019, 2022 Efraim Flashner <[email protected]>
6;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
8;;; Copyright © 2020 Zhu Zihao <[email protected]>
9;;; Copyright © 2021 Marius Bakke <[email protected]>
10;;; Copyright © 2024 Oleg Pykhalov <[email protected]>
11;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
12;;; Copyright © 2024 chris <[email protected]>
13;;; Copyright © 2025 Maxim Cournoyer <[email protected]>
14;;; Copyright © 2026 Artyom V. Poptsov <[email protected]>
15;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages bash)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages bootstrap)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages elf)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages readline)
41 #:use-module (gnu packages ruby-check)
42 #:use-module (gnu packages ruby-xyz)
43 #:use-module (gnu packages bison)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages libffi)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages guile)
48 #:use-module (gnu packages version-control)
49 #:use-module (gnu packages less)
50 #:use-module (guix packages)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module (guix utils)
54 #:use-module (guix gexp)
55 #:use-module (guix monads)
56 #:use-module (guix store)
57 #:use-module (guix build-system copy)
58 #:use-module (guix build-system gnu)
59 #:use-module (guix build-system ruby)
60 #:use-module (guix build-system trivial)
61 #:autoload (guix gnupg) (gnupg-verify*)
62 #:autoload (guix base32) (bytevector->nix-base32-string)
63
64 ;; See <https://bugs.gnu.org/41457> for why not #:autoload here.
65 #:use-module ((gcrypt hash) #:select (port-sha256))
66
67 #:use-module (srfi srfi-1)
68 #:use-module (srfi srfi-26)
69 #:use-module (ice-9 format))
70
71(define (patch-url seqno)
72 "Return the URL of Bash patch number SEQNO."
73 (format #f "mirror://gnu/bash/bash-5.2-patches/bash52-~3,'0d" seqno))
74
75(define (bash-patch seqno sha256-bv)
76 "Return the origin of Bash patch SEQNO, with expected hash SHA256-BV."
77 (origin
78 (method url-fetch)
79 (uri (patch-url seqno))
80 (sha256 sha256-bv)))
81
82(define-syntax-rule (patch-series (seqno hash) ...)
83 (list (bash-patch seqno (base32 hash))
84 ...))
85
86(define %patch-series-5.2
87 ;; This is the current patches series for 5.2, generated using
88 ;; 'download-patches' below.
89 (patch-series
90 (1 "02iibpd3jq8p1bhdzgik8ps6gi1145vr463a82gj1hivjbp2ybzl")
91 (2 "1f6p1z85qh1lavdp3xikgp0bfv0vqhvgpgwmdzlywl35hwdmxk25")
92 (3 "1zxsi869jd90hksx3nyypgyqwrxhw2ws3r6hmk76yc1lsgdhq2ba")
93 (4 "04i5liw5cg6dqkdxfgazqc2jrw40bmclx3dx45bwy259pcj7g0iq")
94 (5 "0mykflv9qnbx3jz71l4f7isadiw9knm4qimqkwsv9cv88dafpq7c")
95 (6 "13265akl8w6zyrg0l7f0x6arjgqjhllcwl6lk46rl53x4mm5dq6i")
96 (7 "146lrwkn5wgxzs6vx34wl47g69zsxdy032k40qzi626b47ya6015")
97 (8 "1s5i8hcayrv25lc8fxcr431v634yx5sii53b8fmip789s0pxjjvb")
98 (9 "1kfk25151ka9wkmk1myf12irgcmvhsd8b0nfifvhrszah9w82npr")
99 (10 "1kf1jrwm30js0v3d1r2rk4x09s1pyjp70wnd1qqhf9bmkw15ww67")
100 (11 "1x5nkvbj6hci7gx42q7qa72hg2a9wwxh85dk79gn521ypwjmy6w3")
101 (12 "0b6lcwzm7v5bzjiwaz2c8n5aj77w8ckhp2vwk4v3zsdq3z70gc9g")
102 (13 "1rkwpibd6j2ghppfhqsva2jm4kdni6b7jpdsxdps52643gc4yjq9")
103 (14 "09766vqqw4ffnmysm725v35qkhp1g9j4qgqag941xvq655pj9y9y")
104 (15 "12im449abnq5gaqjmdxr5i38kmp02fa8l8wffad3jryvd58r0wzg")
105 (16 "05arb0hzmng03cr357lf6p8af0x2a1pznsd3psll03nibfy56n0m")
106 (17 "129cvx4gfz8n23iw1lhbknbw86fyw6vh60jqj1wj3d5pr75wwj0w")
107 (18 "105am94qxjc27gga4a8asvsi01090xwjfim3s16lafwjvm4xsha6")
108 (19 "10njgv5mrc5rhsp5lvxcbm0pnzn59a8spi2nhdasifyl1a32cp1j")
109 (20 "07f0wlmqjdfarp44w3gj9gdqbqm5x20rvlhpn34ngklmxcm2bz5n")
110 (21 "1kahfqqalcwi4m73pg3ssz6lh0kcqsqax09myac7a15d2y0vhd43")
111 (22 "0w74aym0g1fh48864a3qxh89f26iaq7wsbg7244c6kjr94527dbq")
112 (23 "1lywjqbc36j5pdzfcvnz1zy30j76aqmsm190p888av0hw815b45g")
113 (24 "1hq23djqbr7s9y2324jq9mxr5bwdkmgizn3zgpchbsqp054k85cp")
114 (25 "0x9hc4silzl4d3zw4p43i5dm7w86k50j47f87lracwfgwy3z8f2i")
115 (26 "1b1fhm1dsi67r8ip17s0xvx2qq31fsxc1g9n3r931dd0k9a1zvln")
116 (27 "0fdbhvs9dkf4knncifh98a76q4gylhyvfrffq5p9q3ag5q58jap1")
117 (28 "1hdacd6sssjshmry1sscdnxxfb2r51bvdyghlfjaqgc9l85phhk0")
118 (29 "11wrlb20w6v89b96krg0gwxipwhvrda6rq1y9f972m32gsrsqp0j")
119 (30 "13v9fqgim082dmvkslsr0hs793yzhsij2s91mjswsfhj1qip7zy3")
120 (31 "15d7rddj6spwc1fy997lxx6zvzq0zbxgf2h20mhi4wgp5nzbglf2")
121 (32 "05ia6yf32hjprmyyxqawhgckxs3684ikfx8xg08zfgx9xkd7g73v")
122 (33 "1qm2aad9mf2xah6xwchga7s5pk3v308mrv9lgh50d65d236ccgh1")
123 (34 "0bi38dhkkwpm2qrzp8zpykglq6gibvv2n9f8m59gwj406cxvp7w9")
124 (35 "1r8k34y82v02yfkgws17j7i53ybb74dqnwl2jjiv0av9z93hl6l2")
125 (36 "0mwhr9hfbh2czf8klbxg6nbd2g9xl9kygvgk061vird56r4kzj8m")
126 (37 "156sbi3srzkyxajkmhb7iigq0j4nvwnpsbw88xdsxn95a4xiqb4a")))
127
128(define (download-patches store count)
129 "Download COUNT Bash patches into store. Return a list of
130number/base32-hash tuples, directly usable in the 'patch-series' form."
131 (unfold (cut > <> count)
132 (lambda (number)
133 (let* ((patch (download-to-store store (patch-url number)))
134 (sig (download-to-store store
135 (string-append (patch-url number)
136 ".sig"))))
137 (unless (eq? 'valid-signature (gnupg-verify* sig patch))
138 (error "failed to verify signature" patch))
139
140 (list number
141 (bytevector->nix-base32-string
142 (call-with-input-file patch port-sha256)))))
143 1+
144 1))
145
146(define-public bash
147 (let* ((cppflags (string-join '("-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
148 "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
149 "-DNON_INTERACTIVE_LOGIN_SHELLS"
150 "-DSSH_SOURCE_BASHRC"
151 "-DSYS_BASHRC='\"/etc/bashrc\"'")
152 " "))
153 (configure-flags
154 ``("--without-bash-malloc"
155 "--with-installed-readline"
156 ,,(string-append "CPPFLAGS=" cppflags)
157 ,(string-append
158 "LDFLAGS=-Wl,-rpath -Wl,"
159 (assoc-ref %build-inputs "readline")
160 "/lib"
161 " -Wl,-rpath -Wl,"
162 (assoc-ref %build-inputs "ncurses")
163 "/lib")))
164 (version "5.2"))
165 (package
166 (name "bash")
167 (source (origin
168 (method url-fetch)
169 (uri (string-append
170 "mirror://gnu/bash/bash-" version ".tar.gz"))
171 (sha256
172 (base32
173 "1yrjmf0mqg2q8pqphjlark0mcmgf88b0acq7bqf4gx3zvxkc2fd1"))
174 (patch-flags '("-p0"))
175 (patches (cons (search-patch "bash-linux-pgrp-pipe.patch")
176 %patch-series-5.2))))
177 (version (string-append version "." (number->string (length %patch-series-5.2))))
178 (build-system gnu-build-system)
179
180 (outputs '("out"
181 "doc" ;1.7 MiB of HTML and extra files
182 "include")) ;headers used by extensions
183 (native-inputs (if (target-loongarch64?)
184 (list config)
185 '()))
186 (inputs (list readline ncurses)) ;TODO: add texinfo
187 (arguments
188 `( ;; When cross-compiling, `configure' incorrectly guesses that job
189 ;; control is missing.
190 #:configure-flags ,(if (%current-target-system)
191 `(cons* "bash_cv_job_control_missing=no"
192 ,configure-flags)
193 configure-flags)
194
195 ;; Bash is reportedly not parallel-safe. See, for instance,
196 ;; <http://patches.openembedded.org/patch/32745/> and
197 ;; <http://git.buildroot.net/buildroot/commit/?h=79e2d802a>.
198 #:parallel-build? #f
199 #:parallel-tests? #f
200
201 ;; XXX: The tests have a lot of hard-coded paths, so disable them
202 ;; for now.
203 #:tests? #f
204
205 #:modules ((srfi srfi-26)
206 (guix build utils)
207 (guix build gnu-build-system))
208
209 #:phases
210 (modify-phases %standard-phases
211 ,@(if (and (target-hurd?) (not (system-hurd?)))
212 `((add-after 'configure 'create-pipesize.h
213 ;; The Bash Makefile mentions how PIPESIZE calculation is
214 ;; "technically wrong" when cross-compiling, and offers no
215 ;; way to override it. On the 64bit Hurd, it can make
216 ;; bash hang.
217 (lambda _
218 (with-directory-excursion "builtins"
219 (with-output-to-file "psize.aux"
220 (lambda _ (display "dummy to pacify make\n")))
221 (with-output-to-file "pipesize.h"
222 (lambda _ (display "#define PIPESIZE 16384\n")))))))
223 '())
224
225 (add-after 'install 'install-sh-symlink
226 (lambda* (#:key outputs #:allow-other-keys)
227 ;; Add a `sh' -> `bash' link.
228 (let ((out (assoc-ref outputs "out")))
229 (with-directory-excursion (string-append out "/bin")
230 (symlink "bash" "sh")
231 #t))))
232
233 (add-after 'install 'move-development-files
234 (lambda* (#:key outputs #:allow-other-keys)
235 ;; Move 'Makefile.inc' and 'bash.pc' to "include" to avoid
236 ;; circular references among the outputs.
237 (let ((out (assoc-ref outputs "out"))
238 (include (assoc-ref outputs "include"))
239 (lib (cut string-append <> "/lib/bash")))
240 (mkdir-p (lib include))
241 (rename-file (string-append (lib out)
242 "/Makefile.inc")
243 (string-append (lib include)
244 "/Makefile.inc"))
245 (rename-file (string-append out "/lib/pkgconfig")
246 (string-append include
247 "/lib/pkgconfig"))
248
249 ;; Don't capture the absolute file name of 'install' to avoid
250 ;; retaining a dependency on Coreutils.
251 (substitute* (string-append (lib include)
252 "/Makefile.inc")
253 (("^INSTALL =.*")
254 "INSTALL = install -c\n"))
255 #t)))
256 ,@(if (target-loongarch64?)
257 `((add-after 'unpack 'update-config-scripts
258 (lambda* (#:key inputs native-inputs #:allow-other-keys)
259 ;; Replace outdated config.guess and config.sub.
260 (for-each (lambda (file)
261 (install-file
262 (search-input-file
263 (or native-inputs inputs)
264 (string-append "/bin/" file)) "./support"))
265 '("config.guess" "config.sub")))))
266 '()))))
267
268 (native-search-paths
269 (list (search-path-specification ;new in 4.4
270 (variable "BASH_LOADABLES_PATH")
271 (files '("lib/bash")))))
272
273 (synopsis "The GNU Bourne-Again SHell")
274 (description
275 "Bash is the shell, or command-line interpreter, of the GNU system. It
276is compatible with the Bourne Shell, but it also integrates useful features
277from the Korn Shell and the C Shell and new improvements of its own. It
278allows command-line editing, unlimited command history, shell functions and
279aliases, and job control while still allowing most sh scripts to be run
280without modification.")
281 (license license:gpl3+)
282 (home-page "https://www.gnu.org/software/bash/"))))
283
284(define-public bash-minimal
285 ;; A stripped-down Bash for non-interactive use.
286 (package/inherit bash
287 (name "bash-minimal")
288 (inputs '()) ; no readline, no curses
289
290 ;; No "include" output because there's no support for loadable modules.
291 (outputs (delete "include" (package-outputs bash)))
292
293 (arguments
294 (substitute-keyword-arguments arguments
295 ((#:modules _ '())
296 '((guix build gnu-build-system)
297 (guix build utils)
298 (srfi srfi-1)
299 (srfi srfi-26)))
300 ((#:configure-flags flags '())
301 `(list "CFLAGS=-g -O2 -Wno-error=implicit-function-declaration"
302 "--without-bash-malloc"
303 "--disable-readline"
304 "--disable-history"
305 "--disable-help-builtin"
306 "--disable-progcomp"
307 "--disable-net-redirections"
308 "--disable-nls"
309
310 ;; Pretend 'dlopen' is missing so we don't build loadable
311 ;; modules and related code.
312 "ac_cv_func_dlopen=no"
313
314 ,@(if (%current-target-system)
315 '("bash_cv_job_control_missing=no"
316 "bash_cv_getcwd_malloc=yes")
317 '())))
318 ((#:phases phases)
319 `(modify-phases ,phases
320 ;; No loadable modules.
321 (delete 'move-development-files)))))
322 (synopsis "The GNU Bourne-Again SHell, stripped down for non-interactive use")))
323
324(define-public static-bash
325 ;; Statically-linked Bash that contains nothing but the 'bash' binary and
326 ;; 'sh' symlink, without any reference.
327 (let ((bash (static-package bash-minimal)))
328 (package/inherit bash
329 (name "bash-static")
330 (arguments
331 (substitute-keyword-arguments
332 `(#:allowed-references ("out") ,@(package-arguments bash))
333 ((#:configure-flags flags '())
334 ;; XXX: when Update glibc from 2.40 to 2.41,
335 ;; need this flag to compile successfully.
336 ;; Otherwise, an error will be reported:
337 ;; multiple definition of `getenv'
338 (if (%current-target-system)
339 `(cons
340 "bash_cv_getenv_redef=no"
341 ,flags)
342 flags))
343 ((#:phases phases)
344 #~(modify-phases #$phases
345 (add-after 'strip 'remove-everything-but-the-binary
346 (lambda* (#:key outputs #:allow-other-keys)
347 (let* ((out (assoc-ref outputs "out"))
348 (bin (string-append out "/bin")))
349 (remove-store-references (string-append bin "/bash"))
350 (delete-file (string-append bin "/bashbug"))
351 (delete-file-recursively (string-append out "/share"))
352 #t))))))))))
353
354(define-public bash-with-syslog
355 (package/inherit bash
356 (name "bash-with-syslog")
357 (arguments
358 (substitute-keyword-arguments arguments
359 ((#:phases phases '%standard-phases)
360 `(modify-phases ,phases
361 (add-after 'unpack 'enable-syslogging
362 (lambda _
363 (substitute* "config-top.h"
364 (("/\\* #define SYSLOG_HISTORY \\*/")
365 "#define SYSLOG_HISTORY"))))))))
366 (description
367 "Bash is the shell, or command-line interpreter, of the GNU system. This
368variant logs the history to syslog.")))
369
370(define-public bash-completion
371 (package
372 (name "bash-completion")
373 (version "2.11")
374 (source (origin
375 (method url-fetch)
376 (uri (string-append
377 "https://github.com/scop/" name "/releases/download/"
378 version "/" name "-" version ".tar.xz"))
379 (sha256
380 (base32
381 "1b0iz7da1sgifx1a5wdyx1kxbzys53v0kyk8nhxfipllmm5qka3k"))
382 (patches
383 (search-patches "bash-completion-directories.patch"))))
384 (build-system gnu-build-system)
385 (arguments
386 `(#:tests? #f)) ; Unclear how to make tests pass.
387 (synopsis "Bash completions for common commands")
388 (description
389 "This package provides extensions that allow Bash to provide adapted
390completion for many common commands.")
391 (home-page "https://github.com/scop/bash-completion")
392 (license license:gpl2+)))
393
394(define-public bash-tap
395 (package
396 (name "bash-tap")
397 (version "1.0.2")
398 (source
399 (origin
400 (method git-fetch)
401 (uri (git-reference
402 (url "https://github.com/illusori/bash-tap")
403 (commit version)))
404 (file-name (git-file-name name version))
405 (sha256
406 (base32 "13zz9h6bhhnk3hiwhlpafrnf2isws249h3fz785dcgymk02arz9c"))))
407 ;; There is no compilation process to use this package, however, the bash
408 ;; scripts installed by this package start with "#!/bin/bash". To fix
409 ;; these lines, we use the patch-shebangs of the GNU build system. The
410 ;; project does not use a Makefile.
411 (build-system gnu-build-system)
412 (arguments
413 `(#:tests? #f ; There is no test suite.
414 #:phases
415 (modify-phases %standard-phases
416 ;; Because there are no configure scripts or Makefile, we can
417 ;; remove these phases.
418 (delete 'configure)
419 (delete 'build)
420 ;; The installation involves manually copying the files to a location.
421 ;; To make them easily accessible by setting PATH, we add the scripts
422 ;; to the "bin" folder.
423 (replace 'install
424 (lambda* (#:key outputs #:allow-other-keys)
425 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
426 (install-file "bash-tap" bin)
427 (install-file "bash-tap-bootstrap" bin)
428 (install-file "bash-tap-mock" bin)))))))
429 (home-page "https://www.illusori.co.uk/projects/bash-tap/")
430 (synopsis "Bash port of a Test::More/Test::Builder-style TAP-compliant
431test library")
432 (description "Bash TAP is a TAP-compliant Test::More-style testing library
433for Bash shell scripts and functions. Along with the Test::More-style testing
434helpers it provides helper functions for mocking commands and in-process output
435capturing.")
436 (license license:expat)))
437
438(define-public bats
439 (package
440 (name "bats")
441 (version "1.11.0")
442 (source (origin
443 (method git-fetch)
444 (uri (git-reference
445 (url "https://github.com/bats-core/bats-core")
446 (commit (string-append "v" version))))
447 (file-name (git-file-name name version))
448 (sha256
449 (base32
450 "1dmgxcqq87vs1l23hb7ghx319w2nvn0w8z2kdxggs2b8n22wi0c2"))))
451 (inputs
452 (list bash coreutils guile-3.0 ;for wrap-script
453 grep))
454 (arguments
455 `(#:modules ((guix build utils))
456 #:builder
457 (begin
458 (use-modules (guix build utils))
459 (copy-recursively (assoc-ref %build-inputs "source") ".")
460 (setenv "PATH"
461 (string-append (assoc-ref %build-inputs "bash") "/bin"
462 ":" (assoc-ref %build-inputs "coreutils") "/bin"
463 ":" (assoc-ref %build-inputs "grep") "/bin"
464 ":" (assoc-ref %build-inputs "guile") "/bin"
465 ":" (getenv "PATH")))
466 (for-each patch-shebang
467 (find-files "."
468 (lambda (file stat)
469 ;; Filter out symlinks.
470 (eq? 'regular (stat:type stat)))
471 #:stat lstat))
472 (substitute* "bin/bats"
473 (("export BATS_ROOT" line)
474 (string-append "BATS_ROOT=\"${BATS_ROOT:-" %output "/libexec/bats-core}\"\n"
475 line)))
476 ;; Install phase
477 (invoke "./install.sh" %output)
478 (wrap-script (string-append %output "/bin/bats")
479 #:guile (search-input-file %build-inputs "bin/guile")
480 (list "PATH" 'prefix (string-split (getenv "PATH")
481 #\:))))))
482 (build-system trivial-build-system)
483 (home-page "https://github.com/bats-core/bats-core/")
484 (synopsis "Bash Automated Testing System")
485 (description
486 "Bats is a @acronym{TAP, Test Anything Protocol}-compliant testing
487framework for Bash. It provides a simple way to verify that the UNIX programs
488you write behave as expected. Bats is most useful when testing software written
489in Bash, but you can use it to test any UNIX program.")
490 (license license:expat)))
491
492(define-public bash-ctypes
493 (let ((revision "0")
494 (commit "d8e1af5fdc1e1955f28eceec965b03e2538eea32"))
495 (package
496 (name "bash-ctypes")
497 (version (git-version "1.2" revision commit))
498 (source
499 (origin
500 (method git-fetch)
501 (uri (git-reference
502 (url "https://github.com/taviso/ctypes.sh")
503 (commit commit)))
504 (file-name (git-file-name name version))
505 (sha256
506 (base32 "1pw01azl4kbgqz4xwx2x64dqby30ba2khnn6wdd421x6hildyhm5"))))
507 (build-system gnu-build-system)
508 (arguments
509 (list #:phases
510 #~(modify-phases %standard-phases
511 (replace 'bootstrap
512 (lambda _
513 (substitute* "autogen.sh"
514 (("/bin/sh") (which "sh")))
515 (invoke "./autogen.sh"))))))
516 (inputs
517 (list elfutils
518 libelf
519 libffi
520 zlib
521 ;; Require a bash with C plugin support to build.
522 bash))
523 (native-inputs
524 (list autoconf automake libltdl libtool pkg-config))
525 (home-page "https://github.com/taviso/ctypes.sh")
526 (synopsis "Foreign function interface for Bash")
527 (description "Bash-ctypes is a Bash plugin that provides a foreign
528function interface (FFI) directly in your shell. In other words, it allows
529you to call routines in shared libraries from within Bash.")
530 (license license:expat))))
531
532(define-public bashly
533 (package
534 (name "bashly")
535 (version "1.3.5")
536 (source
537 (origin
538 (method url-fetch)
539 (uri (rubygems-uri "bashly" version))
540 (sha256
541 (base32 "17msjzca5ifx8biimdjps655w51yc82d5ys9hwn749bi2f3n8mcz"))))
542 (build-system ruby-build-system)
543 (arguments
544 (list
545 #:phases
546 #~(modify-phases %standard-phases
547 (replace 'check
548 (lambda* (#:key tests? #:allow-other-keys)
549 (when tests?
550 (invoke "rspec" "-c" "spec")))))))
551 (native-inputs (list ruby-rspec))
552 (propagated-inputs (list ruby-colsole
553 ruby-completely
554 ruby-filewatcher
555 ruby-gtx
556 ruby-logger
557 ruby-lp
558 ruby-mister-bin
559 ruby-ostruct
560 ruby-requires
561 ruby-tty-markdown))
562 (synopsis
563 "Create feature-rich Bash scrips using simple YAML configuration")
564 (description
565 "Bashly is a CLI for generating feature-rich Bash command line
566tools. Bashly lets you focus on your specific code, without worrying about
567command line argument parsing, usage texts, error messages and other functions
568that are usually handled by a framework in other programming languages.")
569 (home-page "https://bashly.dev/")
570 (license license:expat)))
571
572(define-public blesh
573 (package
574 (name "blesh")
575 (version "0.4.0-devel3")
576 (source (origin
577 (method git-fetch)
578 (uri (git-reference
579 (url "https://github.com/akinomyoga/ble.sh")
580 (commit (string-append "v" version))
581 (recursive? #t)))
582 (file-name (git-file-name name version))
583 (sha256
584 (base32
585 "19y9rmj9srl7akx33gl34l5qgz2ww0vlmi4j2r11029p8sn4s418"))))
586 (arguments
587 (list #:make-flags #~(list (string-append "PREFIX="
588 #$output))
589 #:phases #~(modify-phases %standard-phases
590 (add-after 'unpack 'pretend-.git-exists
591 (lambda _
592 (substitute* "ble.pp"
593 (("#%\\[commit_hash =.*")
594 (string-append "#%[commit_hash = " #$version "]\n")))
595 (mkdir-p ".git")))
596 (delete 'configure) ;no configure
597 (add-before 'check 'use-LANG-for-tests
598 (lambda _
599 (setenv "LANG"
600 (getenv "LC_ALL"))
601 (unsetenv "LC_ALL"))))))
602 (build-system gnu-build-system)
603 (native-inputs (list git less))
604 (home-page "https://github.com/akinomyoga/ble.sh")
605 (synopsis "Bash Line Editor")
606 (description
607 "Bash Line Editor (ble.sh) is a command line editor written in pure Bash
608which replaces the default GNU Readline. It adds syntax highlighting, auto
609suggestions, vim modes, and more to Bash interactive sessions.")
610 (license license:bsd-3)))
611
612(define-public bash-unit
613 (package
614 (name "bash-unit")
615 (version "2.3.3")
616 (home-page "https://github.com/pgrange/bash_unit")
617 (source
618 (origin
619 (method git-fetch)
620 (uri (git-reference
621 (url home-page)
622 (commit (string-append "v" version))))
623 (file-name (git-file-name name version))
624 (sha256
625 (base32 "0k48r1qdkwjg6fldh6akhyfkwl1jxhj8yjfggb1pas8pmdmjl5dr"))))
626 (build-system copy-build-system)
627 (arguments
628 `(#:install-plan '(("bash_unit" "bin/"))
629 #:phases (modify-phases %standard-phases
630 (add-before 'install 'check
631 (lambda* (#:key tests? #:allow-other-keys)
632 (when tests?
633 (invoke "./bash_unit" "tests/test_core.sh")))))))
634 (inputs (list bash-minimal))
635 (synopsis "Bash unit testing framework")
636 (description
637 "@command{bash_unit} allows you to write unit tests, run them and, in case
638of failure, display the stack trace with source file and line number indications
639to locate the problem.")
640 (license license:gpl3+)))