How to install an updated version of an installation-wide package?

135 views
Skip to first unread message

Reuben Thomas

unread,
Nov 5, 2019, 1:18:18 PM11/5/19
to Racket Users
I'm trying to make a small improvement to the drracket package, and of course I'd like to test it!

I have racket 7.4 installed on my Ubuntu system from the PPA, so of course drracket is installed as part of the installation.

After reading the "raco pkg" docs, and searching the mailing list, I can't figure out how to make a user installation of the drracket package so I can test it. My best attempt so far is something like:

raco pkg install ./drracket
raco pkg install: package is currently installed in a wider scope
  package: drracket
  installed scope: installation
  given scope: user

Of course, I don't want to overwrite the installation's version of drracket, I just want a user installation that takes precedence.

I'm a total newbie with raco, so sorry if I've overlooked something obvious.

John Clements

unread,
Nov 5, 2019, 2:01:48 PM11/5/19
to Reuben Thomas, Racket Users
It looks to me like you’re looking for “raco pkg update —clone” or “raco pkg update —link”, but I may be mistaken.

Specifically, running

raco pkg update —clone drracket

in, say, your home directory should clone the package that includes the drracket collection (and possibly others that are in the same package). After this is complete, your drracket should depend on this version of the collection, rather than the installed one.

Apologies in advance if I’ve misunderstood your problem.

Best,

John Clements
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/2e5eee6b-2081-464a-b780-e9a8c65fc269%40googlegroups.com.



Alex Harsanyi

unread,
Nov 5, 2019, 6:48:41 PM11/5/19
to Racket Users
I wrote some notes about how to do something similar, when I worked on the plot package:


These instructions will work for the case where Racket is installed globally and your current user does not have permissions to modify any files in this global Racket installation.  They might not be the simplest ones however, as I am not a raco pkg package expert either.

Hope this helps,
Alex.

Matthew Flatt

unread,
Nov 7, 2019, 8:37:52 AM11/7/19
to Alex Harsanyi, Racket Users
It's not technically ok to shadow a package in installation scope with
one in user scope, at least not if any package in installation scope
depends on the shadowed package. (That's why you have to use `--force`
to shadow in `--user` scope.) With that configuration, when the package
changes in user scope, then the installation-scope build is not
necessarily consistent with the changes. Things might work out anyway;
it depends on the nature of the dependency and the changes.

The right answer may be a tool that starts with an existing
installation and more quickly clone it into another installation in a
user's space, and then a user can work on a package and rebuild
consistently. The configuration points and general tools to manage
packages are all there, but they need to be assembled and made
easy-to-use.

Meanwhile, the current tools are better set up for starting with a
GitHub checkout and building there. In that setting, for example, it's
easier to use `raco pkg update --clone` to get started, as described at

https://docs.racket-lang.org/racket-build-guide/contribute.html#%28part._pkg-contribute%29


Matthew
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/3635bd1f-ccde-41eb-b9d4-05cc6c36
> 777b%40googlegroups.com.

Alex Harsanyi

unread,
Nov 7, 2019, 8:27:55 PM11/7/19
to Racket Users
Hi Matthew,

Thanks for clarifying this. 

The question was asked on this list several times in the past, and the suggested approach was always to use `raco pkg update --clone`.  The non-obvious part, at least to me, was that one has to clone and build Racket before starting to work on any package that is shipped with the Racket distribution, even if that package is in a separate repository.

Alex.

Sam Tobin-Hochstadt

unread,
Nov 7, 2019, 8:58:23 PM11/7/19
to Alex Harsanyi, Racket Users
You don't have to do that, there's just one extra step starting from a
pre-built distribution.

If you want to work on the "slatex" package for some reason, you'd do:

$ raco pkg update --lookup --catalog https://pkgs.racket-lang.org/ slatex
...
$ raco pkg update --clone slatex

And then you have the "slatex" package linked to a clone in the
`slatex/` directory where you ran the second command.

Here's a demo: https://asciinema.org/a/lOASUq2O1AT8JHhGyNJzvOcqE

Sam
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/162bbd09-ed9e-4a33-853d-142e170cfc69%40googlegroups.com.

Alex Harsanyi

unread,
Nov 8, 2019, 4:44:23 AM11/8/19
to Racket Users

On my machine, when I run the first command that you suggested, I get:

$ raco pkg update --lookup --catalog https://pkgs.racket-lang.org/ slatex

open
-output-file: cannot open output file
  path
: C:\Program Files\Racket\share\pkgs\_LOCKpkgs.rktd
  system error
: Access is denied.; errid=5
Inferred package scope: installation

The problem is that my racket installation is read-only and cannot be modified by a non-admin user.  I suspect the situation would be the same on Linux, if Racket is installed in /usr/bin as root than the raco pkg update is run by a regular user. 

At least on Windows, Racket will install in C:/Program Files and this location is read-only by default, and anyone who installs Racket and tries to work on a package will encounter this problem: working on a package that ships with Racket requires a writable Racket installation, this was not obvious to me. 

So you are correct that one does not need to build Racket from sources, but "just run this raco command" does not work either...

Alex.

Reuben Thomas

unread,
Nov 8, 2019, 6:41:18 AM11/8/19
to John Clements, Racket Users
On Tue, 5 Nov 2019 at 19:01, John Clements <clem...@brinckerhoff.org> wrote:

raco pkg update —clone drracket

in, say, your home directory should clone the package that includes the drracket collection (and possibly others that are in the same package). After this is complete, your drracket should depend on this version of the collection, rather than the installed one.

Thanks! I tried this and got:

$ raco pkg update --clone drracket
Inferred package name from given `--clone' path
  package: drracket
  given path: drracket
Inferred package scope: installation

open-output-file: cannot open output file
  path: /usr/share/racket/pkgs/.LOCKpkgs.rktd
  system error: Permission denied; errno=13
 
etc.

So I tried again with:

$ raco pkg update --user --clone drracket
Inferred package name from given `--clone' path
  package: drracket
  given path: drracket
raco pkg update: package installed in a different scope
  package: drracket
  current scope: user
  installed in scope: installation

So, neither of those works.

Also, the documentation for --clone says: Clone Git and GitHub package sources to <dir> and link

But I have a clone already where my change to drracket are, so I want to use that, not a fresh clone.

--

Reuben Thomas

unread,
Nov 8, 2019, 6:41:19 AM11/8/19
to Matthew Flatt, Alex Harsanyi, Racket Users
Thanks, Matthew. I'm currently stuck building racket, on which I shall post a separate question, but I shall use this method once I've made that work!



--

Reuben Thomas

unread,
Nov 8, 2019, 6:41:19 AM11/8/19
to Matthew Flatt, Alex Harsanyi, Racket Users
On Thu, 7 Nov 2019 at 13:37, Matthew Flatt <mfl...@cs.utah.edu> wrote:
It's not technically ok to shadow a package in installation scope with

Meanwhile, the current tools are better set up for starting with a
GitHub checkout and building there. In that setting, for example, it's
easier to use `raco pkg update --clone` to get started, as described at

https://docs.racket-lang.org/racket-build-guide/contribute.html#%28part._pkg-contribute%29

Thanks. The one thing that is not obvious in those instructions, which Sam's video makes clearer, is that you need to use raco from the checkout too, e.g. "./racket/bin/raco".

--
Reply all
Reply to author
Forward
0 new messages