Raco pkg migrate

raco pkg migrate reinstalls all the packages you had in a previous installation
Specifically, I just ran raco pkg migrate 8.4 after installing 8.5

(Copied from @benknoble on discord)

3 Likes

I just want to remark that this only works for user package scope, as stated in the documentation:

raco pkg migrate ‹option› ... ‹from-version› — Installs packages that were previously installed in user package scope for ‹from-version›, where ‹from-version› is an installation name/version.

This makes sense because otherwise raco pkg migrate wouldn't be able to find the packages if they're in a "non-standard" location.

When I run raco pkg migrate 8.4, I get

$ raco pkg migrate 8.4
No packages from "8.4" to install

What about a different message, something like

Didn't find any packages to migrate from Racket 8.4. `raco pkg migrate` can only migrate packages that were installed in user scope, see https://docs.racket-lang.org/pkg/Package_Concepts.html#%28tech._package._scope%29 .

(A shorter URL would be nicer, of course.) I'm sure that message isn't perfect either. Maybe someone else has a better idea?

3 Likes

I like the improvement! Are there lots of packages that aren't user scope (either by requirement or by choice)? For some reason I expect that to be rare.

1 Like

As far as I know the scope is a property of your Racket installation. You can set it with raco pkg config, described in the package management FAQ.

Edit: User scope is the default, so the raco pkg migrate command should work most of the time, i.e. when you haven't changed the scope. (I don't know if there are other limitations for raco pkg migrate apart from the scope.)

At some point I had set the scope to installation because there was a problem with raco cross and user scope and kept the habit. But maybe it's fixed now and I should leave my Racket 8.5 installation at user scope and give it a try. :slight_smile: