guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#32116] Allow bytevector as content of plain-file for binary data.


From: Jan Nieuwenhuizen
Subject: [bug#32116] 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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]