always adjust catalogs configuration elements

Pathnames in the list need to be made absolute
"file://" URLs, even if the list has no #f element
to splice the default catalog.

(cherry picked from commit 78e473f017)
This commit is contained in:
Matthew Flatt 2015-05-03 17:11:58 -07:00 committed by Ryan Culpepper
parent 63ad440cc7
commit 35acaa26e4

View File

@ -67,23 +67,21 @@
[else [else
(match k (match k
['catalogs ['catalogs
(if (member #f v) ;; Replace #f with default URLs, relative path
;; Replace #f with default URLs, relative path ;; with absolute path:
;; with absolute path: (apply append (for/list ([i (in-list v)])
(apply append (for/list ([i (in-list v)]) (cond
(cond [(not i) (get-default)]
[(not i) (get-default)] [(regexp-match? #rx"^[a-z]+://" i)
[(regexp-match? #rx"^[a-z]+://" i) (list i)]
(list i)] [else
[else ;; If it doesn't look like a URL, then treat it as
;; If it doesn't look like a URL, then treat it as ;; a path (potentially relative to the configuration file):
;; a path (potentially relative to the configuration file): (list
(list (url->string
(url->string (path->url
(path->url (simple-form-path
(simple-form-path (path->complete-path i (path->complete-path (pkg-dir #t)))))))])))]
(path->complete-path i (path->complete-path (pkg-dir #t)))))))])))
v)]
[_ v])])) [_ v])]))
(define (update-pkg-cfg! key val) (define (update-pkg-cfg! key val)