X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/0cf2b6f2dbcd299f7a4b7a563cf34ae5de154b15..e35383a76f0a1d1ba01f4b355d8df4ac341216b3:/gnu/packages/bash.scm diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm index d3abeec6e6..ed2931fd97 100644 --- a/gnu/packages/bash.scm +++ b/gnu/packages/bash.scm @@ -1,10 +1,11 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès ;;; Copyright © 2014, 2015, 2018 Mark H Weaver ;;; Copyright © 2015, 2017 Leo Famulari ;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner -;;; Copyright © 2018 Tobias Geerinckx-Rice +;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Zhu Zihao ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,23 +23,34 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages bash) - #:use-module (guix licenses) + #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bootstrap) + #:use-module (gnu packages compression) + #:use-module (gnu packages elf) #:use-module (gnu packages ncurses) #:use-module (gnu packages readline) #:use-module (gnu packages bison) #:use-module (gnu packages linux) + #:use-module (gnu packages libffi) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages guile) #:use-module (guix packages) #:use-module (guix download) + #:use-module (guix git-download) #:use-module (guix utils) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (guix store) #:use-module (guix build-system gnu) + #:use-module (guix build-system trivial) #:autoload (guix gnupg) (gnupg-verify*) - #:autoload (gcrypt hash) (port-sha256) #:autoload (guix base32) (bytevector->nix-base32-string) + + ;; See for why not #:autoload here. + #:use-module ((gcrypt hash) #:select (port-sha256)) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 format)) @@ -47,12 +59,12 @@ "Return the URL of Bash patch number SEQNO." (format #f "mirror://gnu/bash/bash-5.0-patches/bash50-~3,'0d" seqno)) -(define (bash-patch seqno sha256) - "Return the origin of Bash patch SEQNO, with expected hash SHA256" +(define (bash-patch seqno sha256-bv) + "Return the origin of Bash patch SEQNO, with expected hash SHA256-BV." (origin (method url-fetch) (uri (patch-url seqno)) - (sha256 sha256))) + (sha256 sha256-bv))) (define-syntax-rule (patch-series (seqno hash) ...) (list (bash-patch seqno (base32 hash)) @@ -68,7 +80,16 @@ (4 "021gqqvgydixkrmqss64b6srfdlkvnx88lyfzpxfrn5d6bc7li0l") (5 "0xl2kyzm84nlyklrqzkn73ixabhzfhn9x91lzcmis89cppclvxav") (6 "0844749ixk1z60437nkznzms1f0nzh9an62kj7sny6r0zyk2k1fn") - (7 "16xg37gp1b8zlj5969w8mcrparwqlcbj9695vn3qhgb7wdz1xd0p"))) + (7 "16xg37gp1b8zlj5969w8mcrparwqlcbj9695vn3qhgb7wdz1xd0p") + (8 "1qyp19krjh8zxvb0jgwmyjz40djslwcf4xi7kc1ab0iaca44bipf") + (9 "00yrjjqd95s81b21qq3ba1y7h879q8jaajlkjggc6grhcwbs4g7d") + (10 "04ca5bjv456v538mkspzvn4xb2zdphh31r4fpvfm9p5my0jw7yyn") + (11 "1sklyixvsv8993kxzs0jigacpdchjrq7jv5xpdx7kbqyp4rf6k9c") + (12 "0cz21qg2gbr40lfgza7g02bqi2qknwqgxnq459pjj640d0cywhr9") + (13 "16h9nwz3yzwj7fnxvlidjymdc4yr30h818433gh9j1x3in6igmzm") + (14 "12gm5bvv2pd3m72z2ilj26pa08c61az253dsgfl24vpf2ijywvjx") + (15 "0pm0px758w4i23s55wajcv6lqfiym7zgxvq0pxf6vclkv8nxy5x5") + (16 "0vdha332km2iwx8g2ld15jy7d24cbplzgr1531dpzylr9ajxglgz"))) (define (download-patches store count) "Download COUNT Bash patches into store. Return a list of @@ -79,7 +100,7 @@ number/base32-hash tuples, directly usable in the 'patch-series' form." (sig (download-to-store store (string-append (patch-url number) ".sig")))) - (unless (gnupg-verify* sig patch) + (unless (eq? 'valid-signature (gnupg-verify* sig patch)) (error "failed to verify signature" patch)) (list number @@ -115,7 +136,8 @@ number/base32-hash tuples, directly usable in the 'patch-series' form." (base32 "0kgvfwqdcd90waczf4gx39xnrxzijhjrzyzv7s8v4w31qqm0za5l")) (patch-flags '("-p0")) - (patches %patch-series-5.0))) + (patches (cons (search-patch "bash-linux-pgrp-pipe.patch") + %patch-series-5.0)))) (version (string-append version "." (number->string (length %patch-series-5.0)))) (build-system gnu-build-system) @@ -193,7 +215,7 @@ from the Korn Shell and the C Shell and new improvements of its own. It allows command-line editing, unlimited command history, shell functions and aliases, and job control while still allowing most sh scripts to be run without modification.") - (license gpl3+) + (license license:gpl3+) (home-page "https://www.gnu.org/software/bash/")))) (define-public bash-minimal @@ -303,20 +325,21 @@ without modification.") "This package provides extensions that allow Bash to provide adapted completion for many common commands.") (home-page "https://github.com/scop/bash-completion") - (license gpl2+))) + (license license:gpl2+))) (define-public bash-tap (package (name "bash-tap") (version "1.0.2") - (source (origin - (method url-fetch) - (uri (string-append "https://github.com/illusori/bash-tap/" - "archive/" version ".tar.gz")) - (file-name (string-append name "-" version ".tar.gz")) - (sha256 - (base32 - "0qs1qi38bl3ns4mpagcawv618dsk2q1lgrbddgvs0wl3ia12cyz5")))) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/illusori/bash-tap") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "13zz9h6bhhnk3hiwhlpafrnf2isws249h3fz785dcgymk02arz9c")))) ;; There is no compilation process to use this package, however, the bash ;; scripts installed by this package start with "#!/bin/bash". To fix ;; these lines, we use the patch-shebangs of the GNU build system. The @@ -339,11 +362,89 @@ completion for many common commands.") (install-file "bash-tap" bin) (install-file "bash-tap-bootstrap" bin) (install-file "bash-tap-mock" bin))))))) - (home-page "http://www.illusori.co.uk/projects/bash-tap/") + (home-page "https://www.illusori.co.uk/projects/bash-tap/") (synopsis "Bash port of a Test::More/Test::Builder-style TAP-compliant test library") (description "Bash TAP is a TAP-compliant Test::More-style testing library for Bash shell scripts and functions. Along with the Test::More-style testing helpers it provides helper functions for mocking commands and in-process output capturing.") - (license expat))) + (license license:expat))) + +(define-public bats + (package + (name "bats") + (version "1.2.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/bats-core/bats-core") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0f59zh4d4pa1a7ybs5zl6h0csbqqv11lbnq0jl1dgwm1s6p49bsq")))) + (inputs + `(("bash" ,bash) + ("coreutils" ,coreutils) + ("guile" ,guile-3.0) ;for wrap-script + ("grep" ,grep))) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (copy-recursively (assoc-ref %build-inputs "source") ".") + (setenv "PATH" + (string-append (assoc-ref %build-inputs "bash") "/bin" + ":" (assoc-ref %build-inputs "coreutils") "/bin" + ":" (assoc-ref %build-inputs "grep") "/bin" + ":" (assoc-ref %build-inputs "guile") "/bin" + ":" (getenv "PATH"))) + (for-each (lambda (file) (patch-shebang file)) (find-files ".")) + (substitute* "bin/bats" + (("export BATS_ROOT" line) + (string-append "BATS_ROOT=\"${BATS_ROOT:-" %output "/libexec/bats-core}\"\n" + line))) + ;; Install phase + (invoke "./install.sh" %output) + (wrap-script (string-append %output "/bin/bats") + (list "PATH" 'prefix (string-split (getenv "PATH") + #\:)))))) + (build-system trivial-build-system) + (home-page "https://github.com/bats-core/bats-core/") + (synopsis "Bash Automated Testing System") + (description + "Bats is a @acronym{TAP, Test Anything Protocol}-compliant testing +framework for Bash. It provides a simple way to verify that the UNIX programs +you write behave as expected. Bats is most useful when testing software written +in Bash, but you can use it to test any UNIX program.") + (license license:expat))) + +(define-public bash-ctypes + (package + (name "bash-ctypes") + (version "1.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/taviso/ctypes.sh/releases/download/v" + version "/ctypes-sh-" version ".tar.gz")) + (sha256 + (base32 "0s1sifqzqmr0dnciv06yqrpzgj11d7n0gy5zaxh6b3x8bx7k75l8")))) + (build-system gnu-build-system) + (inputs + `(("elfutils" ,elfutils) + ("libelf" ,libelf) + ("libffi" ,libffi) + ("zlib" ,zlib) + ;; Require a bash with C plugin support to build. + ("bash" ,bash))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (home-page "https://github.com/taviso/ctypes.sh") + (synopsis "Foreign function interface for Bash") + (description "Bash-ctypes is a Bash plugin that provides a foreign +function interface (FFI) directly in your shell. In other words, it allows +you to call routines in shared libraries from within Bash.") + (license license:expat)))