X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/459cad231104e8d5e5f7661acf6e72f52b3abbe2..93666cf7837edfe85c7c0960252d6ad9b4962717:/gnu/packages/bash.scm diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm index 8a589395f3..bddb83046a 100644 --- a/gnu/packages/bash.scm +++ b/gnu/packages/bash.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès -;;; Copyright © 2014 Mark H Weaver +;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès +;;; Copyright © 2014, 2015 Mark H Weaver +;;; Copyright © 2015 Leo Famulari ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,9 +20,11 @@ (define-module (gnu packages bash) #:use-module (guix licenses) + #:use-module (gnu packages) #:use-module (gnu packages ncurses) #:use-module (gnu packages readline) #:use-module (gnu packages bison) + #:use-module (gnu packages linux) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix utils) @@ -81,7 +84,19 @@ (27 "1gnsfvq6bhb3srlbh0cannj2hackdsipcg7z0ds7zlk1hp96mdqy") (28 "17a65c4fn4c5rgsiw9gqqnzhznh3gwnd2xzzv2dppyi48znxpc78") ;CVE-2014-7186 (29 "14k27p28r5l2fz3r03kd0x72vvsq8bja8c6hjz5kxikbzsbs7i2c") ;CVE-2014-6277 - (30 "0nrqb0m7s89qsrbfaffpilc5gcf82bx9yvgzld4hr79p5y54yhw5"))) ;CVE-2014-6278 + (30 "0nrqb0m7s89qsrbfaffpilc5gcf82bx9yvgzld4hr79p5y54yhw5") ;CVE-2014-6278 + (31 "07d62bl3z7qa8v6kgk47vzzazw563mlk9zhrsr4xsbqgvmcrylnd") + (32 "0jjgapfq4qhmndfrw8c3q3lva8xjdhlbd9cc631v41b0kb95g4w8") + (33 "05ma5rlxiadnfh925p4y7s0vvk917kmsdb1mfdx05gizl63pfapv") + (34 "12gq9whkq3naa3iy7c7x5pfpvrg7d0kwqld8609zxphhy424ysgi") + (35 "1qy1jflmbazjykq766gwabkaiswnx7pwa66whqiny0w02zjqa39p") + (36 "0z6jbyy70lfdm6d3x0sbazbqdxb3xnpn9bmz7madpvrnbd284pxc") + (37 "04sqr8zkl6s5fccfvb775ppn3ldij5imria9swc39aq0fkfp1w9k") + (38 "0rv3g14mpgv8br267bf7rmgqlgwnc4v6g3g8y0sjba571i8amgmd") + (39 "1v3l3vkc3g2b6fjycqwlakr8xhiw6bmw6q0zd6bi0m0m4bnxr55b") + (40 "0sypv66vsldmc95gwvf7ylz1k7y37vnvdsjg8ajjr6b2j9mkkfw4") + (41 "06ic2gdpbi1afik3wqf9d4vh95if4bz8bmhcgr555621dsb35i2f") + (42 "06a90k0p6bqc4wk2dsmapna69124an76xvlnlj3xm497vci968dc"))) (define (download-patches store count) "Download COUNT Bash patches into store. Return a list of @@ -125,6 +140,27 @@ number/base32-hash tuples, directly usable in the 'patch-series' form." (let ((out (assoc-ref outputs "out"))) (with-directory-excursion (string-append out "/bin") (symlink "bash" "sh"))))) + (install-headers-phase + '(lambda* (#:key outputs #:allow-other-keys) + ;; Install Bash headers so that packages that provide extensions + ;; can use them. We install them in include/bash; that's what + ;; Debian does and what Bash extensions like recutils or + ;; guile-bash expect. + (let ((include (string-append (assoc-ref outputs "include") + "/include/bash")) + (includes "^\\./include/[^/]+\\.h$") + (headers "^\\./(builtins/|lib/glob/|lib/tilde/|)[^/]+\\.h$")) + (mkdir-p include) + (for-each (lambda (file) + (when (string-match includes file) + (install-file file include)) + (when (string-match headers file) + (install-file file + (string-append include "/" + (dirname file))))) + (find-files "." "\\.h$")) + (delete-file (string-append include "/" "y.tab.h")) + #t))) (version "4.3")) (package (name "bash") @@ -145,7 +181,11 @@ number/base32-hash tuples, directly usable in the 'patch-series' form." (version (string-append version "." (number->string (length %patch-series-4.3)))) (build-system gnu-build-system) - (native-inputs `(("bison" ,bison))) ;to rebuild the parser + + (outputs '("out" + "doc" ;1.7 MiB of HTML and extra files + "include")) ;headers used by extensions + (native-inputs `(("bison" ,bison))) ;to rebuild the parser (inputs `(("readline" ,readline) ("ncurses" ,ncurses))) ;TODO: add texinfo (arguments @@ -158,7 +198,7 @@ number/base32-hash tuples, directly usable in the 'patch-series' form." ;; Bash is reportedly not parallel-safe. See, for instance, ;; and - ;; . + ;; . #:parallel-build? #f #:parallel-tests? #f @@ -166,9 +206,14 @@ number/base32-hash tuples, directly usable in the 'patch-series' form." ;; for now. #:tests? #f - #:phases (alist-cons-after 'install 'post-install - ,post-install-phase - %standard-phases))) + #:modules ((ice-9 regex) + (guix build utils) + (guix build gnu-build-system)) + + #:phases (modify-phases %standard-phases + (add-after 'install 'post-install ,post-install-phase) + (add-after 'install 'install-headers + ,install-headers-phase)))) (synopsis "The GNU Bourne-Again SHell") (description "Bash is the shell, or command-line interpreter, of the GNU system. It @@ -180,10 +225,10 @@ without modification.") (license gpl3+) (home-page "http://www.gnu.org/software/bash/")))) -(define-public bash-light +(define-public bash-minimal ;; A stripped-down Bash for non-interactive use. (package (inherit bash) - (name "bash-light") + (name "bash-minimal") (inputs '()) ; no readline, no curses (arguments (let ((args `(#:modules ((guix build gnu-build-system) @@ -204,3 +249,115 @@ without modification.") ,@(if (%current-target-system) '("bash_cv_job_control_missing=no") '())))))))) + +(define-public static-bash + ;; Statically-linked Bash that contains nothing but the 'bash' binary and + ;; 'sh' symlink, without any reference. + (let ((bash (static-package bash-minimal))) + (package + (inherit bash) + (name "bash-static") + (arguments + (substitute-keyword-arguments + `(#:allowed-references ("out") ,@(package-arguments bash)) + ((#:phases phases) + `(alist-cons-after + 'strip 'remove-everything-but-the-binary + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (remove-store-references (string-append bin "/bash")) + (delete-file (string-append bin "/bashbug")) + (delete-file-recursively (string-append out "/share")) + #t)) + ,phases))))))) + +(define-public bash-completion + (package + (name "bash-completion") + (version "2.3") + (source (origin + (method url-fetch) + (uri (string-append + "https://github.com/scop/" name "/releases/download/" + version "/" name "-" version ".tar.xz")) + (sha256 + (base32 + "1sg82nmsr00ig37skln2qvmi8mgbxgdvycm3ygzs8gbz66pq3q5j")) + (patches + (search-patches "bash-completion-directories.patch")))) + (build-system gnu-build-system) + (native-inputs `(("util-linux" ,util-linux))) + (arguments + `(#:phases (modify-phases %standard-phases + (add-after + 'install 'remove-redundant-completions + (lambda* (#:key 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")) + (completions (string-append out + "/share/bash-completion" + "/completions")) + (already (find-files + (string-append + util-linux + "/etc/bash_completion.d")))) + (with-directory-excursion completions + (for-each (lambda (file) + (when (file-exists? file) + (delete-file file))) + (map basename already))) + #t)))))) + (synopsis "Bash completions for common commands") + (description + "This package provides extensions that allow Bash to provide adapted +completion for many common commands.") + (home-page "http://bash-completion.alioth.debian.org/") + (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")))) + ;; 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 + ;; project does not use a Makefile. + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; There is no test suite. + #:phases + (modify-phases %standard-phases + ;; Because there are no configure scripts or Makefile, we can + ;; remove these phases. + (delete 'configure) + (delete 'build) + ;; The installation involves manually copying the files to a location. + ;; To make them easily accessible by setting PATH, we add the scripts + ;; to the "bin" folder. + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) + (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/") + (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)))