diff --git a/racket/collects/setup/main.rkt b/racket/collects/setup/main.rkt index 08158b7567..ab099ea2d2 100644 --- a/racket/collects/setup/main.rkt +++ b/racket/collects/setup/main.rkt @@ -74,8 +74,9 @@ (member flag-name flags))) (define-values (print-bootstrapping) - (lambda () - (fprintf (current-output-port) "~a: bootstrapping from source...\n" short-name))) + (lambda (why) + (fprintf (current-output-port) "~a: bootstrapping from source...\n (~a)\n" + short-name why))) (define-values (main-collects-relative->path) (let ([main-collects #f]) @@ -97,7 +98,7 @@ (when (or (on? "--clean") (on? "-c")) (use-compiled-file-paths null) - (print-bootstrapping)) + (print-bootstrapping "command-line --clean or -c")) ;; Load the cm instance to be installed while loading Setup PLT. ;; This has to be dynamic, so we get a chance to turn off compiled @@ -117,21 +118,22 @@ ;; tree, and there's always --clean to turn this ;; off. If an .so file is used, we give up using ;; compiled files. - (let loop ([skip-zo? (null? (use-compiled-file-paths))]) - (when skip-zo? - (print-bootstrapping)) + (let loop ([skip-zo/reason (and (null? (use-compiled-file-paths)) + "empty use-compiled-file-paths")]) + (when skip-zo/reason + (print-bootstrapping skip-zo/reason)) ((call-with-escape-continuation (lambda (escape) ;; Create a new namespace, and also install load handlers ;; to check file dates, if necessary. (parameterize ([current-namespace (make-kernel-namespace)] [use-compiled-file-paths - (if skip-zo? + (if skip-zo/reason null (use-compiled-file-paths))] [current-load (let ([orig-load (current-load)]) - (if skip-zo? + (if skip-zo/reason orig-load (lambda (path modname) (if (regexp-match? #rx#"[.]zo$" (path->bytes path)) @@ -159,24 +161,26 @@ ;; Not a .zo! Don't use .zo files at all... (escape (lambda () ;; Try again without .zo - (loop #t)))))))] + (loop (format "loading non-.zo: ~a" path))))))))] [current-load-extension - (if skip-zo? + (if skip-zo/reason (current-load-extension) (lambda (path modname) (escape (lambda () ;; Try again without .zo - (loop #t)))))]) + (loop "loading an extension")))))]) ;; Other things could go wrong, such as a version mismatch. ;; If something goes wrong, of course, give up on .zo files. (parameterize ([uncaught-exception-handler (lambda (exn) (when (exn:break? exn) (exit 1)) - (if skip-zo? + (if skip-zo/reason (escape (lambda () (raise exn))) (escape - (lambda () (loop #t)))))]) + (lambda () (loop (if (exn:fail? exn) + (regexp-replace* #rx"\n" (exn-message exn) "\n ") + (format "uncaught exn: ~s" exn)))))))]) ;; Here's the main dynamic load of "cm.rkt": (let ([mk (dynamic-require 'compiler/cm