raco pkg update: fix conflict checking vs. installed being updated

This commit is contained in:
Matthew Flatt 2014-12-17 07:51:04 -07:00
parent 5fe0fa3f03
commit edf562be5e
5 changed files with 42 additions and 15 deletions

View File

@ -7,13 +7,6 @@
(this-test-is-run-by-the-main-test)
(define (set-file path content)
(make-parent-directory* path)
(call-with-output-file*
path
#:exists 'truncate/replace
(lambda (o) (displayln content o))))
(define (make-cat-entry #:name name
#:source source
#:deps [deps null]

View File

@ -9,12 +9,6 @@
(this-test-is-run-by-the-main-test)
(define (set-file path content)
(call-with-output-file*
path
#:exists 'truncate/replace
(lambda (o) (displayln content o))))
(pkg-tests
(define git-exe (find-executable-path
(if (eq? 'windows (system-type)) "git.exe" "git")))

View File

@ -17,7 +17,7 @@
(pkg-tests
(shelly-begin
(initialize-catalogs)
$ "raco pkg create --format plt test-pkgs/pkg-test1/"
$ "raco pkg create --format plt test-pkgs/pkg-test1-not-conflict/"
(shelly-install "only modules are considered for conflicts"
@ -78,6 +78,40 @@
$ "racket -e '(require pkg-test1/conflict)'" =exit> 43
$ "raco pkg remove pkg-test1-conflict"))
(with-fake-root
(shelly-case
"update succeeds when module is moved to dependency"
(define tmp-dir (path->directory-path (make-temporary-file "pkg~a" 'directory)))
(shelly-wind
(define a-dir (build-path tmp-dir "a"))
(make-directory a-dir)
(set-file (build-path a-dir "info.rkt") "#lang info\n(define collection \"a\")\n")
(set-file (build-path a-dir "apple.rkt") "#lang racket/base\n")
(define b-dir (build-path tmp-dir "b"))
(make-directory b-dir)
(set-file (build-path b-dir "info.rkt") "#lang info\n(define collection \"a\")\n")
(set-file (build-path b-dir "apple.rkt") "#lang racket/base\n")
$ (~a "raco pkg install --copy " a-dir " " b-dir)
=exit> 1
=stderr> #rx"packages conflict"
$ (~a "raco pkg install --copy " a-dir)
(set-file (build-path a-dir "info.rkt")
(~a "#lang info\n(define collection \"a\")\n"
"(define deps '((" (~s (path->string b-dir)) ")))\n"))
$ (~a "raco pkg update --auto --copy " a-dir)
=exit> 1
=stderr> #rx"packages conflict"
(delete-file (build-path a-dir "apple.rkt"))
$ (~a "raco pkg update --auto --copy " a-dir)
(finally
(delete-directory/files tmp-dir)))))
(shelly-case
"conflict extra installs"
(for ([c '("test-pkgs/pkg-add-a"

View File

@ -217,4 +217,10 @@
'dependencies
'("pkg-test1"))))
(define (set-file path content)
(call-with-output-file*
path
#:exists 'truncate/replace
(lambda (o) (displayln content o))))
(provide (all-defined-out))

View File

@ -261,7 +261,7 @@
(file-exists? (get-compilation-bytecode-file f))
(file-exists? (get-compilation-bytecode-file (path-replace-suffix f #".ss"))))
(or (not updating?)
(not (equal? pkg-name (path->pkg f #:cache path-pkg-cache)))))
(not (hash-ref simultaneous-installs (path->pkg f #:cache path-pkg-cache)))))
;; This module is already installed
(cons (path->pkg f #:cache path-pkg-cache) mp)]
[else