collects and packages in zip file?

35 views
Skip to first unread message

Dan Liebgold

unread,
Jul 18, 2016, 3:14:45 PM7/18/16
to Racket Developers
Hi all -

If I were to try to zip all files (.rkt, .zo, .dep, etc etc) in the <distro>/collects and <distro>/share/pkgs directories into a couple (or more) .zip archives, what changes would I need to make to Racket to have it only see the files in the given set of .zip archives?

Thanks,
Dan

Matthew Flatt

unread,
Jul 18, 2016, 11:24:18 PM7/18/16
to Dan Liebgold, Racket Developers
If I understand what you mean, the main problem is to support accessing
a zip file's content through the filesystem API.

If there's always a way to mount a zip file as a directory or drive,
then it's a question of starting racket with the right `-X` and `-G`
(or `PLTCOLLECTS` and `PLTCONFIGDIR` environment variables) to point at
the filesystem mount.

If there's not a way to get the OS's filesystem API to view a zip file
content as part of the filesystem, then a solution would involve
building a new filesystem layer into Racket. That seems tedious, at
best, and it's not clear to me how to make it interact well with
foreign libraries that use the OS's API.


If the goal is just to read module implementations from a zip file,
then I think it would be possible to install a module name resolver
(through `current-module-name-resolver`) that looks for modules in the
zip file in much the same way that an executable generated by `raco
exe` installs a module name resolve that finds modules embedded in the
executable.

I don't see how to make the resolve approach work with `raco make`,
though, which expects to be able to find and track modules on the
filesystem. Supporting `raco make` and other tools would, I think,
require extending the search protocol for modules and adapting all
tools (including `raco make` and `raco exe`) to perform that search.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-dev+...@googlegroups.com.
> To post to this group, send email to racke...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-dev/3dd76ad1-5f10-4acf-b886-1dcbd5d336
> 4b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Dan Liebgold

unread,
Jul 21, 2016, 1:02:44 PM7/21/16
to Racket Developers, dan.li...@gmail.com
On Monday, July 18, 2016 at 8:24:18 PM UTC-7, mflatt wrote:
If I understand what you mean, the main problem is to support accessing
a zip file's content through the filesystem API.


Yes, at least as far as "require" is concerned wrt .zo files.

 
If there's always a way to mount a zip file as a directory or drive,
then it's a question of starting racket with the right `-X` and `-G`
(or `PLTCOLLECTS` and `PLTCONFIGDIR` environment variables) to point at
the filesystem mount.


Yes, and fuse-zip seems promising.   AFAIK there's no windows equivalent.
 

If the goal is just to read module implementations from a zip file,
then I think it would be possible to install a module name resolver
(through `current-module-name-resolver`) that looks for modules in the
zip file in much the same way that an executable generated by `raco
exe` installs a module name resolve that finds modules embedded in the
executable.


That sounds promising.
 
I don't see how to make the resolve approach work with `raco make`,
though, which expects to be able to find and track modules on the
filesystem. Supporting `raco make` and other tools would, I think,
require extending the search protocol for modules and adapting all
tools (including `raco make` and `raco exe`) to perform that search.


One possible scenario is that raco make works like usual (no interaction with zip archives), and there's a "post make" step that zips the results up for normal Racket to consume.  The .rkt and .zo files would remain where they are, up to date.
Reply all
Reply to author
Forward
0 new messages