summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-11-26 10:07:55 +0100
committerLudovic Courtès <ludo@gnu.org>2026-01-27 13:01:14 +0100
commit40c24a92af2ead4379ea0755304c00fd09c806bf (patch)
tree595bfca59963c57fa294874fd725983120e656b6
parentab72a155c6ddaaad7d3a5dfc7cd018ed48fd0e09 (diff)
serialization: Use ‘bytevector-slice’ from Guile >= 3.0.9.
* guix/serialization.scm (sub-bytevector): Remove. (read-byte-string): Use ‘bytevector-slice’. * configure.ac: Require Guile 3.0.9. * doc/contributing.texi (Requirements): Adjust accordingly. Change-Id: I7aa11a2182530ea5131be591db03b17efb6847a4 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Merges: #4495
-rw-r--r--configure.ac5
-rw-r--r--doc/contributing.texi2
-rw-r--r--guix/serialization.scm15
3 files changed, 6 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index 80d8e025b83..f72ca2f54c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
#
# GNU Guix --- Functional package management for GNU
-# Copyright © 2012-2021, 2022-2023 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012-2021, 2022-2023, 2025 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2013, 2016 Mark H Weaver <mhw@netris.org>
# Copyright © 2014-2016 Alex Kost <alezost@gmail.com>
# Copyright © 2014-2016 David Thompson <davet@gnu.org>
@@ -130,7 +130,8 @@ if test "x$GUILD" = "x"; then
fi
dnl (guix ui), notably, requires 'default-optimization-level' added in 3.0.3.
-PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.3])
+dnl (guix serialization) requires 'bytevector-slice' added in 3.0.9.
+PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.9])
dnl Get CFLAGS and LDFLAGS for libguile.
GUILE_FLAGS
diff --git a/doc/contributing.texi b/doc/contributing.texi
index c0a426db8af..06b4883baa2 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -66,7 +66,7 @@ GNU Guix depends on the following packages:
@itemize
@item @url{https://gnu.org/software/guile/, GNU Guile}, version 3.0.x,
-version 3.0.3 or later;
+version 3.0.9 or later;
@item @url{https://notabug.org/cwebber/guile-gcrypt, Guile-Gcrypt}, version
0.1.0 or later;
@item
diff --git a/guix/serialization.scm b/guix/serialization.scm
index dfeb7a9bf1e..0be97e4ff2c 100644
--- a/guix/serialization.scm
+++ b/guix/serialization.scm
@@ -20,6 +20,7 @@
#:autoload (guix base16) (base16-string->bytevector
bytevector->base16-string)
#:use-module (rnrs bytevectors)
+ #:autoload (rnrs bytevectors gnu) (bytevector-slice)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
@@ -29,7 +30,6 @@
#:use-module ((ice-9 rdelim) #:prefix rdelim:)
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
- #:use-module (system foreign)
#:export (write-value
read-value
write-bytevector
@@ -106,17 +106,6 @@
(port port)))))
bv))
-(define (sub-bytevector bv len)
- "Return a bytevector that aliases the first LEN bytes of BV."
- (define max (bytevector-length bv))
- (cond ((= len max) bv)
- ((< len max)
- ;; Yes, this is safe because the result of each conversion procedure
- ;; has its life cycle synchronized with that of its argument.
- (pointer->bytevector (bytevector->pointer bv) len))
- (else
- (error "sub-bytevector called to get a super bytevector"))))
-
(define (write-int n p)
(let ((b (make-bytevector 8 0)))
(bytevector-u32-set! b 0 n (endianness little))
@@ -164,7 +153,7 @@
(m (modulo len 8))
(pad (if (zero? m) 0 (- 8 m)))
(bv (get-bytevector-n* p (+ len pad))))
- (sub-bytevector bv len)))
+ (bytevector-slice bv 0 len)))
(define (read-string p)
(utf8->string (read-byte-string p)))