From e5788ebbe1f45a1088249b9138de17b330609712 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 5 Oct 2017 22:15:19 +0200 Subject: publish: Cache uncompressed nars as well. Fixes . Reported by Maxim Cournoyer . * guix/scripts/publish.scm (bake-narinfo+nar): When COMPRESSION is 'none, write NAR instead of doing nothing. (make-request-handler): Use 'render-nar/cached' for /nar URLs with no compression. * tests/publish.scm ("with cache", "with cache, uncompressed"): Adjust expected result accordingly. --- guix/scripts/publish.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index ade3c49a54..dd54f03996 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -484,9 +484,11 @@ (define* (bake-narinfo+nar cache item #:buffer-size (* 128 1024)) (rename-file (string-append nar ".tmp") nar)) ('none - ;; When compression is disabled, we retrieve files directly from the - ;; store; no need to cache them. - #t)) + ;; Cache nars even when compression is disabled so that we can + ;; guarantee the TTL (see .) + (with-atomic-file-output nar + (lambda (port) + (write-file item port))))) (mkdir-p (dirname narinfo)) (with-atomic-file-output narinfo @@ -788,8 +790,11 @@ (define nar-path? ;; /nar/ ((components ... store-item) (if (nar-path? components) - (render-nar store request store-item - #:compression %no-compression) + (if cache + (render-nar/cached store cache request store-item + #:compression %no-compression) + (render-nar store request store-item + #:compression %no-compression)) (not-found request))) (x (not-found request))) -- cgit v1.2.3