unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#41751] [PATCH] gnu: Add bats.
@ 2020-06-07 18:23 Oleg Pykhalov
  2020-06-14 10:15 ` Mathieu Othacehe
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Pykhalov @ 2020-06-07 18:23 UTC (permalink / raw)
  To: 41751; +Cc: Oleg Pykhalov

* gnu/packages/bash.scm (bats): New variable.
---
 gnu/packages/bash.scm | 52 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 3ba8a13e40..dff3fcb594 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@
 (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)
@@ -37,6 +39,7 @@
   #: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   (guix base32) (bytevector->nix-base32-string)
 
@@ -362,3 +365,52 @@ 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.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0f59zh4d4pa1a7ybs5zl6h0csbqqv11lbnq0jl1dgwm1s6p49bsq"))))
+    (inputs
+     `(("bash" ,bash)
+       ("coreutils" ,coreutils)
+       ("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"
+                                ":" (getenv "PATH")))
+         ;; Patch phase
+         (substitute* "install.sh"
+           (("/usr/bin/env bash") (which "bash")))
+         (substitute* "libexec/bats-core/bats"
+           (("type -p greadlink readlink")
+            (string-append "type -p " (which "readlink"))))
+         (substitute* "libexec/bats-core/bats"
+           (("grep") (which "grep")))
+         ;; Install phase
+         (invoke "./install.sh" %output))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "BATS_ROOT")
+            (separator #f) ;single entry
+            (files '("libexec/bats-core")))))
+    (build-system trivial-build-system)
+    (home-page "https://github.com/bats-core/bats-core/")
+    (synopsis "Bash Automated Testing System")
+    (description "This package provides a Bash Automated Testing System.")
+    (license expat)))
-- 
2.26.2





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#41751] [PATCH] gnu: Add bats.
  2020-06-07 18:23 [bug#41751] [PATCH] gnu: Add bats Oleg Pykhalov
@ 2020-06-14 10:15 ` Mathieu Othacehe
  2020-07-25 19:14   ` bug#41751: " Oleg Pykhalov
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Othacehe @ 2020-06-14 10:15 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 41751


Hello Oleg,

> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "BATS_ROOT")
> +            (separator #f) ;single entry
> +            (files '("libexec/bats-core")))))

Why not patching "bats" script directly? This way we wouldn't need an
extra environment variable to run "bats".

> +    (description "This package provides a Bash Automated Testing System.")

It would be good to elaborate a bit on that, what can be tested exactly,
how to use it.

Otherwise, this looks fine.

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#41751: [PATCH] gnu: Add bats.
  2020-06-14 10:15 ` Mathieu Othacehe
@ 2020-07-25 19:14   ` Oleg Pykhalov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Pykhalov @ 2020-07-25 19:14 UTC (permalink / raw)
  To: 41751-done

[-- Attachment #1: Type: text/plain, Size: 105 bytes --]

All suggestions were applied and pushed in master in
5a88d3dfcb382a9256e5b6d18f1487b597260944.

Closing.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-25 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-07 18:23 [bug#41751] [PATCH] gnu: Add bats Oleg Pykhalov
2020-06-14 10:15 ` Mathieu Othacehe
2020-07-25 19:14   ` bug#41751: " Oleg Pykhalov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).