racketraco

Undo a `raco pkg update --clone` or `raco pkg install --clone`


I frequently like to use raco pkg install --clone (or raco pkg --update clone if the library is already installed), when I want to work on a library and submit patches.

However, I accidentally ran raco pkg update --clone in the wrong folder, and now I can't seem to get it to move to the correct directory.

I tried simply moving the directory, but racket (understandably) didn't know how to handle that, and I tried just deleting the directory, but that didn't work either.

I could theoretically uninstall the package and reinstall it. But I have a lot of packages that already depend on it installed, and it would be very annoying to have to uninstall all of them, and reinstall them all again.

Do I have any other options, or am I just doomed to manually uninstalling and reinstalling a lot of packages (or just reinstalling the whole Racket distribution)?


Solution

  • Yes, you can convert a --cloneed package back into a regular package. The flag you are looking for is --lookup. What you should do is:

    raco pkg update --lookup <my-package>
    cd to/the/desired/dir
    raco pkg update --clone <my-package>
    

    Note that all --lookup does is tell Racket to use the downloaded copy it has, rather than the cloned repo you had it point to. It does NOT delete the old cloned repo. So if you no longer want it on your system, you have to remove it yourself.

    Additionally, note the use of raco pkg update here. Even if you got into the problem by running raco pkg install --clone ... in the wrong directory, you still should run raco pkg update ... here, because you are only moving where Racket looks to find the package

    Finally, you can use --lookup and --clone at the same time:

    cd to/the/desired/dir
    raco pkg update --lookup --clone <my-package>
    

    I should also note that this answer is based on a similar question from the Racket mailing list