From ff3ca7979ebf03cc79022b69fcd693221550a69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 6 May 2020 23:17:47 +0200 Subject: channels: Add patch for . Without this patch, we couldn't jump from here to commits before 05e783871c2c69b402e088863d46f5be7915ac74 because the 'compute-guix-derivation' script would crash with an unbound-variable error for 'call-with-new-thread'. Fixes . Reported by Christopher Baines . * guix/channels.scm (%bug-41028-patch): New variable. (%patches): Add it. --- guix/channels.scm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/guix/channels.scm b/guix/channels.scm index 75b53c3a8e..0fa036446c 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -38,6 +38,7 @@ #:select (source-properties->location &error-location &fix-hint)) + #:use-module ((guix build utils) #:select (substitute*)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) #:use-module (srfi srfi-9) @@ -375,11 +376,35 @@ to '%package-module-path'." ;; `((,syscalls-reexports-local-variables? . ,guile-2.2.4))) + +(define %bug-41028-patch + ;; Patch for . The faulty code is the + ;; 'compute-guix-derivation' body, which uses 'call-with-new-thread' without + ;; importing (ice-9 threads). However, the 'call-with-new-thread' binding + ;; is no longer available in the default name space on Guile 3.0. + (let () + (define (missing-ice-9-threads-import? source commit) + ;; Return true if %SELF-BUILD-FILE is missing an (ice-9 threads) import. + (define content + (call-with-input-file (string-append source "/" %self-build-file) + read-string)) + + (and (string-contains content "(call-with-new-thread") + (not (string-contains content "(ice-9 threads)")))) + + (define (add-missing-ice-9-threads-import source) + ;; Add (ice-9 threads) import in the gexp of 'compute-guix-derivation'. + (substitute* (string-append source "/" %self-build-file) + (("^ +\\(use-modules \\(ice-9 match\\)\\)") + (object->string '(use-modules (ice-9 match) (ice-9 threads)))))) + + (patch missing-ice-9-threads-import? add-missing-ice-9-threads-import))) + (define %patches ;; Bits of past Guix revisions can become incompatible with newer Guix and ;; Guile. This variable lists records for the Guix source tree that ;; apply to the Guix source. - '()) + (list %bug-41028-patch)) (define* (guile-for-source source #:optional (quirks %quirks)) "Return the Guile package to use when building SOURCE or #f if the default -- cgit v1.2.3