<div dir="ltr">Thanks! (For one, I found the "From Back There to Here" section particularly helpful.)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 13, 2013 at 1:56 PM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here's a big-picture update of where we are in the new package system<br>
and the conversion of the Racket distribution to use packages.<br>
<br>
This message covers<br>
<br>
- how I see things working after the package system and<br>
reorganization is done, and a report on what pieces are still<br>
missing to reach that vision;<br>
<br>
- a look at how we got to our current design/reorganization choices<br>
and whether we're choosing the right place; and<br>
<br>
- speculation on why the package changes have been so difficult to<br>
implement.<br>
<br>
All of that makes it a long message (sorry!), but I hope this message<br>
is useful to bring us more in sync.<br>
<br>
<br>
A Package-Based Racket<br>
----------------------<br>
<br>
Let's take a look at how you'll do various things in the new<br>
package-based Racket world.<br>
<br>
(There's no new information here, and parts marked with "[guess]" are<br>
especially speculative. Still, some details may be clearer than in<br>
earlier accounts, now that much of it is implemented, and I think a<br>
comprehensive review may be useful.)<br>
<br>
** Downloading release installers from PLT<br>
<br>
The "<a href="http://www.racket-lang.org" target="_blank">www.racket-lang.org</a>" site's big blue button will provide the same<br>
installers that it does now, at least by default. That is, the content<br>
provided by the installer --- DrRacket, teaching languages, etc. ---<br>
will be pretty much the same as now.<br>
<br>
The blue button might also provide the option of "Minimal Racket"<br>
installers, which gives you something that's a small as we can make it<br>
and still provides command-line `raco pkg'.<br>
<br>
** Downloading installers from other distributors<br>
<br>
There are all sorts of reasons that the "main distribution" from PLT<br>
might not fit the needs of some group. Maybe the release cycle is too<br>
long or at the wrong time. Maybe it includes much too much, much too<br>
little, or almost the right amount but missing a crucial<br>
package. Maybe the group wants something almost minimal, but still<br>
with a graphical package manager. Maybe some group uses a platform for<br>
which PLT does not provide an installer.<br>
<br>
For many of those groups, using a "Minimal Racket" installer plus<br>
selective package installations will do the trick. For others,<br>
creating a special set of installers might be worthwhile, but there<br>
are too many reasons and too many permutations for PLT to provide<br>
installers that cover all of them.<br>
<br>
Fortunately, anyone can build a set of installers and put them on a<br>
web page, and we make it as easy as possible to build a set of<br>
installers that start with a given set of packages. PLT could host a<br>
web page or wiki that points to other distributors. PLT might even be<br>
able to provide an automated service that generates a set of<br>
installers for a basic set of platforms.<br>
<br>
** Compiling a release from source<br>
<br>
In addition to installers, a download site can provide a source-code<br>
option (not specific to any platform, unlike the current source<br>
packages), which would mainly be used for building Racket on<br>
additional platforms.<br>
<br>
This option is mostly a snapshot of the source-code repository for the<br>
core, but it includes a pre-built "collects" tree (see "technical<br>
detail", below) and a default configuration that points back to the<br>
distributor's site for pre-built packages.<br>
<br>
** Adding or upgrading supported packages<br>
<br>
In much the same way that you can easily install a set of supported<br>
packages on your current OS, you'll be able to easily install a set of<br>
packages that are supported by your distributor. Those packages are<br>
pre-built, so they install quickly, along with any included<br>
documentation.<br>
<br>
Depending on the distributor and installer, packages might be<br>
downloaded and installed in "binary" form, which means that tests and<br>
source code (for libraries and documentation) are omitted from the<br>
package. PLT seems unlikely to provide such installers in the near<br>
future.<br>
<br>
The default package scope configured by a distribution tends to be<br>
"user", which means that packages are installed in a user-specific<br>
location.<br>
<br>
Package updates can be made available by distributors for whatever<br>
reason and on whatever timetable see they fit.<br>
<br>
If your distribution is from PLT, then the supported packages are<br>
called "ring-0" packages. Ring-0 packages include contributions from<br>
third parties (i.e., not just packages implemented by PLT) that are<br>
vetted and regularly tested by PLT.<br>
<br>
[Guess:] The "Racket" and "Minimal Racket" distributions might point<br>
to different pre-built package catalogs. Possibly, the "Racket"<br>
catalog never updates packages that were included in the installer (on<br>
the grounds that the user may not have write permission to the<br>
install), while the "Minimal Racket" catalog includes more frequent<br>
updates for bug fixes (on the grounds that the user can update any<br>
installed package).<br>
<br>
A distributor doesn't necessarily have to provide its own package<br>
catalog. It can instead supply an installer that works with packages<br>
as served by some other distributor's catalog, such as PLT's<br>
catalog. (See "technical detail" below.)<br>
<br>
A user can also redirect `raco pkg' to a different catalog server,<br>
instead of using the configuration that was supplied by the<br>
installer. Binary, pre-built, and source variants of a package can be<br>
"updated" to each other in any direction.<br>
<br>
** Adding or upgrading other packages<br>
<br>
An installer-provided configuration will normally point to a catalog<br>
of packages that are not specifically supported by the distributor but<br>
are still readily available --- probably mostly in source form and<br>
directly pulled from a git repository. In particular,<br>
"<a href="http://pkg.racket-lang.org" target="_blank">pkg.racket-lang.org</a>" provides packages in source form.<br>
<br>
** Reading documentation<br>
<br>
A distribution site provides online documentation (including all<br>
supported packages) alongside installers and packages.<br>
<br>
Many installers and packages include documentation to be installed on<br>
a user's machine, but there are some packages that provide libraries<br>
without documentation. For example, "gui-lib" provides GUI libraries<br>
without local documentation, while "gui" combines "gui-lib" local<br>
documentation and the libraries.<br>
<br>
Sometimes, documentation that is installed locally will still refer to<br>
documentation that is not downloaded. Such links are directed back to<br>
the distributor's site. That situation won't happen often for<br>
pre-built packages, because links that go to other packages will tend<br>
to go to packages that are dependencies. It will happen more for<br>
binary packages, because the dependency can be build-time only.<br>
<br>
** Creating new packages<br>
<br>
A minimal package is a directory. So, let's suppose that you have some<br>
modules in a directory that you want to turn into a package. Suppose<br>
that your directory is called "potato", and it has module a file<br>
"eat.rkt".<br>
<br>
Turn your directory into a locally installed package with<br>
<br>
raco pkg install --link potato<br>
<br>
Then, you can use "eat.rkt" with<br>
<br>
(require potato/eat)<br>
<br>
To give your package to someone else, you could zip up the "potato"<br>
directory as "potato.zip", and the other person would install with<br>
<br>
raco pkg install potato.zip<br>
<br>
Note that you can use any zip archiving tool, or you can use<br>
<br>
rack pkg create --form-install potato<br>
<br>
to create the ".zip" file, which has the advantage that directories<br>
like "compiled" and ".git" are omitted.<br>
<br>
Even better, maybe your directory is already on GitHub at<br>
"<a href="http://github.com/idaho/potato" target="_blank">http://github.com/idaho/potato</a>". Then, others can install your<br>
package with<br>
<br>
raco pkg install github://<a href="http://github.com/idaho/potato/master" target="_blank">github.com/idaho/potato/master</a><br>
<br>
If you push changes to your GitHub repository, others can get them<br>
with<br>
<br>
raco pkg update potato<br>
<br>
If you're ready for the world to use your package, then go to<br>
"<a href="http://pkg.racket-lang.org" target="_blank">pkg.racket-lang.org</a>" and point the package name "potato" at your<br>
GitHub repository. Then, not only will others know about your package,<br>
they'll be able to install it with<br>
<br>
raco pkg install potato<br>
<br>
Finally, if you'd like PLT to include your package as a pre-built<br>
package with each snapshot and release, then go back to<br>
"<a href="http://pkg-racket-lang.org" target="_blank">pkg-racket-lang.org</a>" and request ring-0 status for the package.<br>
Ring-0 status may require a few bureaucratic improvements to your<br>
package, such as including an "info.rkt" file if you don't have one<br>
already, because those details are needed to keep your package in<br>
working order.<br>
<br>
** Using the cutting edge<br>
<br>
PLT provides one or more snapshot sites that work the same as the<br>
release site, except that each snapshot's catalog expires after a few<br>
days. When that catalog goes away, you can continue to use the<br>
snapshot, but you'll have to get packages and updates via source.<br>
<br>
** Using the bleeding edge<br>
<br>
A user who wants to work with the minute-by-minute latest can start by<br>
cloning the core Racket git repository, `configure', `make', and `make<br>
install' to get a Minimum Racket build. Then, start installing<br>
packages with `raco pkg'.<br>
<br>
The default package catalog in built-from-source Racket is<br>
"<a href="http://pkg.racket-lang.org" target="_blank">pkg.racket-lang.org</a>", which means that you get all packages in source<br>
form from various git repositories, including for PLT-maintained<br>
packages. The default package scope is "installation".<br>
<br>
If you run `raco pkg update -a', then you likely get updates and<br>
trigger many compiles. Eventually, an update will fail, because your<br>
core Racket version is too old, and you'll need to `git pull',<br>
`configure', `make', and `make install' --- if you haven't been doing<br>
that, anyway. Since packages were added with installation-wide scope,<br>
`make install' rebuilds your previously installed packages, too.<br>
<br>
** Using the bleeding edge as a PLT developer<br>
<br>
As a convenience to PLT developers, who tend to work on a particular<br>
set of packages, there is an alternate way of working on the bleeding<br>
edge (which anyone can use, if they prefer).<br>
<br>
[Guess #1:] Instead of cloning the core Racket repo, clone a "main<br>
distribution" repo that has the core Racket repo as a submodule, plus<br>
git submodules for each of the packages that are dependencies of<br>
"main-distribution". In other words, you get something that looks like<br>
the current Racket repo, but that uses git submodules.<br>
<br>
[Guess #2:] Instead of cloning the core Racket repo from GitHub, you<br>
clone from the "main distribution" repository, just like now. In<br>
addition to being mirrored to GitHub directly, individual parts of the<br>
"main distribution" repo are mirrored as GitHub repositories, and<br>
the mirrors are the ones that "<a href="http://pkg.racket-lang.org" target="_blank">pkg.racket-lang.org</a>" references.<br>
<br>
GitHub repositories that correspond to packages (submodules in guess<br>
#1, mirrored subtrees in guess #2) are registered with<br>
"<a href="http://pkg.racket-lang.org" target="_blank">pkg.racket-lang.org</a>", which is how users on the bleeding-edge might<br>
normally get the packages.<br>
<br>
** Becoming a distributor<br>
<br>
If you want to create installers like PLT's, then it's simplest to<br>
clone the git repo like a PLT developer, and then use `make<br>
installers'.<br>
<br>
Alternatively, you can use `make installers-from-catalog' to create a<br>
set of installers based on packages pulled from a specified catalog.<br>
<br>
Either way, if you want to piggy-back on some other installer's set of<br>
pre-built packages, then configuration options and/or makefile targets<br>
to do that. (This is more sketchy; see below.)<br>
<br>
** Taking your own snapshot of Racket and packages:<br>
<br>
Sometimes, you don't need to build installers, but you'd still like a<br>
snapshot of the current Racket core and package. You might want to<br>
edit the snapshot to upgrade some packages while keeping others the<br>
same.<br>
<br>
The `raco pkg catalog-copy' command is one of many tools to manipulate<br>
catalog servers. For packages that are mapped to GitHub repositories,<br>
merely copying a catalog doesn't archive the code, but it archives a<br>
particular commit id. It's always possible to grab a copy of a package<br>
repository and reference the copy from a catalog.<br>
<br>
<br>
A Technical Detail<br>
------------------<br>
<br>
Starting from scratch twice with the same Racket sources does not lead<br>
to compatible pre-built packages, unfortunarely, because bytecode<br>
files are generated deterministically. Maybe we'll be able to fix<br>
that, one day.<br>
<br>
Meanwhile, pre-built packages depend on a particular build of the<br>
libraries in "collects", as well as a particular build of any<br>
dependencies. So, if a distributor wants to enable other distributors<br>
that use the same catalog of pre-built packages, the distributor must<br>
serve a "collects" tarball, too. Providing the "collects" will be<br>
built into the snapshot support.<br>
<br>
<br>