raco pkg: more information for an ill-formed path error

This commit is contained in:
Matthew Flatt 2014-12-16 06:40:54 -07:00
parent d4ba30354e
commit f8c6090d37
3 changed files with 9 additions and 6 deletions

View File

@ -931,7 +931,7 @@
(pkg-desc-type pkg-name)
#:link-dirs? link-dirs?
#:must-infer-name? (not (pkg-desc-name pkg-name))
#:complain complain-about-source))
#:complain (complain-about-source (pkg-desc-name pkg-name))))
(define name (or (pkg-desc-name pkg-name)
inferred-name))
;; Check that the package is installed, and get current checksum:

View File

@ -31,12 +31,15 @@
(apply printf fmt args)
(flush-output))
(define (complain-about-source s reason)
(define ((complain-about-source given-name) s reason)
(pkg-error (~a "invalid package source;\n"
" ~a\n"
" given: ~a")
" given: ~a~a")
reason
s))
s
(if given-name
(~a "\n for package name: " given-name)
"")))
(define (ask question
#:default-yes? [default-yes? #t])

View File

@ -87,11 +87,11 @@
'dir)
'file))
#:must-infer-name? (not given-pkg-name)
#:complain complain-about-source)
#:complain (complain-about-source given-pkg-name))
(package-source->name+type pkg given-type
#:link-dirs? link-dirs?
#:must-infer-name? (not given-pkg-name)
#:complain complain-about-source)))
#:complain (complain-about-source given-pkg-name))))
(define pkg-name (or given-pkg-name inferred-pkg-name))
(when (and type (not pkg-name))
(pkg-error (~a "could not infer package name from source\n"