(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
|
||||
((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-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)))
|
||||
(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)))
|
||||
|
|
|
|||
|
|
@ -104,20 +104,19 @@
|
|||
(lambda (k contents)
|
||||
(define dir (car 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)) '()))))
|
||||
(vfs-contents vfs))
|
||||
(mapping-for-each
|
||||
(lambda (k contents)
|
||||
(define dir (car k))
|
||||
(define fname (cdr k))
|
||||
(when (eq? contents 'directory)
|
||||
(let*
|
||||
((name (string-append dir "/" fname))
|
||||
(dir (mapping-ref dirmap name)))
|
||||
(set! dirmap (mapping-update!/default dirmap dir (lambda (v) (cons (cons fname (zdir dir)) v)) '())))))
|
||||
(vfs-contents vfs))
|
||||
(zdir (mapping-ref/default dirmap "" '())))
|
||||
(define (read-dir dirname)
|
||||
(define contents (mapping-ref dirmap dirname))
|
||||
(for-each
|
||||
(lambda (pair)
|
||||
(when (eq? (cdr pair) 'directory)
|
||||
(set-cdr! pair (read-dir (if (string=? dirname "") (car pair) (string-append dirname "/" (car pair)))))))
|
||||
contents)
|
||||
(zdir contents))
|
||||
(read-dir ""))
|
||||
|
||||
;; Reads a dirhash from a `go.sum` line. This prefetches the module from
|
||||
;; the go module proxy, and then generates the dirhash without unpacking
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue