gnu: datefudge: Update to 1.23.
[jackhill/guix/guix.git] / gnu / packages / patches / racket-store-checksum-override.patch
CommitLineData
e3fc9bcc
TS
1Racket uses checksums to test if it needs to recompile its source
2files to bytecode. If Racket is updated by grafting, the source and
3bytecode files get updated, but the checksum stays the same. Since
4the checksum no longer matches the source file, Racket tries to
5regenerate the bytecode and write it to the store, causing errors
6because the store is immutable. This patch makes Racket ignore
7checksums for files in the store.
8
9See <https://debbugs.gnu.org/30680> for details.
10
948ecc27 11---
e0b49c78
KH
12--- a/collects/compiler/private/cm-minimal.rkt
13+++ b/collects/compiler/private/cm-minimal.rkt
e3fc9bcc
TS
14@@ -7,6 +7,7 @@
15 racket/list
16 racket/path
17 racket/promise
18+ racket/string
948ecc27 19 file/sha1
e3fc9bcc 20 setup/collects
948ecc27
CLW
21 setup/cross-system
22@@ -940,6 +941,10 @@
e3fc9bcc
TS
23 #f
24 (list src-hash recorded-hash)))
25
26+(define (store-reference? path)
27+ (let ([store-prefix (or (getenv "NIX_STORE") "/gnu/store")])
28+ (string-prefix? (path->string path) store-prefix)))
29+
30 (define (rkt->ss p)
31 (if (path-has-extension? p #".rkt")
32 (path-replace-extension p #".ss")
948ecc27
CLW
33@@ -1015,6 +1020,7 @@
34 (trace-printf "newer src... ~a > ~a" path-time path-zo-time)
35 (maybe-compile-zo deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen
36 #:trying-sha1? sha1-only?)]
37- [(different-source-sha1-and-dep-recorded path deps)
38+ [(and (not (store-reference? path))
39+ (different-source-sha1-and-dep-recorded path deps))
40 => (lambda (difference)
41 (trace-printf "different src hash ~a for ~a..." difference path)
42 (maybe-compile-zo deps path->mode roots path orig-path read-src-syntax up-to-date collection-cache new-seen