raco pkg config: treat empty-string catalog as default paths

An empty string provided to `raco pkg config --set catalogs` would
trigger an error previously. Instead, turn it into a `#f` in the
configuration file, which is replaced by the default search sequence.

(cherry picked from commit ec0350e6d9)
This commit is contained in:
Matthew Flatt 2015-05-03 17:40:57 -07:00 committed by Ryan Culpepper
parent 35acaa26e4
commit b7dce6cb51
2 changed files with 11 additions and 3 deletions

View File

@ -897,11 +897,15 @@ for @nonterm{key}.
@item{@DFlag{scope-dir} @nonterm{dir} --- Same as for @command-ref{install}.}
]
The valid @nonterm{key}s are:
The valid @nonterm{key}s and corresponding @nonterm{val}s are:
@itemlist[
@item{@exec{name} --- A string for the installation's name, which is used by @exec{user}
@tech{package scope} and defaults to the Racket version.}
@item{@exec{catalogs} --- A list of URLs for @tech{package catalogs}.}
@item{@exec{catalogs} --- A list of URLs for @tech{package catalogs}. An empty-string
@nonterm{val} is replaced by the sequence of catalogs for the default configuration.
A @nonterm{val} that does not start with alphabetic characters followed by @litchar{://}
is treated as a path relative to the configuration directory (as
reported by @racket[find-config-dir]).}
@item{@exec{default-scope} --- Either @exec{installation} or @exec{user}.
The value of this key at @exec{user} scope (possibly defaulting from
@exec{installation} scope) is

View File

@ -144,7 +144,11 @@
key
(format-list (cons val more-vals)))]
[(list* (and key "catalogs") val)
(update-pkg-cfg! 'catalogs val)]
(update-pkg-cfg! 'catalogs
(for/list ([s (in-list val)])
(cond
[(equal? s "") #f]
[else s])))]
[(list (and key "default-scope") val)
(unless (member val '("installation" "user"))
(pkg-error (~a "invalid value for config key\n"