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 a70b3173b2)
This commit is contained in:
Matthew Flatt 2014-07-15 07:15:17 +01:00 committed by Ryan Culpepper
parent 47aa868b0d
commit a23cce0b07
2 changed files with 35 additions and 10 deletions

View File

@ -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")))

View File

@ -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)