From: david larsson <david.larsson@selfhosted.xyz>
To: 51512@debbugs.gnu.org
Cc: Guix-patches <guix-patches-bounces+david.larsson=selfhosted.xyz@gnu.org>
Subject: [bug#51512] [PATCH v6 2/3]: gnu: Add guile-bash-for-bash-coding-utils
Date: Tue, 23 May 2023 06:55:22 +0200 [thread overview]
Message-ID: <b9336e4ef177af5e3b4c02b40012d01a@selfhosted.xyz> (raw)
In-Reply-To: <3add15b77522d6e9ebd715a19d966666@selfhosted.xyz>
[-- Attachment #1: Type: text/plain, Size: 5576 bytes --]
From 7f2df5fd5b6ec44170b44ac74cae554405d939b6 Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Tue, 23 May 2023 05:38:36 +0200
Subject: [PATCH 2/3] gnu: Add guile-bash-for-bash-coding-utils
* gnu/packages/bash.scm (guile-bash-for-bash-coding-utils): New
variable.
---
gnu/local.mk | 1 +
gnu/packages/bash.scm | 34 +++++++++++++++
.../patches/guile-bash-args-from-stdin.patch | 42 +++++++++++++++++++
3 files changed, 77 insertions(+)
create mode 100644
gnu/packages/patches/guile-bash-args-from-stdin.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index c10fb01bb3..1db38d093c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1302,6 +1302,7 @@ dist_patch_DATA = \
%D%/packages/patches/guile-1.8-cpp-4.5.patch \
%D%/packages/patches/guile-2.2-skip-oom-test.patch \
%D%/packages/patches/guile-2.2-skip-so-test.patch \
+ %D%/packages/patches/guile-bash-args-from-stdin.patch \
%D%/packages/patches/guile-default-utf8.patch \
%D%/packages/patches/guile-2.2-default-utf8.patch \
%D%/packages/patches/guile-relocatable.patch \
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 1650fdeb72..64d6e8d65e 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -40,6 +40,7 @@ (define-module (gnu packages bash)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages guile)
+ #:use-module (gnu packages guile-xyz)
#:use-module (gnu packages version-control)
#:use-module (gnu packages less)
#:use-module (guix packages)
@@ -540,3 +541,36 @@ (define-public pydaemon
back as strings. Can be used over either of a unix or tcp socket.")
(home-page "https://gitlab.com/methuselah-0/pydaemon")
(license license:gpl3))))
+
+(define-public guile-bash-for-bash-coding-utils
+ (let ((commit "1eabc563ca5692b3e08d84f1f0e6fd2283284469")
+ (revision "0"))
+ (package
+ (inherit guile2.0-bash)
+ (version (string-append "0.1.6-" revision "." (string-take commit
7)))
+ (name "guile-bash-for-bash-coding-utils")
+ (home-page (package-home-page guile2.0-bash))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (commit commit)
+ (url home-page)))
+ (sha256
+ (base32
+
"097vny990wp2qpjij6a5a5gwc6fxzg5wk56inhy18iki5v6pif1p"))
+ (file-name (string-append name "-" version
"-checkout"))
+ (patches (search-patches
"guile-bash-args-from-stdin.patch"))))
+ (arguments (substitute-keyword-arguments (package-arguments
guile2.0-bash)
+ ((#:tests? _ #f) #f)
+ ((#:phases phases #~%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'install 'install-guile
+ (lambda* (#:key inputs outputs
#:allow-other-keys)
+ (copy-recursively
+ (string-append (assoc-ref outputs "out")
+ (assoc-ref inputs "guile")
"/share")
+ (string-append (assoc-ref outputs "out")
"/share"))
+ #t))))))
+ (inputs (modify-inputs (package-inputs guile2.0-bash)
+ (replace "guile" guile-3.0-latest)))
+ (propagated-inputs (list bash)))))
diff --git a/gnu/packages/patches/guile-bash-args-from-stdin.patch
b/gnu/packages/patches/guile-bash-args-from-stdin.patch
new file mode 100644
index 0000000000..ad42616c70
--- /dev/null
+++ b/gnu/packages/patches/guile-bash-args-from-stdin.patch
@@ -0,0 +1,42 @@
+From a124921666a16cb4e93f59a653f98b99c78eb2ca Mon Sep 17 00:00:00 2001
+From: David Larsson <david.larsson@selfhosted.xyz>
+Date: Thu, 11 Nov 2021 14:07:04 +0100
+Subject: [PATCH] Enable reading arguments from bash via stdin
+
+* lisp/gnu/bash.scm(define-bash-function): read from stdin
+to SCM_ARGS array when it is open, and separate args by null
+instead of newline if -z option is passed as $1.
+---
+ lisp/gnu/bash.scm | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/lisp/gnu/bash.scm b/lisp/gnu/bash.scm
+index 199ebc0..e9dcea5 100644
+--- a/lisp/gnu/bash.scm
++++ b/lisp/gnu/bash.scm
+@@ -326,10 +326,18 @@
+ (hashq-set! *funcs* symbol thunk)
+ (unsafe-format/eval
+ "function ~a {
+- SCM_ARGS=($@) ;
+- local retval=$~a ;
+- unset SCM_ARGS ;
+- return $retval ;
++ local -a Input SCM_ARGS
;
++ [[ ! -t 0 ]] && mapfile -d '' Input
;
++ if [[ -n \"${Input[@]}\" ]]; then
++ if [[ \"$1\" == -z ]]; then
++ local -a SCM_ARGS=\"(${Input[*]@Q})\"
;
++ else
++ mapfile -t SCM_ARGS < <(printf '%s'
\"${Input[@]}\"); fi ;
++ else
++ SCM_ARGS=(\"$@\"); fi
;
++ local retval=$~a
;
++ unset SCM_ARGS
;
++ return $retval
;
+ }"
+ symbol special-varname))))
+
+--
+2.31.0
+
--
2.39.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-guile-bash-for-bash-coding-utils.patch --]
[-- Type: text/x-diff; name=0002-gnu-Add-guile-bash-for-bash-coding-utils.patch, Size: 5533 bytes --]
From 7f2df5fd5b6ec44170b44ac74cae554405d939b6 Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Tue, 23 May 2023 05:38:36 +0200
Subject: [PATCH 2/3] gnu: Add guile-bash-for-bash-coding-utils
* gnu/packages/bash.scm (guile-bash-for-bash-coding-utils): New variable.
---
gnu/local.mk | 1 +
gnu/packages/bash.scm | 34 +++++++++++++++
.../patches/guile-bash-args-from-stdin.patch | 42 +++++++++++++++++++
3 files changed, 77 insertions(+)
create mode 100644 gnu/packages/patches/guile-bash-args-from-stdin.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index c10fb01bb3..1db38d093c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1302,6 +1302,7 @@ dist_patch_DATA = \
%D%/packages/patches/guile-1.8-cpp-4.5.patch \
%D%/packages/patches/guile-2.2-skip-oom-test.patch \
%D%/packages/patches/guile-2.2-skip-so-test.patch \
+ %D%/packages/patches/guile-bash-args-from-stdin.patch \
%D%/packages/patches/guile-default-utf8.patch \
%D%/packages/patches/guile-2.2-default-utf8.patch \
%D%/packages/patches/guile-relocatable.patch \
diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 1650fdeb72..64d6e8d65e 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -40,6 +40,7 @@ (define-module (gnu packages bash)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages guile)
+ #:use-module (gnu packages guile-xyz)
#:use-module (gnu packages version-control)
#:use-module (gnu packages less)
#:use-module (guix packages)
@@ -540,3 +541,36 @@ (define-public pydaemon
back as strings. Can be used over either of a unix or tcp socket.")
(home-page "https://gitlab.com/methuselah-0/pydaemon")
(license license:gpl3))))
+
+(define-public guile-bash-for-bash-coding-utils
+ (let ((commit "1eabc563ca5692b3e08d84f1f0e6fd2283284469")
+ (revision "0"))
+ (package
+ (inherit guile2.0-bash)
+ (version (string-append "0.1.6-" revision "." (string-take commit 7)))
+ (name "guile-bash-for-bash-coding-utils")
+ (home-page (package-home-page guile2.0-bash))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (commit commit)
+ (url home-page)))
+ (sha256
+ (base32
+ "097vny990wp2qpjij6a5a5gwc6fxzg5wk56inhy18iki5v6pif1p"))
+ (file-name (string-append name "-" version "-checkout"))
+ (patches (search-patches "guile-bash-args-from-stdin.patch"))))
+ (arguments (substitute-keyword-arguments (package-arguments guile2.0-bash)
+ ((#:tests? _ #f) #f)
+ ((#:phases phases #~%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'install 'install-guile
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (copy-recursively
+ (string-append (assoc-ref outputs "out")
+ (assoc-ref inputs "guile") "/share")
+ (string-append (assoc-ref outputs "out") "/share"))
+ #t))))))
+ (inputs (modify-inputs (package-inputs guile2.0-bash)
+ (replace "guile" guile-3.0-latest)))
+ (propagated-inputs (list bash)))))
diff --git a/gnu/packages/patches/guile-bash-args-from-stdin.patch b/gnu/packages/patches/guile-bash-args-from-stdin.patch
new file mode 100644
index 0000000000..ad42616c70
--- /dev/null
+++ b/gnu/packages/patches/guile-bash-args-from-stdin.patch
@@ -0,0 +1,42 @@
+From a124921666a16cb4e93f59a653f98b99c78eb2ca Mon Sep 17 00:00:00 2001
+From: David Larsson <david.larsson@selfhosted.xyz>
+Date: Thu, 11 Nov 2021 14:07:04 +0100
+Subject: [PATCH] Enable reading arguments from bash via stdin
+
+* lisp/gnu/bash.scm(define-bash-function): read from stdin
+to SCM_ARGS array when it is open, and separate args by null
+instead of newline if -z option is passed as $1.
+---
+ lisp/gnu/bash.scm | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/lisp/gnu/bash.scm b/lisp/gnu/bash.scm
+index 199ebc0..e9dcea5 100644
+--- a/lisp/gnu/bash.scm
++++ b/lisp/gnu/bash.scm
+@@ -326,10 +326,18 @@
+ (hashq-set! *funcs* symbol thunk)
+ (unsafe-format/eval
+ "function ~a {
+- SCM_ARGS=($@) ;
+- local retval=$~a ;
+- unset SCM_ARGS ;
+- return $retval ;
++ local -a Input SCM_ARGS ;
++ [[ ! -t 0 ]] && mapfile -d '' Input ;
++ if [[ -n \"${Input[@]}\" ]]; then
++ if [[ \"$1\" == -z ]]; then
++ local -a SCM_ARGS=\"(${Input[*]@Q})\" ;
++ else
++ mapfile -t SCM_ARGS < <(printf '%s' \"${Input[@]}\"); fi ;
++ else
++ SCM_ARGS=(\"$@\"); fi ;
++ local retval=$~a ;
++ unset SCM_ARGS ;
++ return $retval ;
+ }"
+ symbol special-varname))))
+
+--
+2.31.0
+
--
2.39.1
next prev parent reply other threads:[~2023-05-23 4:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-30 14:59 [bug#51512] [PATCH]: gnu: Add bash-bcu david larsson
2021-11-07 12:40 ` Tobias Geerinckx-Rice via Guix-patches via
2021-11-09 12:32 ` [bug#51512] [PATCH v 2]: " david larsson
2021-11-20 14:11 ` Tobias Geerinckx-Rice via Guix-patches via
2021-11-23 12:44 ` david larsson
2022-07-01 18:13 ` [bug#51512] [PATCH v 3]: " david larsson
2022-08-02 20:21 ` david larsson
2022-08-27 18:29 ` david larsson
2023-05-20 19:23 ` david larsson
2023-05-20 19:28 ` david larsson
2023-05-20 20:16 ` [bug#51512] [PATCH v 4]: " david larsson
2021-11-15 16:45 ` Recommend order for package fields? zimoun
2021-11-16 18:54 ` Katherine Cox-Buday
2021-11-17 11:15 ` Ludovic Courtès
2021-11-17 11:18 ` Ludovic Courtès
2021-11-17 11:40 ` zimoun
2021-11-19 14:51 ` Ludovic Courtès
2022-07-04 21:11 ` [bug#51512] [PATCH]: gnu: Add bash-bcu ( via Guix-patches via
2022-07-04 21:21 ` ( via Guix-patches via
2023-05-21 6:58 ` [bug#51512] [PATCH v5]: " david larsson
2023-05-23 4:51 ` [bug#51512] [PATCH v6 0/3]: " david larsson
2023-05-23 4:53 ` [bug#51512] [PATCH v6 1/3]: " david larsson
2023-05-23 4:55 ` david larsson [this message]
2023-05-23 4:56 ` [bug#51512] [PATCH v6 3/3]: gnu: Add bash-coding-utils david larsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9336e4ef177af5e3b4c02b40012d01a@selfhosted.xyz \
--to=david.larsson@selfhosted.xyz \
--cc=51512@debbugs.gnu.org \
--cc=guix-patches-bounces+david.larsson=selfhosted.xyz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.