diff --git a/pkgs/racket-test/tests/pkg/tests-catalog-links.rkt b/pkgs/racket-test/tests/pkg/tests-catalog-links.rkt index 99edd182df..19d3933ad8 100644 --- a/pkgs/racket-test/tests/pkg/tests-catalog-links.rkt +++ b/pkgs/racket-test/tests/pkg/tests-catalog-links.rkt @@ -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] diff --git a/pkgs/racket-test/tests/pkg/tests-clone.rkt b/pkgs/racket-test/tests/pkg/tests-clone.rkt index a224dd1b32..be06613a3a 100644 --- a/pkgs/racket-test/tests/pkg/tests-clone.rkt +++ b/pkgs/racket-test/tests/pkg/tests-clone.rkt @@ -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"))) diff --git a/pkgs/racket-test/tests/pkg/tests-conflicts.rkt b/pkgs/racket-test/tests/pkg/tests-conflicts.rkt index 885ee692e7..563836fa64 100644 --- a/pkgs/racket-test/tests/pkg/tests-conflicts.rkt +++ b/pkgs/racket-test/tests/pkg/tests-conflicts.rkt @@ -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" diff --git a/pkgs/racket-test/tests/pkg/util.rkt b/pkgs/racket-test/tests/pkg/util.rkt index 80f8360661..b855b28622 100644 --- a/pkgs/racket-test/tests/pkg/util.rkt +++ b/pkgs/racket-test/tests/pkg/util.rkt @@ -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)) diff --git a/racket/collects/pkg/private/install.rkt b/racket/collects/pkg/private/install.rkt index 94ce6f7f64..7484ee3e55 100644 --- a/racket/collects/pkg/private/install.rkt +++ b/racket/collects/pkg/private/install.rkt @@ -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