publish: Move 'query-path-info' call where it belongs.
* guix/scripts/publish.scm (narinfo-string): Remove 'path-info' parameter and add 'store' parameter. Call 'query-path-info'. (render-narinfo): Adjust accordingly.
This commit is contained in:
parent
da35acf91d
commit
4d459d8734
|
@ -1,6 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
||||||
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -142,10 +142,11 @@ Publish ~a over HTTP.\n") %store-directory)
|
||||||
(define base64-encode-string
|
(define base64-encode-string
|
||||||
(compose base64-encode string->utf8))
|
(compose base64-encode string->utf8))
|
||||||
|
|
||||||
(define (narinfo-string store-path path-info key)
|
(define (narinfo-string store store-path key)
|
||||||
"Generate a narinfo key/value string for STORE-PATH using the details in
|
"Generate a narinfo key/value string for STORE-PATH; an exception is raised
|
||||||
PATH-INFO. The narinfo is signed with KEY."
|
if STORE-PATH is invalid. The narinfo is signed with KEY."
|
||||||
(let* ((url (string-append "nar/" (basename store-path)))
|
(let* ((path-info (query-path-info store store-path))
|
||||||
|
(url (string-append "nar/" (basename store-path)))
|
||||||
(hash (bytevector->nix-base32-string
|
(hash (bytevector->nix-base32-string
|
||||||
(path-info-hash path-info)))
|
(path-info-hash path-info)))
|
||||||
(size (path-info-nar-size path-info))
|
(size (path-info-nar-size path-info))
|
||||||
|
@ -199,15 +200,13 @@ References: ~a~%"
|
||||||
|
|
||||||
(define (render-narinfo store request hash)
|
(define (render-narinfo store request hash)
|
||||||
"Render metadata for the store path corresponding to HASH."
|
"Render metadata for the store path corresponding to HASH."
|
||||||
(let* ((store-path (hash-part->path store hash))
|
(let ((store-path (hash-part->path store hash)))
|
||||||
(path-info (and (not (string-null? store-path))
|
(if (string-null? store-path)
|
||||||
(query-path-info store store-path))))
|
(not-found request)
|
||||||
(if path-info
|
|
||||||
(values '((content-type . (application/x-nix-narinfo)))
|
(values '((content-type . (application/x-nix-narinfo)))
|
||||||
(cut display
|
(cut display
|
||||||
(narinfo-string store-path path-info (force %private-key))
|
(narinfo-string store store-path (force %private-key))
|
||||||
<>))
|
<>)))))
|
||||||
(not-found request))))
|
|
||||||
|
|
||||||
(define (render-nar request store-item)
|
(define (render-nar request store-item)
|
||||||
"Render archive of the store path corresponding to STORE-ITEM."
|
"Render archive of the store path corresponding to STORE-ITEM."
|
||||||
|
|
Loading…
Reference in New Issue