[plt-scheme] Disabling the compilation manager for system directories?
First, some background: We tend to work with fairly large Scheme
programs (sometimes exceeding 50,000 lines of code), and we reload
them from scratch of a fairly regular basis. Historically, we've
relied on a two-prong approach:
1) Sandbox our code by loading it into a new namespace each time.
2) Compile *.ss files into *.zo files using the compilation manager.
This improves load times by a factor of 5 to 10.
This strategy works fine on Windows, because we have a local, writable
copy of PLTCOLLECTS. But on the Mac, there's a good chance that the
PLTCOLLECTS directory is owned by root. So when we try to enable the
compilation manager, we get the following error:
delete-file: cannot delete file:
"/opt/local/share/mzscheme/371/collects/swindle/compiled/misc.zo"
(Permission denied; errno=13)
Here, we're trying to compile our own *.ss files, stored in the user's
working directory. But the compilation manager is attempting to
recompile system *.ss files in /opt/local/, which is owned by root.
This error is caused by compile-zo, which attempts to delete any
existing *.zo file before compiling:
[else
(when (file-exists? zo-name) (delete-file zo-name))
(with-handlers ([exn:get-module-code?
Unfortunately, there's no way for use to override this behavior
without disabling the compilation manager, because
make-compilation-manager-load/use-compiled-handler/table disables
itself if another module tries to wrap it:
[(not (eq? compilation-manager-load-handler (current-load/use-compiled)))
(trace-printf "skipping: ~a current-load/use-compiled changed ~s"
path
(current-load/use-compiled))
(default-handler path mod-name)]
It looks like the simplest solution is to make a local copy of
mzlib/cm.ss, and modify it to check whether directories are writable.
What do people think? Are we insane? Confused? :-) Are we abusing the
compilation manager for tasks it was never meant to handle?
Thank you for any suggestions you can provide!
Cheers,
Eric
http://iml.dartmouth.edu/halyard/