diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-01-29 09:49:33 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-01-29 09:49:33 +0100 |
commit | 782f1ea9f693639b8feb3152fa6a280356ab1167 (patch) | |
tree | 449d8066f6a1feb6edf28ca8887b8cfb6d0b4a41 /guix/build/utils.scm | |
parent | 4bdd41bb839e52876fdc03011bed0aa450c92263 (diff) | |
download | gnu-guix-782f1ea9f693639b8feb3152fa6a280356ab1167.tar gnu-guix-782f1ea9f693639b8feb3152fa6a280356ab1167.tar.gz |
utils: Switch to the new 'setvbuf' API.
* guix/build/utils.scm (setvbuf) [(and guile-2 (not guile-2.2))]: New
procedure.
(remove-store-references): Use the 2.2 'setvbuf' API style.
* guix/build/gnu-build-system.scm (gnu-build): Likewise.
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r-- | guix/build/utils.scm | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm index cb5621a5a9..a21dbb0128 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org> @@ -101,7 +101,27 @@ locale-category->string)) + +;;; +;;; Guile 2.0 compatibility later. +;;; +;; The bootstrap Guile is Guile 2.0, so provide a compatibility layer. +(cond-expand + ((and guile-2 (not guile-2.2)) + (define (setvbuf port mode . rest) + (apply (@ (guile) setvbuf) port + (match mode + ('line _IOLBF) + ('block _IOFBF) + ('none _IONBF) + (_ mode)) ;an _IO* integer + rest)) + + (module-replace! (current-module) '(setvbuf))) + (else #f)) + + ;;; ;;; Directories. ;;; @@ -989,8 +1009,8 @@ known as `nuke-refs' in Nixpkgs." ;; We cannot use `regexp-exec' here because it cannot deal with ;; strings containing NUL characters. (format #t "removing store references from `~a'...~%" file) - (setvbuf in _IOFBF 65536) - (setvbuf out _IOFBF 65536) + (setvbuf in 'block 65536) + (setvbuf out 'block 65536) (fold-port-matches (lambda (match result) (put-bytevector out (string->utf8 store)) (put-u8 out (char->integer #\/)) |