X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/19008a22d18e772062952034c58a15ed341df3b5..34b6dd36bb63e75a2e64a2c9b008c098162b7558:/gnu/packages/bash.scm diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm index 4a884e6175..47ca625d9a 100644 --- a/gnu/packages/bash.scm +++ b/gnu/packages/bash.scm @@ -1,9 +1,10 @@ ;;; 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 ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,21 +24,28 @@ (define-module (gnu packages bash) #:use-module (guix licenses) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bootstrap) #:use-module (gnu packages ncurses) #:use-module (gnu packages readline) #:use-module (gnu packages bison) #:use-module (gnu packages linux) + #: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)) @@ -46,12 +54,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)) @@ -62,7 +70,21 @@ ;; 'download-patches' below. (patch-series (1 "12bjfdy6bg8nhyw27bdgxn7h4paylx8d927skfmi9pxd1wgrxzpj") - (2 "01w7yrzmz10mw06ys0546vhl7isv2v402ziyvfd7k67588spvs47"))) + (2 "01w7yrzmz10mw06ys0546vhl7isv2v402ziyvfd7k67588spvs47") + (3 "0ny81ridp5n0j69hb8ixrc7dmxybby54jbsz5hikly8kgg1wvssf") + (4 "021gqqvgydixkrmqss64b6srfdlkvnx88lyfzpxfrn5d6bc7li0l") + (5 "0xl2kyzm84nlyklrqzkn73ixabhzfhn9x91lzcmis89cppclvxav") + (6 "0844749ixk1z60437nkznzms1f0nzh9an62kj7sny6r0zyk2k1fn") + (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 @@ -73,7 +95,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 @@ -109,7 +131,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) @@ -269,13 +292,16 @@ without modification.") `(#:phases (modify-phases %standard-phases (add-after 'install 'remove-redundant-completions - (lambda* (#:key inputs outputs #:allow-other-keys) + (lambda* (#:key + inputs native-inputs + outputs #:allow-other-keys) ;; Util-linux comes with a bunch of completion files for ;; its own commands which are more sophisticated and ;; up-to-date than those of bash-completion. Remove those ;; from bash-completion. (let* ((out (assoc-ref outputs "out")) - (util-linux (assoc-ref inputs "util-linux")) + (util-linux (assoc-ref (or native-inputs inputs) + "util-linux")) (completions (string-append out "/share/bash-completion" "/completions")) @@ -300,14 +326,15 @@ completion for many common commands.") (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 @@ -330,7 +357,7 @@ 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 @@ -338,3 +365,53 @@ 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))) + +(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 expat)))