From unknown Sat Jun 21 10:40:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#32118 <32118@debbugs.gnu.org> To: bug#32118 <32118@debbugs.gnu.org> Subject: Status: [PATCH 2/2] gexp: Allow bytevector as content of `plain-file'. Reply-To: bug#32118 <32118@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:40:40 +0000 retitle 32118 [PATCH 2/2] gexp: Allow bytevector as content of `plain-file'. reassign 32118 guix-patches submitter 32118 Jan Nieuwenhuizen severity 32118 normal tag 32118 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 10 13:41:47 2018 Received: (at submit) by debbugs.gnu.org; 10 Jul 2018 17:41:47 +0000 Received: from localhost ([127.0.0.1]:54309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fcwe3-0002vv-79 for submit@debbugs.gnu.org; Tue, 10 Jul 2018 13:41:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fcwe1-0002vO-Ec for submit@debbugs.gnu.org; Tue, 10 Jul 2018 13:41:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcwdv-0006qN-As for submit@debbugs.gnu.org; Tue, 10 Jul 2018 13:41:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60746) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcwdv-0006qB-87 for submit@debbugs.gnu.org; Tue, 10 Jul 2018 13:41:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcwdt-0000g4-LP for guix-patches@gnu.org; Tue, 10 Jul 2018 13:41:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcwds-0006o7-AA for guix-patches@gnu.org; Tue, 10 Jul 2018 13:41:37 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcwds-0006o1-6W; Tue, 10 Jul 2018 13:41:36 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=47140 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1fcwdr-0005Bz-Kw; Tue, 10 Jul 2018 13:41:35 -0400 From: Jan Nieuwenhuizen To: guix-patches@gnu.org Subject: [PATCH 2/2] gexp: Allow bytevector as content of `plain-file'. Date: Tue, 10 Jul 2018 19:41:28 +0200 Message-Id: <20180710174128.6360-3-janneke@gnu.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710174128.6360-1-janneke@gnu.org> References: <20180710174128.6360-1-janneke@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) This allows for using a package source directly from git, doing something like (define (command->bytevector command) (let ((port (apply open-pipe* OPEN_READ command))) (let ((output (get-bytevector-all port))) (close-port port) output))) (define-public hello-git (package (name "hello") (version "git") (source (let* ((commit "stable-2.0") (content (command->bytevector `("git" "archive" "--format" "tar" "--prefix" ,(string-append commit "/") ,commit))) (file-name (string-append "hello-" commit))) (plain-file file-name content))) ... )) * guix/gexp.scm (): Also allow bytevector content. (plain-file-compiler): Handle bytevector content. * doc/guix.texi (G-Expressions): Describe plain-file now also taking bytevectors. --- doc/guix.texi | 2 +- guix/gexp.scm | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 04d7a79ac..4d80f3e19 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5349,7 +5349,7 @@ procedure (@pxref{The Store Monad, @code{interned-file}}). @deffn {Scheme Procedure} plain-file @var{name} @var{content} Return an object representing a text file called @var{name} with the given -@var{content} (a string) to be added to the store. +@var{content} (a string or a bytevector) to be added to the store. This is the declarative counterpart of @code{text-file}. @end deffn diff --git a/guix/gexp.scm b/guix/gexp.scm index 153b29bd4..cc3613f6f 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur +;;; Copyright © 2018 Jan Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,7 @@ #:use-module (guix derivations) #:use-module (guix grafts) #:use-module (guix utils) + #:use-module (rnrs bytevectors) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) @@ -334,7 +336,7 @@ appears." (%plain-file name content references) plain-file? (name plain-file-name) ;string - (content plain-file-content) ;string + (content plain-file-content) ;string or bytevector (references plain-file-references)) ;list (currently unused) (define (plain-file name content) @@ -349,8 +351,10 @@ This is the declarative counterpart of 'text-file'." (define-gexp-compiler (plain-file-compiler (file ) system target) ;; "Compile" FILE by adding it to the store. (match file - (($ name content references) - (text-file name content references)))) + (($ name (and (? string?) content) references) + (text-file name content references)) + (($ name (and (? bytevector?) content) references) + (binary-file name content references)))) (define-record-type (%computed-file name gexp guile options) -- 2.18.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 10 14:03:21 2018 Received: (at control) by debbugs.gnu.org; 10 Jul 2018 18:03:21 +0000 Received: from localhost ([127.0.0.1]:54325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fcwyt-0005Te-Mu for submit@debbugs.gnu.org; Tue, 10 Jul 2018 14:03:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34104) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fcwys-0005TP-1F for control@debbugs.gnu.org; Tue, 10 Jul 2018 14:03:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcwym-00012R-D5 for control@debbugs.gnu.org; Tue, 10 Jul 2018 14:03:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcwym-00012N-AB for control@debbugs.gnu.org; Tue, 10 Jul 2018 14:03:12 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=47210 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fcwyl-000684-Qr for control@debbugs.gnu.org; Tue, 10 Jul 2018 14:03:12 -0400 Date: Tue, 10 Jul 2018 20:03:08 +0200 Message-Id: <87h8l7m0ir.fsf@gnu.org> To: control@debbugs.gnu.org From: Jan Nieuwenhuizen Subject: control message for bug #32116 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) merge 32116 32118 From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 11 18:11:56 2018 Received: (at 32118) by debbugs.gnu.org; 11 Jul 2018 22:11:56 +0000 Received: from localhost ([127.0.0.1]:56045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdNL0-0007a1-5F for submit@debbugs.gnu.org; Wed, 11 Jul 2018 18:11:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdNKy-0007Ze-Un for 32118@debbugs.gnu.org; Wed, 11 Jul 2018 18:11:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdNKt-0005c4-0r for 32118@debbugs.gnu.org; Wed, 11 Jul 2018 18:11:47 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdNKf-0005U4-Ex; Wed, 11 Jul 2018 18:11:33 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=59944 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fdNKf-0000RH-1X; Wed, 11 Jul 2018 18:11:33 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Jan Nieuwenhuizen Subject: Re: [bug#32118] [PATCH 2/2] gexp: Allow bytevector as content of `plain-file'. References: <20180710174128.6360-1-janneke@gnu.org> <20180710174128.6360-3-janneke@gnu.org> Date: Thu, 12 Jul 2018 00:11:31 +0200 In-Reply-To: <20180710174128.6360-3-janneke@gnu.org> (Jan Nieuwenhuizen's message of "Tue, 10 Jul 2018 19:41:28 +0200") Message-ID: <87sh4ph17w.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32118 Cc: 32116@debbugs.gnu.org, 32118@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Jan Nieuwenhuizen skribis: > This allows for using a package source directly from git, doing something like > > (define (command->bytevector command) > (let ((port (apply open-pipe* OPEN_READ command))) > (let ((output (get-bytevector-all port))) > (close-port port) > output))) > > (define-public hello-git > (package > (name "hello") > (version "git") > (source (let* ((commit "stable-2.0") > (content (command->bytevector > `("git" "archive" "--format" "tar" "--prefix" > ,(string-append commit "/") ,commit))) > (file-name (string-append "hello-" commit))) > (plain-file file-name content))) > ... > )) > > * guix/gexp.scm (): Also allow bytevector content. > (plain-file-compiler): Handle bytevector content. > * doc/guix.texi (G-Expressions): Describe plain-file now also taking > bytevectors. LGTM, thanks! Ludo'. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 12 00:32:08 2018 Received: (at 32118-done) by debbugs.gnu.org; 12 Jul 2018 04:32:08 +0000 Received: from localhost ([127.0.0.1]:56215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdTGy-0001Yc-Dy for submit@debbugs.gnu.org; Thu, 12 Jul 2018 00:32:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45513) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fdTGu-0001Xt-Cw for 32118-done@debbugs.gnu.org; Thu, 12 Jul 2018 00:32:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdTGo-00036R-EL for 32118-done@debbugs.gnu.org; Thu, 12 Jul 2018 00:31:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdTGb-0002fK-T1; Thu, 12 Jul 2018 00:31:45 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=50450 helo=dundal.peder.onsbrabantnet.nl) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fdTGb-0003FZ-4u; Thu, 12 Jul 2018 00:31:45 -0400 From: Jan Nieuwenhuizen To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [bug#32118] [PATCH 2/2] gexp: Allow bytevector as content of `plain-file'. Organization: AvatarAcademy.nl References: <20180710174128.6360-1-janneke@gnu.org> <20180710174128.6360-3-janneke@gnu.org> <87sh4ph17w.fsf@gnu.org> X-Url: http://AvatarAcademy.nl Date: Thu, 12 Jul 2018 06:31:38 +0200 In-Reply-To: <87sh4ph17w.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 12 Jul 2018 00:11:31 +0200") Message-ID: <87pnztjcr9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 32118-done Cc: 32116-done@debbugs.gnu.org, 32118-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Ludovic Court=C3=A8s writes: >> * guix/gexp.scm (): Also allow bytevector content. >> (plain-file-compiler): Handle bytevector content. >> * doc/guix.texi (G-Expressions): Describe plain-file now also taking >> bytevectors. > > LGTM, thanks! Pushed to master as e8e1f295f15fa56660a2c460d422795b1a31bed8 janneke --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com From unknown Sat Jun 21 10:40:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 09 Aug 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator