summary refs log tree commit diff
path: root/tests/utils.scm
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2018-07-10 19:06:32 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2018-07-12 06:22:04 +0200
commite8e1f295f15fa56660a2c460d422795b1a31bed8 (patch)
tree19101ec2bfff62539d6c67f8f2fe2db3f2c6d46e /tests/utils.scm
parentf3a422511f793fb6c6cfeec2bb8735965a03294a (diff)
downloadguix-e8e1f295f15fa56660a2c460d422795b1a31bed8.tar.gz
gexp: Allow bytevector as content of `plain-file'.
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 (<plain-file>): Also allow bytevector content.
(plain-file-compiler): Handle bytevector content.
* doc/guix.texi (G-Expressions): Describe plain-file now also taking
bytevectors.
Diffstat (limited to 'tests/utils.scm')
0 files changed, 0 insertions, 0 deletions