unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#32116] Allow bytevector as content of plain-file for binary data.
@ 2018-07-10 17:41 Jan Nieuwenhuizen
  2018-07-10 17:41 ` [bug#32117] [PATCH 1/2] store: Add `binary-file' Jan Nieuwenhuizen
  2018-07-10 17:41 ` [bug#32118] [PATCH 2/2] gexp: Allow bytevector as content of `plain-file' Jan Nieuwenhuizen
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Nieuwenhuizen @ 2018-07-10 17:41 UTC (permalink / raw)
  To: 32116

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

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

end of thread, other threads:[~2018-07-12  4:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-10 17:41 [bug#32116] Allow bytevector as content of plain-file for binary data Jan Nieuwenhuizen
2018-07-10 17:41 ` [bug#32117] [PATCH 1/2] store: Add `binary-file' Jan Nieuwenhuizen
2018-07-11 22:09   ` [bug#32116] " Ludovic Courtès
2018-07-12  4:30     ` bug#32116: " Jan Nieuwenhuizen
2018-07-11 22:09   ` Ludovic Courtès
2018-07-10 17:41 ` [bug#32118] [PATCH 2/2] gexp: Allow bytevector as content of `plain-file' Jan Nieuwenhuizen
2018-07-11 22:11   ` [bug#32116] " Ludovic Courtès
2018-07-12  4:31     ` Jan Nieuwenhuizen

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).