fix for `find-relevant-directory-records'

Multiple package-based instances of the same collection were not
handled correctly.
This commit is contained in:
Matthew Flatt 2013-06-18 17:13:06 -06:00
parent b2ebb0a28b
commit 092db5414a

View File

@ -101,9 +101,9 @@
(define (reset-relevant-directories-state!) (define (reset-relevant-directories-state!)
(set! preferred-table (set! preferred-table
(make-table (make-table
(lambda (i l) (lambda (root-dir i l)
(if (null? l) (if (or root-dir (null? l))
(list i) (cons i l)
(match-let ([(struct directory-record (my-maj my-min _ _ _)) i] (match-let ([(struct directory-record (my-maj my-min _ _ _)) i]
[(struct directory-record (their-maj their-min _ _ _)) [(struct directory-record (their-maj their-min _ _ _))
(car l)]) (car l)])
@ -112,9 +112,10 @@
(list i) (list i)
l)))) l))))
#f #f)) #f #f))
(set! all-available-table (make-table cons #f #f)) (define (always root-dir i l) (cons i l))
(set! no-planet-table (make-table cons #f #f)) (set! all-available-table (make-table always #f #f))
(set! no-user-table (make-table cons #f #f))) (set! no-planet-table (make-table always #f #f))
(set! no-user-table (make-table always #f #f)))
(reset-relevant-directories-state!) (reset-relevant-directories-state!)
@ -166,7 +167,7 @@
(main-lib-relative->path pathbytes))) (main-lib-relative->path pathbytes)))
fields)]) fields)])
(hash-set! colls key (hash-set! colls key
((table-insert t) new-item old-items)))] ((table-insert t) root-dir new-item old-items)))]
[_ (error 'find-relevant-directories [_ (error 'find-relevant-directories
"bad info-domain cache entry: ~e in: ~a" i f)]))))) "bad info-domain cache entry: ~e in: ~a" i f)])))))
;; For each coll, invert the mapping, adding the col name to the list ;; For each coll, invert the mapping, adding the col name to the list