[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/13: utils: 'version-compare' delays 'dynamic-link' code.
From: |
guix-commits |
Subject: |
01/13: utils: 'version-compare' delays 'dynamic-link' code. |
Date: |
Thu, 12 Dec 2019 07:49:40 -0500 (EST) |
civodul pushed a commit to branch wip-system-bootstrap
in repository guix.
commit 549a4a3a72bb486495aa2f1e673ec528cbfb38c7
Author: Ludovic Courtès <address@hidden>
Date: Fri Dec 6 23:07:13 2019 +0100
utils: 'version-compare' delays 'dynamic-link' code.
* guix/utils.scm (version-compare): Delay 'strverscmp' and force it when
called.
---
guix/utils.scm | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/guix/utils.scm b/guix/utils.scm
index 728039f..b3aacfa 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -508,14 +508,17 @@ a character other than '@'."
(define version-compare
(let ((strverscmp
- (let ((sym (or (dynamic-func "strverscmp" (dynamic-link))
- (error "could not find `strverscmp' (from GNU
libc)"))))
- (pointer->procedure int sym (list '* '*)))))
+ ;; Delay symbol resolution so that this module can be used even on a
+ ;; statically-linked Guile.
+ (delay
+ (let ((sym (or (dynamic-func "strverscmp" (dynamic-link))
+ (error "could not find `strverscmp' (from GNU
libc)"))))
+ (pointer->procedure int sym (list '* '*))))))
(lambda (a b)
"Return '> when A denotes a newer version than B,
'< when A denotes a older version than B,
or '= when they denote equal versions."
- (let ((result (strverscmp (string->pointer a) (string->pointer b))))
+ (let ((result ((force strverscmp) (string->pointer a) (string->pointer
b))))
(cond ((positive? result) '>)
((negative? result) '<)
(else '=))))))
- branch wip-system-bootstrap created (now ba36483), guix-commits, 2019/12/12
- 01/13: utils: 'version-compare' delays 'dynamic-link' code.,
guix-commits <=
- 03/13: store: Add #:cut? parameter to 'topologically-sorted'., guix-commits, 2019/12/12
- 02/13: monads: Add portability to Guile 2.0., guix-commits, 2019/12/12
- 05/13: DRAFT gexp: Add 'raw-derivation-file'., guix-commits, 2019/12/12
- 07/13: DRAFT gexp: Add 'object-sources'., guix-commits, 2019/12/12
- 09/13: guile-build-system: Add #:implicit-inputs., guix-commits, 2019/12/12
- 12/13: DRAFT serialization: Avoid 'define-values', for the sake of Guile 2.0., guix-commits, 2019/12/12
- 10/13: gnu: Add guile-hashing., guix-commits, 2019/12/12
- 06/13: DRAFT gexp: Add 'raw-derivation-closure'., guix-commits, 2019/12/12
- 04/13: derivations: Add #:skip-dependencies? parameter to 'derivation-input-fold'., guix-commits, 2019/12/12
- 08/13: DRAFT system: Add (gnu system bootstrap)., guix-commits, 2019/12/12