channels: Add patch for <https://bugs.gnu.org/41028>.

Without this patch, we couldn't jump from here to commits before
05e783871c because the
'compute-guix-derivation' script would crash with an unbound-variable
error for 'call-with-new-thread'.

Fixes <https://bugs.gnu.org/41028>.
Reported by Christopher Baines <mail@cbaines.net>.

* guix/channels.scm (%bug-41028-patch): New variable.
(%patches): Add it.
This commit is contained in:
Ludovic Courtès 2020-05-06 23:17:47 +02:00
parent 053b10c3ef
commit ff3ca7979e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -38,6 +38,7 @@ (define-module (guix channels)
#: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 @@ (define %quirks
;; <https://bugs.gnu.org/37506>
`((,syscalls-reexports-local-variables? . ,guile-2.2.4)))
(define %bug-41028-patch
;; Patch for <https://bugs.gnu.org/41028>. 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 <patch> 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