guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 03/03: channels: Add patch for <https://bugs.gnu.org/41028>.
Date: Thu, 7 May 2020 04:09:52 -0400 (EDT)

civodul pushed a commit to branch core-updates
in repository guix.

commit ff3ca7979ebf03cc79022b69fcd693221550a69f
Author: Ludovic Courtès <address@hidden>
AuthorDate: Wed May 6 23:17:47 2020 +0200

    channels: Add patch for <https://bugs.gnu.org/41028>.
    
    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 <https://bugs.gnu.org/41028>.
    Reported by Christopher Baines <address@hidden>.
    
    * 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 75b53c3..0fa0364 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'."
   ;; <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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]