summaryrefslogtreecommitdiff
path: root/guix/store
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-17 16:19:07 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-19 23:25:01 +0100
commit4f621a2b003e85d480999e4d0630e9dc3de85bc3 (patch)
tree8e5dda8866dcae4887560e32dae15e1a02267457 /guix/store
parentc7c7f068c15e419aaf5ef616516aa5ad4e55c2fa (diff)
maint: Require Guile >= 2.2.6.
* configure.ac: For Guile 2.2, require 2.2.6 or later. * guix/gexp.scm (define-syntax-parameter-once): Remove. Use 'define-syntax-parameter' instead. * guix/mnoads.scm: Likewise. * guix/inferior.scm (proxy)[select*]: Remove. * guix/scripts/publish.scm <top level>: Remove replacement for (@@ (web http) read-header-line). * guix/store/deduplication.scm (counting-wrapper-port): Remove. (nar-sha256): Call 'port-position' on PORT to compute SIZE.
Diffstat (limited to 'guix/store')
-rw-r--r--guix/store/deduplication.scm32
1 files changed, 4 insertions, 28 deletions
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index a72a43bf79..cd9660174c 100644
--- a/guix/store/deduplication.scm
+++ b/guix/store/deduplication.scm
@@ -37,38 +37,14 @@
dump-file/deduplicate
copy-file/deduplicate))
-;; XXX: This port is used as a workaround on Guile <= 2.2.4 where
-;; 'port-position' throws to 'out-of-range' when the offset is great than or
-;; equal to 2^32: <https://bugs.gnu.org/32161>.
-(define (counting-wrapper-port output-port)
- "Return two values: an output port that wraps OUTPUT-PORT, and a thunk to
-retrieve the number of bytes written to OUTPUT-PORT."
- (let ((byte-count 0))
- (values (make-custom-binary-output-port "counting-wrapper"
- (lambda (bytes offset count)
- (put-bytevector output-port bytes
- offset count)
- (set! byte-count
- (+ byte-count count))
- count)
- (lambda ()
- byte-count)
- #f
- (lambda ()
- (close-port output-port)))
- (lambda ()
- byte-count))))
-
(define (nar-sha256 file)
"Gives the sha256 hash of a file and the size of the file in nar form."
- (let*-values (((port get-hash) (open-sha256-port))
- ((wrapper get-size) (counting-wrapper-port port)))
- (write-file file wrapper)
- (force-output wrapper)
+ (let-values (((port get-hash) (open-sha256-port)))
+ (write-file file port)
(force-output port)
(let ((hash (get-hash))
- (size (get-size)))
- (close-port wrapper)
+ (size (port-position port)))
+ (close-port port)
(values hash size))))
(define (tempname-in directory)