Skip to content
Snippets Groups Projects
  • Jan Nieuwenhuizen's avatar
    e8e1f295
    gexp: Allow bytevector as content of `plain-file'. · e8e1f295
    Jan Nieuwenhuizen authored
    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.
    e8e1f295
    History
    gexp: Allow bytevector as content of `plain-file'.
    Jan Nieuwenhuizen authored
    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.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.