From patchwork Tue May 23 04:55:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: david larsson X-Patchwork-Id: 50244 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id EB44827BBEA; Tue, 23 May 2023 05:56:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 204E027BBE2 for ; Tue, 23 May 2023 05:56:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1K46-0007AT-NW; Tue, 23 May 2023 00:56:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q1K42-000784-96 for guix-patches@gnu.org; Tue, 23 May 2023 00:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1K42-0005gf-1G for guix-patches@gnu.org; Tue, 23 May 2023 00:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q1K41-0006h3-TP for guix-patches@gnu.org; Tue, 23 May 2023 00:56:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51512] [PATCH v6 2/3]: gnu: Add guile-bash-for-bash-coding-utils Resent-From: david larsson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 23 May 2023 04:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51512 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51512@debbugs.gnu.org Cc: Guix-patches Received: via spool by 51512-submit@debbugs.gnu.org id=B51512.168481773725587 (code B ref 51512); Tue, 23 May 2023 04:56:01 +0000 Received: (at 51512) by debbugs.gnu.org; 23 May 2023 04:55:37 +0000 Received: from localhost ([127.0.0.1]:37859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1K3c-0006eW-Ft for submit@debbugs.gnu.org; Tue, 23 May 2023 00:55:37 -0400 Received: from server0.selfhosted.xyz ([217.64.149.7]:57360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1K3a-0006da-AH for 51512@debbugs.gnu.org; Tue, 23 May 2023 00:55:35 -0400 Received: from server0.selfhosted.xyz (localhost [127.0.0.1]) by server0.selfhosted.xyz (Postfix) with ESMTP id A07C830F86C8; Tue, 23 May 2023 06:55:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selfhosted.xyz; s=dkim; t=1684817728; bh=TqaoM/wXK5PVSZghVaLfAwBJYDKNb+CxnGiowDbWRfE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=A7lb0pg4zfLS9DI3DIVE1qM2xUiCnj37deaEbwD14NhXrvuzJzJLFSuwVQz0MKP48 50KaRaoiJxUqobxfjTvSP3ovXH2/DorsXhBUfQ5G1mEspzY1L0e6o/dIdbeRQrtd2Y s2ihbsCGwrCognmWuXZHZmRAKbTRqFu7Pz61+momLdxIk1WYxWOVYSQajDAWDe83DK 1dXHKAfKa6aRJBuvfINloQ88qb+ir2WmIEgTpCCnQufoOduXr+QpYkuBNWaNtxWw5J k/7W9tYlXaRf7n6tkfzX0k5aW2JoixxhPZW0BaOtqZDBgDHKn6nIr0lbvBjPLimnVp BV/fEEmYuEULg== X-Fuglu-Suspect: d4af105c0b03435dbedbbfbe74ffab31 X-Fuglu-Spamstatus: NO Received: from webmail.selfhosted.xyz (office.selfhosted.xyz [192.168.1.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mail@selfhosted.xyz) by server0.selfhosted.xyz (Postfix) with ESMTPSA; Tue, 23 May 2023 06:55:22 +0200 (CEST) MIME-Version: 1.0 Date: Tue, 23 May 2023 06:55:22 +0200 From: david larsson In-Reply-To: <3add15b77522d6e9ebd715a19d966666@selfhosted.xyz> References: <3add15b77522d6e9ebd715a19d966666@selfhosted.xyz> Message-ID: X-Sender: david.larsson@selfhosted.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From 7f2df5fd5b6ec44170b44ac74cae554405d939b6 Mon Sep 17 00:00:00 2001 From: David Larsson 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 ++ return $retval ; + }" + symbol special-varname)))) + +-- +2.31.0 + -- 2.39.1 From 7f2df5fd5b6ec44170b44ac74cae554405d939b6 Mon Sep 17 00:00:00 2001 From: David Larsson 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 +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