GNU bug report logs - #32116
Allow bytevector as content of plain-file for binary data.

Previous Next

Package: guix-patches;

Reported by: Jan Nieuwenhuizen <janneke <at> gnu.org>

Date: Tue, 10 Jul 2018 17:42:02 UTC

Severity: normal

Tags: patch

Merged with 32117, 32118

Done: Jan Nieuwenhuizen <janneke <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jan Nieuwenhuizen <janneke <at> gnu.org>
Subject: bug#32116: closed (Re: [bug#32117] [PATCH 1/2] store: Add
 `binary-file'.)
Date: Thu, 12 Jul 2018 04:31:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#32116: Allow bytevector as content of plain-file for binary data.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 32116 <at> debbugs.gnu.org.

-- 
32116: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=32116
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 32116-done <at> debbugs.gnu.org, 32117-done <at> debbugs.gnu.org
Subject: Re: [bug#32117] [PATCH 1/2] store: Add `binary-file'.
Date: Thu, 12 Jul 2018 06:30:31 +0200
Ludovic Courtès writes:

>> +@deffn {Monadic Procedure} binary-file* @var{name} @var{data} @dots{}
>
> There’s no ‘*’ in the actual procedure name.
>
> Also, could you move this @deffn to “The Store Monad”, right after
> ‘text-file’?

Ah, I based this on the `text-file*' description!  Moved, and rewritten
as

@deffn {Monadic Procedure} binary-file @var{name} @var{data} [@var{references}]
Return as a monadic value the absolute file name in the store of the file
containing @var{data}, a bytevector.  @var{references} is a list of store
items that the resulting binary file refers to; it defaults to the empty list.
@end deffn

> Apart from that it LGTM, thanks!

Pushed to master as  f3a422511f793fb6c6cfeec2bb8735965a03294a

janneke

-- 
Jan Nieuwenhuizen <janneke <at> gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

[Message part 3 (message/rfc822, inline)]
From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: guix-patches <at> gnu.org
Subject: Allow bytevector as content of plain-file for binary data.
Date: Tue, 10 Jul 2018 19:41:26 +0200
Currently, plain-file does not handle binary content correctly.  As discussed
on IRC[0] I added bytevector support to plain-file.

This allows for using a package source directly from git, doing something like

--8<---------------cut here---------------start------------->8---
(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)))
    ...
    ))
--8<---------------cut here---------------end--------------->8---

Greetings,
janneke

[0] https://gnunet.org/bot/log/guix/2018-07-10#T1763807





This bug report was last modified 6 years and 317 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.