raco pkg install: error message improvement

When a package to be installed has a module that conflicts with an
existing installed module, but the existing module isn't in a package,
then say so explicitly in the error message. Also report the current
collection and links paths.

Error reporting could do even more work to figure out which path is
relevant, but reporting a list of paths is relatively easy. Listing
paths also seems likely to give a user enough hints for this rare
case, especially if the user just needs to be reminded that collection
links exist.
This commit is contained in:
Matthew Flatt 2017-06-22 12:40:09 -06:00
parent 0d2908f824
commit 8473c1d4a8

View File

@ -311,10 +311,19 @@
"in different scopes "
"")
pkg conflicting-pkg (pretty-module-path mp))
(pkg-error (~a "package conflicts with existing installed module\n"
(pkg-error (~a "package conflicts with existing installed module;\n"
" the existing installed module is not part of a package\n"
" package: ~a\n"
" module path: ~s")
pkg (pretty-module-path mp))))]
" module path: ~s\n"
" potentially relevant paths:~a")
pkg
(pretty-module-path mp)
(format-list
(for/list ([p (in-list (append
(current-library-collection-paths)
(current-library-collection-links)))]
#:when (path? p))
p)))))]
[(and
(not force?)
(for/or ([ai (in-set additional-installs)])