tests and repairs for early checks

Also, avoid "early" checks when recurring, just in case.
This commit is contained in:
Matthew Flatt 2015-05-16 17:15:22 -06:00
parent 5aa7ba6f30
commit aaa289c7b6
3 changed files with 21 additions and 2 deletions

View File

@ -148,6 +148,12 @@
(shelly-install "redundant packages ignored"
(~a tmp-dir"pkg-test1/ "tmp-dir"pkg-test1/")
$ "racket -e '(require pkg-test1)'")
(shelly-install "already-installed error before no-such-file error"
"test-pkgs/pkg-test1/"
$ "raco pkg install no-such-dir/pkg-test1.zip"
=exit> 1
=stderr> #rx"already installed")
(shelly-case
"conflicting package names disallowed"

View File

@ -75,6 +75,12 @@
(finally
(delete-directory/files tmp2-dir)))
(shelly-case
"not installed error before file-not-found error"
$ "raco pkg update --user no-such-file.zip"
=exit> 1
=stderr> #rx"not currently installed")
(shelly-wind
$ "mkdir -p test-pkgs/update-test"
$ "cp -f test-pkgs/pkg-test1.zip test-pkgs/update-test/pkg-test1.zip"

View File

@ -817,6 +817,7 @@
#:update-cache [update-cache (make-hash)]
#:catalog-lookup-cache [catalog-lookup-cache (make-hash)]
#:remote-checksum-cache [remote-checksum-cache (make-hash)]
#:check-pkg-early? [check-pkg-early? #t]
#:updating? [updating? #f]
#:quiet? [quiet? #f]
#:use-trash? [use-trash? #f]
@ -839,7 +840,9 @@
download-printf)
given-descs))
(define db (read-pkg-db))
(define db (and (or check-pkg-early?
skip-installed?)
(read-pkg-db)))
(define filtered-descs
(remove-duplicates
@ -884,6 +887,7 @@
#:update-cache update-cache
#:catalog-lookup-cache catalog-lookup-cache
#:remote-checksum-cache remote-checksum-cache
#:check-pkg-early? #f
#:pre-succeed (lambda () (pre-succeed) (more-pre-succeed))
#:updating? updating?
#:quiet? quiet?
@ -1269,6 +1273,7 @@
#:update-cache update-cache
#:catalog-lookup-cache catalog-lookup-cache
#:remote-checksum-cache remote-checksum-cache
#:check-pkg-early? #f
#:quiet? quiet?
#:use-trash? use-trash?
#:from-command-line? from-command-line?
@ -1295,7 +1300,9 @@
(if (pkg-desc? d)
(or (pkg-desc-name d)
(package-source->name (pkg-desc-source d)
(pkg-desc-type d)))
(if (eq? 'clone (pkg-desc-type d))
'name
(pkg-desc-type d))))
(package-source->name d)))
(define info (package-info name wanted? #:db db))
(when (and info