CM: report bad dependencies clearly; fix file-stamp-in-paths

for when `use-compile-file-paths' has multiple subpaths
  Probably merge to 5.0.1
(cherry picked from commit 90ec44f65c)
This commit is contained in:
Matthew Flatt 2010-07-21 12:38:22 -06:00 committed by Eli Barzilay
parent c9e6f5d315
commit 58f48d48f9
2 changed files with 20 additions and 12 deletions

View File

@ -55,15 +55,18 @@
(if p-date (if p-date
p p
(rkt->ss p)))] (rkt->ss p)))]
[mode (car (use-compiled-file-paths))] [modes (use-compiled-file-paths)]
[get-zo-date (lambda (name) [get-zo-date (lambda (name)
(file-or-directory-modify-seconds (ormap
(build-path (lambda (mode)
base (file-or-directory-modify-seconds
mode (build-path
(path-add-suffix name #".zo")) base
#f mode
(lambda () #f)))] (path-add-suffix name #".zo"))
#f
(lambda () #f)))
modes))]
[main-zo-date (and (or p-date (not alt-date)) [main-zo-date (and (or p-date (not alt-date))
(get-zo-date name))] (get-zo-date name))]
[alt-zo-date (and (or alt-date [alt-zo-date (and (or alt-date
@ -199,7 +202,13 @@
[else #f]))))]) [else #f]))))])
(and l (and l
(let ([p (open-output-string)] (let ([p (open-output-string)]
[l (map (lambda (v) (cons (force (car v)) (cdr v))) l)]) [l (map (lambda (v)
(let ([sha1 (force (car v))]
[dep (cdr v)])
(unless sha1
(error 'cm "no SHA-1 for dependency: ~s" dep))
(cons sha1 dep)))
l)])
;; sort by sha1s so that order doesn't matter ;; sort by sha1s so that order doesn't matter
(write (sort l string<? #:key car) p) (write (sort l string<? #:key car) p)
;; compute one hash from all hashes ;; compute one hash from all hashes
@ -458,7 +467,7 @@
(cond (cond
[(not path-time) [(not path-time)
(trace-printf "~a does not exist" orig-path) (trace-printf "~a does not exist" orig-path)
(or (and up-to-date (hash-ref up-to-date orig-path #f)) (or (hash-ref up-to-date orig-path #f)
(let ([stamp (cons path-zo-time (let ([stamp (cons path-zo-time
(delay (get-compiled-sha1 mode path)))]) (delay (get-compiled-sha1 mode path)))])
(hash-set! up-to-date main-path stamp) (hash-set! up-to-date main-path stamp)

View File

@ -105,8 +105,7 @@
(if (eq? alt-file orig-file) (if (eq? alt-file orig-file)
orig-path orig-path
(build-path base alt-file)))] (build-path base alt-file)))]
[(base) (if (eq? base 'relative) 'same base)] [(base) (if (eq? base 'relative) 'same base)])
[(mode) (use-compiled-file-paths)])
(let* ([main-path-d (file-or-directory-modify-seconds orig-path #f (lambda () #f))] (let* ([main-path-d (file-or-directory-modify-seconds orig-path #f (lambda () #f))]
[alt-path-d (and alt-path [alt-path-d (and alt-path
(not main-path-d) (not main-path-d)