raco setup: add --check-pkg-deps for checking specified collections

This flag enables scalable package dependency checking to a large
degree, although dependencies related to documentation cross
references can escape detection.
This commit is contained in:
Matthew Flatt 2014-07-05 17:36:30 +01:00
parent f5d4093ffa
commit 03413f2298
5 changed files with 31 additions and 9 deletions

View File

@ -113,7 +113,7 @@ flags:
@item{@Flag{P} @nonterm{owner} @nonterm{package-name} @nonterm{maj}
@nonterm{min} --- constrain setup actions to the specified @|PLaneT|
package, in addition to any other specified @|PLaneT| packages or
@nonterm{collections}.}
@nonterm{collection}s.}
@item{@DFlag{tidy} --- remove metadata cache information and
documentation for non-existent collections (to clean up after removal)
@ -175,9 +175,16 @@ flags:
whether dependencies among libraries are properly reflected by
package-level dependency declarations, whether modules are declared
by multiple packages, and whether package version dependencies are
satisfied. Dependency checking uses compiled bytecode and associated
@filepath{.dep} files, and it checks only files that are setup
against only packages that include files that are setup.}
satisfied. Dependency checking uses compiled bytecode, associated
@filepath{.dep} files, and the documentation index. Dependency
checking is disabled by default if any collection is specified for
@exec{raco setup}.}
@item{@DFlag{check-pkg-deps} --- checks package dependencies (unless
explicitly disabled) even when specific collections are provided to
@exec{raco setup}. Currently, dependency checking related to
documentation cross-referencing is constrained to documents among
specified collections.}
@item{@DFlag{fix-pkg-deps} --- attempt to correct dependency
mismatches by adjusting package @filepath{info.rkt} files (which makes
@ -242,7 +249,8 @@ collections during an install:
@commandline{env PLT_SETUP_OPTIONS="-j 1" make install}
@history[#:changed "1.2" @elem{Added @DFlag{fast-break} flag.}]
@history[#:changed "1.2" @elem{Added @DFlag{check-pkg-deps}
and @DFlag{fast-break} flags.}]
@; ------------------------------------------------------------------------

View File

@ -67,6 +67,7 @@
(define-flag-param make-tidy #f)
(define-flag-param make-doc-index #f)
(define-flag-param check-dependencies #t)
(define-flag-param always-check-dependencies #f)
(define-flag-param fix-dependencies #f)
(define-flag-param check-unused-dependencies #f)
(define-flag-param call-install #t)

View File

@ -1,6 +1,7 @@
#lang racket/base
(require syntax/modread
syntax/modcollapse
syntax/modresolve
pkg/lib
pkg/name
racket/set
@ -27,7 +28,8 @@
coll-main?s
coll-modes
setup-printf setup-fprintf
check-unused? fix? verbose?)
check-unused? fix? verbose?
all-pkgs-lazily?)
;; Tables
(define missing (make-hash))
(define skip-pkgs (make-hash))
@ -281,6 +283,12 @@
;; Check use of `mod' (in `mode') from `pkg' by file `f':
(define reported (make-hash))
(define (check-mod! mod mode pkg f dir)
(when (and all-pkgs-lazily?
(not (hash-ref mod-pkg mod #f)))
(define path (resolve-module-path mod #f))
(define pkg (path->pkg path #:cache path-cache))
(when pkg
(init-pkg-internals! pkg)))
(define src-pkg (or (hash-ref mod-pkg mod #f)
'core))
(when src-pkg

View File

@ -45,7 +45,7 @@
#:once-each
[("--tidy") "Clear references to removed, even if not a specified <collection>"
(add-flags '((make-tidy #t)))]
[("--doc-index") "Rebuild documentation indexes, along with specified <collection>s"
[("--doc-index") "Rebuild documentation indexes with specified <collection>s"
(add-flags '((make-doc-index #t)))]
[("-c" "--clean") "Delete existing compiled files; implies -nxi"
(add-flags '((clean #t)
@ -80,6 +80,8 @@
(add-flags '((avoid-main-installation #t)))]
[("-K" "--no-pkg-deps") "Do not check package dependencies"
(add-flags '((check-dependencies #f)))]
[("--check-pkg-deps") "Check package dependencies when <collection>s specified"
(add-flags '((always-check-dependencies #t)))]
[("--fix-pkg-deps") "Auto-repair package-dependency declarations"
(add-flags '((check-dependencies #t)
(fix-dependencies #t)))]

View File

@ -1781,7 +1781,8 @@
setup-printf setup-fprintf
(check-unused-dependencies)
(fix-dependencies)
(verbose))
(verbose)
(not no-specific-collections?))
(set! exit-code 1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1836,7 +1837,9 @@
(do-install-part 'general)
(do-install-part 'post)
(when (and (check-dependencies) no-specific-collections?)
(when (and (check-dependencies)
(or no-specific-collections?
(always-check-dependencies)))
(do-check-package-dependencies))
(done))