From a23cce0b07ebb8291609bd5e973ea3fcd74affe4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 15 Jul 2014 07:15:17 +0100 Subject: [PATCH] pkg/lib: make `pkg-directory->additional-installs` use 'compile-omit-paths Otherwise, "test/pkgs" claims to provide various documents and executables that are in test packages. Merge to v6.1 (cherry picked from commit a70b3173b24e54fa0ddd8dde2a329d8133c27486) --- .../racket-test/tests/pkg/tests-conflicts.rkt | 11 +++++- racket/collects/pkg/lib.rkt | 34 ++++++++++++++----- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/pkgs/racket-pkgs/racket-test/tests/pkg/tests-conflicts.rkt b/pkgs/racket-pkgs/racket-test/tests/pkg/tests-conflicts.rkt index b59da2b83d..7355aa4ea4 100644 --- a/pkgs/racket-pkgs/racket-test/tests/pkg/tests-conflicts.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/pkg/tests-conflicts.rkt @@ -112,4 +112,13 @@ (with-fake-root (shelly-case "no conflict for non-matching platform" - $ "raco pkg install --strict-doc-conflicts test-pkgs/pkg-add-base test-pkgs/pkg-add-none")))) + $ "raco pkg install --strict-doc-conflicts test-pkgs/pkg-add-base test-pkgs/pkg-add-none")) + + (shelly-case + "compile-omit-paths is used by `pkg-directory->additional-installs`:" + $ (~a "racket -e '(require pkg/lib)' -e '" + (~s '(pkg-directory->additional-installs + (path-only (collection-file-path "test.rkt" "tests/pkg")) + "racket-test")) + "'") + =stdout> "'()\n"))) diff --git a/racket/collects/pkg/lib.rkt b/racket/collects/pkg/lib.rkt index bac966e339..c1c21a4db8 100644 --- a/racket/collects/pkg/lib.rkt +++ b/racket/collects/pkg/lib.rkt @@ -3234,17 +3234,33 @@ #:system-library-subpath [sys-lib-subpath #f]) (define single-collect (pkg-single-collection dir #:name pkg-name #:namespace metadata-ns)) - (let loop ([s (set)] [f dir] [top? #t]) + (let loop ([s (set)] [f dir] [top? #t] [omits (set)]) (cond - [(directory-exists? f) + [(and (directory-exists? f) + (not (set-member? omits (simplify-path f)))) (define i (get-pkg-info f metadata-ns)) - (define new-s - (if (and i (or single-collect (not top?))) - (set-union (extract-additional-installs i sys-type sys-lib-subpath) - s) - s)) - (for/fold ([s new-s]) ([f (directory-list f #:build? #t)]) - (loop s f #f))] + (define omit-paths (if i + (i 'compile-omit-paths (lambda () null)) + null)) + (cond + [(eq? omit-paths 'all) + s] + [else + (define omit-files (if i + (i 'compile-omit-files (lambda () null)) + null)) + (define new-s + (if (and i (or single-collect (not top?))) + (set-union (extract-additional-installs i sys-type sys-lib-subpath) + s) + s)) + (define new-omits + (set-union + omits + (for/set ([i (in-list (append omit-paths omit-files))]) + (simplify-path (path->complete-path i f))))) + (for/fold ([s new-s]) ([f (directory-list f #:build? #t)]) + (loop s f #f new-omits))])] [else s]))) (define (extract-additional-installs i sys-type sys-lib-subpath)