How do I install a local version of scribble, without cloning?

I'm using Racket v8.16 on macOS Sequoia. I'm getting back to hacking scribble after 9 months. I had installed a local git clone of scribble in v8.14. I updated to v8.16 by simply installing the distribution. Of course this overlaid my local version of scribble. I'd prefer not to create a new git clone of scribble and then merge my changes into it. I would prefer to just keep using my existing Git repo. I've already merged the latest commits on the master branch into it.

Is there a way to persuade raco pkg to do this?

I wonder if raco pkg migrate 8.4 will automatically pick up your old clone? (I assume "18" was a typo)

Yeah, it was a typo. I fixed it, it was v8.14. I ended up cloning it, then push the old repo to GitHub, then adding the GitHub repo as a remote, and pulling my code from there.

Next time I update Racket I'll try out the raco pkg migrate command, instead of the little script I use to install my preferred set of packages.

I dropped the directory and it, um, does not break, like this:

raco pkg update --no-setup --clone <PKG>
rm -rf <PKG>
mv <OLD-CLONE> <PKG>
raco setup

Thanks. However, my hope was that I could avoid cloning a rather large git repo, since I already had it on my filesystem. But it's good to know I could have just jammed it in place, instead of pushing and pulling my changes through a shared git repo.

There is way to do this (as done by various GHA workflows in the Racket repos -- DrRacket, Typed Racket, and others all do this), and there are even lower-level Raco commands to do this. But I don't know enough Raco to adapt the commands and fill in the details.

Specifically, the local_catalogs line does some magic (like running pkg/dirs-catalog to get a catalog that points to already cloned repos, setup-racket/src/common.ts at master · Bogdanp/setup-racket · GitHub).

| stevebyan
March 25 |

  • | - |

Thanks. However, my hope was that I could avoid cloning a rather large git repo, since I already had it on my filesystem. But it's good to know I could have just jammed it in place, instead of pushing and pulling my changes through a shared git repo.

Maybe I misunderstood that you're talking about --clone on raco, but git clone <local filesystem path> ought to be very fast, especially with --shared if you want.

If you install from the racket distribution, raco pkg update --clone scribble pulls from the Racket GitHub repositories.

I'm wondering if I'm missing some important context; if I understand what you're saying, I do this all the time, just by running

raco pkg update <path-to-existing-git-repo>

No?

I don’t know. I’m mostly unfamiliar with the package system. I’m just following the instructions on how to contribute to a Racket distribution package:

I gather there are some complications because Scribble is part of the main distribution packages.

I just looked at the docs for raco pkg update, it looks like it should just work as you say. Will that also update dependencies?

Short answer: no, dependencies will not be updated, only the main library.

More detail: I ran a few experiments, and (unsurprisingly) it turns out to be important to specify the directory containing the package. That is, the one with the package-level info.rkt file.

In your case, the scribble repo contains a bunch of libraries, you probably want to update all of them to point to the ones that are in your repo.

In other words, if your clone lived in your home directory and was named scribble, you'd probably want to run something like

raco pkg update $HOME/scribble/scribble-doc $HOME/scribble/scribble-html-lib $HOME/scribble/scribble-lib $HOME/scribble/scribble-test $HOME/scribble/scribble-text-lib $HOME/scribble/scribble

(I just threw all of the packages in there, I have no ideas which ones you're working on.)

FWIW, I just tested this, cloning the repo in /tmp/ and then updating scribble and scribble-lib (scribble-lib has most of the good stuff, I'm assuming). Raco pkg show will then show where each package is pointing to:

ENG-CLEMENTS-1:/tmp clements> raco pkg show -al | grep scribble    
 scribble                        #f                                          (link "/tmp/scribble/scribble/")
 scribble-doc*                   64a8511ea08dfd823a331d241bd2c32f98fdd75c    (catalog "scribble-doc" "git://github.com/racket/scribble/?path=scribble-doc#c95a16a41636d112ea436335b014c808acba2842")
 scribble-html-lib*              0a4559b0a1ed31c034321d34eefd2bdf84a3e538    (catalog "scribble-html-lib" "git://github.com/racket/scribble/?path=scribble-html-lib#c95a16a41636d112ea436335b014c808acba2842")
 scribble-lib                    #f                                          (link "/tmp/scribble/scribble-lib/")
 scribble-text-lib*              0d8004d864fcb8d5523fcb20000fa7933260f7b6    (catalog "scribble-text-lib" "git://github.com/racket/scribble/?path=scribble-text-lib#c95a16a41636d112ea436335b014c808acba2842")
 scribble-math*              a69b6fad193757de5a62b6a1cabacb7557d02ff7    (catalog "scribble-math" "https://github.com/jsmaniac/scribble-math.git#main")

(scribble-math comes from a different place, it just happens to match my grep pattern here)

... and then, I undid the update of both of these with

raco pkg update --unclone scribble scribble-lib

... because I'm not working on scribble! :slight_smile:

Thanks! This will be handy when the next Racket update comes out.

Yep, it's about time to get that started!