(zilch lang go vfs): fix directories not making it to the store
Sadly, iterating twice won't work, as this will create directory associations in the wrong direction, and there's no way mappings let you iterate backwards. Let's mark the entries as directories and then swap them out with the directories when building a zdir tree instead.
This commit is contained in:
parent
fc8aea8fb4
commit
fe53998fcc
2 changed files with 12 additions and 13 deletions
|
|
@ -167,7 +167,7 @@
|
||||||
(let
|
(let
|
||||||
((collected-files (map (lambda (name) (cons name (vfs-file-ref vfs last-part name))) go-files))
|
((collected-files (map (lambda (name) (cons name (vfs-file-ref vfs last-part name))) go-files))
|
||||||
(collected-assembly-files (map (lambda (name) (cons name (vfs-file-ref vfs last-part name))) s-files))
|
(collected-assembly-files (map (lambda (name) (cons name (vfs-file-ref vfs last-part name))) s-files))
|
||||||
(collected-assembly-includes (if (= (length s-files) 0) '() #~,(string-append #$(force headers) last-part)))
|
(collected-assembly-includes (if (= (length s-files) 0) '() #~,(string-append #$(force headers) "/" last-part)))
|
||||||
(collected-imports (map (lambda (name) (if (is-builtin name) (go-stdlib-ref name) (find-package name)))
|
(collected-imports (map (lambda (name) (if (is-builtin name) (go-stdlib-ref name) (find-package name)))
|
||||||
(filter (lambda (name) (not (member name '("builtin" "unsafe")))) imports))))
|
(filter (lambda (name) (not (member name '("builtin" "unsafe")))) imports))))
|
||||||
(go-package-compile name full-path collected-imports collected-files collected-assembly-files collected-assembly-includes embed-filenames embed-patterns)))
|
(go-package-compile name full-path collected-imports collected-files collected-assembly-files collected-assembly-includes embed-filenames embed-patterns)))
|
||||||
|
|
|
||||||
|
|
@ -104,20 +104,19 @@
|
||||||
(lambda (k contents)
|
(lambda (k contents)
|
||||||
(define dir (car k))
|
(define dir (car k))
|
||||||
(define fname (cdr k))
|
(define fname (cdr k))
|
||||||
(unless (eq? contents 'directory)
|
(if (eq? contents 'directory)
|
||||||
|
(set! dirmap (mapping-update!/default dirmap dir (lambda (v) (cons (cons fname 'directory) v)) '()))
|
||||||
(set! dirmap (mapping-update!/default dirmap dir (lambda (v) (cons (cons fname (zsymlink contents)) v)) '()))))
|
(set! dirmap (mapping-update!/default dirmap dir (lambda (v) (cons (cons fname (zsymlink contents)) v)) '()))))
|
||||||
(vfs-contents vfs))
|
(vfs-contents vfs))
|
||||||
(mapping-for-each
|
(define (read-dir dirname)
|
||||||
(lambda (k contents)
|
(define contents (mapping-ref dirmap dirname))
|
||||||
(define dir (car k))
|
(for-each
|
||||||
(define fname (cdr k))
|
(lambda (pair)
|
||||||
(when (eq? contents 'directory)
|
(when (eq? (cdr pair) 'directory)
|
||||||
(let*
|
(set-cdr! pair (read-dir (if (string=? dirname "") (car pair) (string-append dirname "/" (car pair)))))))
|
||||||
((name (string-append dir "/" fname))
|
contents)
|
||||||
(dir (mapping-ref dirmap name)))
|
(zdir contents))
|
||||||
(set! dirmap (mapping-update!/default dirmap dir (lambda (v) (cons (cons fname (zdir dir)) v)) '())))))
|
(read-dir ""))
|
||||||
(vfs-contents vfs))
|
|
||||||
(zdir (mapping-ref/default dirmap "" '())))
|
|
||||||
|
|
||||||
;; Reads a dirhash from a `go.sum` line. This prefetches the module from
|
;; Reads a dirhash from a `go.sum` line. This prefetches the module from
|
||||||
;; the go module proxy, and then generates the dirhash without unpacking
|
;; the go module proxy, and then generates the dirhash without unpacking
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue