diff --git a/guix/channels.scm b/guix/channels.scm index 041fae2a9c..cbb0a97546 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -328,16 +328,34 @@ to '%package-module-path'." #f (apply throw args))))) +(define (missing-ice-9-threads-import? source) + "Return true of %SELF-BUILD-FILE is missing an (ice-9 threads) import as +described at ." + (define content + (call-with-input-file (string-append source "/" %self-build-file) + read-string)) + + ;; The faulty code 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. + (and (string-contains content "(call-with-new-thread") + (not (string-contains content "(ice-9 threads)")))) + (define (guile-2.2.4) (module-ref (resolve-interface '(gnu packages guile)) 'guile-2.2.4)) +(define (guile-2.2) + (module-ref (resolve-interface '(gnu packages guile)) + 'guile-2.2)) + (define %quirks ;; List of predicate/package pairs. This allows us provide information ;; about specific Guile versions that old Guix revisions might need to use ;; just to be able to build and run the trampoline in %SELF-BUILD-FILE. See ;; - `((,syscalls-reexports-local-variables? . ,guile-2.2.4))) + `((,syscalls-reexports-local-variables? . ,guile-2.2.4) + (,missing-ice-9-threads-import? . ,guile-2.2))) (define* (guile-for-source source #:optional (quirks %quirks)) "Return the Guile package to use when building SOURCE or #f if the default @@ -372,32 +390,32 @@ package modules under SOURCE using CORE, an instance of Guix." (string-append source "/" %self-build-file)) (if (file-exists? script) - (let ((build (save-module-excursion - (lambda () - ;; Disable deprecation warnings; it's OK for SCRIPT to - ;; use deprecated APIs and the user doesn't have to know - ;; about it. - (parameterize ((guix-warning-port - (%make-void-port "w"))) - (primitive-load script))))) - (guile (guile-for-source source))) + (mlet* %store-monad ((guile -> (guile-for-source source)) + (_ (mwhen guile + (set-guile-for-build (pk 'G guile)))) + (build -> (save-module-excursion + (lambda () + ;; Disable deprecation warnings; it's + ;; OK for SCRIPT to use deprecated + ;; APIs and the user doesn't have to + ;; know about it. + (parameterize ((guix-warning-port + (%make-void-port "w"))) + (primitive-load script)))))) ;; BUILD must be a monadic procedure of at least one argument: the ;; source tree. ;; ;; Note: BUILD can return #f if it does not support %PULL-VERSION. In ;; the future we'll fall back to a previous version of the protocol ;; when that happens. - (mbegin %store-monad - (mwhen guile - (set-guile-for-build guile)) - ;; BUILD is usually quite costly. Install a "trivial" build handler - ;; so we don't bounce an outer build-accumulator handler that could - ;; cause us to redo half of the BUILD computation several times just - ;; to realize it gives the same result. - (with-trivial-build-handler - (build source #:verbose? verbose? #:version commit - #:pull-version %pull-version)))) + ;; BUILD is usually quite costly. Install a "trivial" build handler + ;; so we don't bounce an outer build-accumulator handler that could + ;; cause us to redo half of the BUILD computation several times just + ;; to realize it gives the same result. + (with-trivial-build-handler + (build source #:verbose? verbose? #:version commit + #:pull-version %pull-version))) ;; Build a set of modules that extend Guix using the standard method. (standard-module-derivation name source core dependencies)))