diff options
| author | Oleg Pykhalov <go.wigust@gmail.com> | 2020-06-07 20:58:27 +0300 |
|---|---|---|
| committer | Oleg Pykhalov <go.wigust@gmail.com> | 2020-06-29 10:39:38 +0300 |
| commit | 5a88d3dfcb382a9256e5b6d18f1487b597260944 (patch) | |
| tree | 66d9de747b90cfc4da11326be217c13cfa0112b7 | |
| parent | d282a82cabdbd9fbdd829a749d06c704f9d9925c (diff) | |
gnu: Add bats.
* gnu/packages/bash.scm (bats): New variable.
| -rw-r--r-- | gnu/packages/bash.scm | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm index 3ba8a13e408..b331676f7ab 100644 --- a/gnu/packages/bash.scm +++ b/gnu/packages/bash.scm | |||
| @@ -24,11 +24,13 @@ | |||
| 24 | (define-module (gnu packages bash) | 24 | (define-module (gnu packages bash) |
| 25 | #:use-module (guix licenses) | 25 | #:use-module (guix licenses) |
| 26 | #:use-module (gnu packages) | 26 | #:use-module (gnu packages) |
| 27 | #:use-module (gnu packages base) | ||
| 27 | #:use-module (gnu packages bootstrap) | 28 | #:use-module (gnu packages bootstrap) |
| 28 | #:use-module (gnu packages ncurses) | 29 | #:use-module (gnu packages ncurses) |
| 29 | #:use-module (gnu packages readline) | 30 | #:use-module (gnu packages readline) |
| 30 | #:use-module (gnu packages bison) | 31 | #:use-module (gnu packages bison) |
| 31 | #:use-module (gnu packages linux) | 32 | #:use-module (gnu packages linux) |
| 33 | #:use-module (gnu packages guile) | ||
| 32 | #:use-module (guix packages) | 34 | #:use-module (guix packages) |
| 33 | #:use-module (guix download) | 35 | #:use-module (guix download) |
| 34 | #:use-module (guix git-download) | 36 | #:use-module (guix git-download) |
| @@ -37,6 +39,7 @@ | |||
| 37 | #:use-module (guix monads) | 39 | #:use-module (guix monads) |
| 38 | #:use-module (guix store) | 40 | #:use-module (guix store) |
| 39 | #:use-module (guix build-system gnu) | 41 | #:use-module (guix build-system gnu) |
| 42 | #:use-module (guix build-system trivial) | ||
| 40 | #:autoload (guix gnupg) (gnupg-verify*) | 43 | #:autoload (guix gnupg) (gnupg-verify*) |
| 41 | #:autoload (guix base32) (bytevector->nix-base32-string) | 44 | #:autoload (guix base32) (bytevector->nix-base32-string) |
| 42 | 45 | ||
| @@ -362,3 +365,52 @@ for Bash shell scripts and functions. Along with the Test::More-style testing | |||
| 362 | helpers it provides helper functions for mocking commands and in-process output | 365 | helpers it provides helper functions for mocking commands and in-process output |
| 363 | capturing.") | 366 | capturing.") |
| 364 | (license expat))) | 367 | (license expat))) |
| 368 | |||
| 369 | (define-public bats | ||
| 370 | (package | ||
| 371 | (name "bats") | ||
| 372 | (version "1.2.0") | ||
| 373 | (source (origin | ||
| 374 | (method git-fetch) | ||
| 375 | (uri (git-reference | ||
| 376 | (url "https://github.com/bats-core/bats-core.git") | ||
| 377 | (commit (string-append "v" version)))) | ||
| 378 | (file-name (git-file-name name version)) | ||
| 379 | (sha256 | ||
| 380 | (base32 | ||
| 381 | "0f59zh4d4pa1a7ybs5zl6h0csbqqv11lbnq0jl1dgwm1s6p49bsq")))) | ||
| 382 | (inputs | ||
| 383 | `(("bash" ,bash) | ||
| 384 | ("coreutils" ,coreutils) | ||
| 385 | ("guile" ,guile-3.0) ;for wrap-script | ||
| 386 | ("grep" ,grep))) | ||
| 387 | (arguments | ||
| 388 | `(#:modules ((guix build utils)) | ||
| 389 | #:builder | ||
| 390 | (begin | ||
| 391 | (use-modules (guix build utils)) | ||
| 392 | (copy-recursively (assoc-ref %build-inputs "source") ".") | ||
| 393 | (setenv "PATH" | ||
| 394 | (string-append (assoc-ref %build-inputs "bash") "/bin" | ||
| 395 | ":" (assoc-ref %build-inputs "coreutils") "/bin" | ||
| 396 | ":" (assoc-ref %build-inputs "grep") "/bin" | ||
| 397 | ":" (assoc-ref %build-inputs "guile") "/bin" | ||
| 398 | ":" (getenv "PATH"))) | ||
| 399 | (for-each (lambda (file) (patch-shebang file)) (find-files ".")) | ||
| 400 | (substitute* "bin/bats" | ||
| 401 | (("export BATS_ROOT" line) | ||
| 402 | (string-append "BATS_ROOT=\"${BATS_ROOT:-" %output "/libexec/bats-core}\"\n" | ||
| 403 | line))) | ||
| 404 | ;; Install phase | ||
| 405 | (invoke "./install.sh" %output) | ||
| 406 | (wrap-script (string-append %output "/bin/bats") | ||
| 407 | (list "PATH" 'prefix (string-split (getenv "PATH") | ||
| 408 | #\:)))))) | ||
| 409 | (build-system trivial-build-system) | ||
| 410 | (home-page "https://github.com/bats-core/bats-core/") | ||
| 411 | (synopsis "Bash Automated Testing System") | ||
| 412 | (description "Bats is a TAP-compliant testing framework for Bash. It | ||
| 413 | provides a simple way to verify that the UNIX programs you write behave as | ||
| 414 | expected. Bats is most useful when testing software written in Bash, but you | ||
| 415 | can use it to test any UNIX program.") | ||
| 416 | (license expat))) | ||
