asdf-vm / asdf-erlang

Erlang plugin for asdf version manager

Home Page:https://github.com/asdf-vm/asdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can cached kerl archives be cleaned up?

CraigCottingham opened this issue · comments

I currently have 28 tarballs in ~/.asdf/plugins/erlang/kerl-home/archives taking up 1.6 GB of space for only three versions of Erlang installed. Can any or all of these files be deleted? Is there a cleanup command somewhere that I'm missing?

@CraigCottingham I think so. However, the kerl docs don't explain how to manage the KERL_DOWNLOAD_DIR, and there don't appear to be any kerl commands for removing those archives. I tried running ./kerl cleanup all and that did not remove them:

$ ls  ~/.asdf/plugins/erlang/kerl-home/archives    
OTP-20.0.tar.gz      OTP-20.3.6.tar.gz    OTP-21.3.2.tar.gz    OTP-22.0.7.tar.gz    OTP-22.2.8.tar.gz    OTP-23.0.2.tar.gz    OTP-23.1.5.tar.gz    OTP-23.2.5.tar.gz    OTP-24.0.6.tar.gz    OTP-24.1.4.tar.gz
OTP-20.1.tar.gz      OTP-20.3.8.22.tar.gz OTP-21.3.8.2.tar.gz  OTP-22.1.5.tar.gz    OTP-22.3.tar.gz      OTP-23.0.3.tar.gz    OTP-23.2.3.tar.gz    OTP-23.2.tar.gz      OTP-24.0.tar.gz      OTP_R16B03-1.tar.gz
OTP-20.2.3.tar.gz    OTP-20.3.tar.gz      OTP-21.3.8.tar.gz    OTP-22.1.8.tar.gz    OTP-23.0.1.tar.gz    OTP-23.0.tar.gz      OTP-23.2.4.tar.gz    OTP-24.0.5.tar.gz    OTP-24.1.3.tar.gz

$ ./kerl cleanup all
Cleaning up compilation products for ALL builds
Cleaned up all compilation products under /Users/trevorbrown/.kerl/builds

$ ls  ~/.asdf/plugins/erlang/kerl-home/archives
OTP-20.0.tar.gz      OTP-20.3.6.tar.gz    OTP-21.3.2.tar.gz    OTP-22.0.7.tar.gz    OTP-22.2.8.tar.gz    OTP-23.0.2.tar.gz    OTP-23.1.5.tar.gz    OTP-23.2.5.tar.gz    OTP-24.0.6.tar.gz    OTP-24.1.4.tar.gz
OTP-20.1.tar.gz      OTP-20.3.8.22.tar.gz OTP-21.3.8.2.tar.gz  OTP-22.1.5.tar.gz    OTP-22.3.tar.gz      OTP-23.0.3.tar.gz    OTP-23.2.3.tar.gz    OTP-23.2.tar.gz      OTP-24.0.tar.gz      OTP_R16B03-1.tar.gz
OTP-20.2.3.tar.gz    OTP-20.3.tar.gz      OTP-21.3.8.tar.gz    OTP-22.1.8.tar.gz    OTP-23.0.1.tar.gz    OTP-23.0.tar.gz      OTP-23.2.4.tar.gz    OTP-24.0.5.tar.gz    OTP-24.1.3.tar.gz

I am going to see if I can move this issue thread to the kerl repository because I think at the very least some documentation updates are needed there.

I heard back on the kerl issue I opened. I forgot to set the KERL_BASE_DIR variable before running the cleanup command:

$ KERL_BASE_DIR=~/.asdf/plugins/erlang/kerl-home/ ./kerl cleanup all

I didn't run it, but it should work. After reviewing the code for this plugin I realized the best way to solve this is going to involve a few steps:

  • Update this plugin code so kerl stores downloads in the ASDF_DOWNLOAD_PATH directory as it should. ASDF_DOWNLOAD_PATH is directory that is created to store a specific version of a specific tool. (e.g. ~/.asdf/downloads/erlang/24.2). This will allow asdf core to manage the downloads. PR #238 handles this.
  • Add a command to asdf core to allow viewing and removal of one or all downloads of one or all tools. Everything under the hood is already present for this. asdf core just needs to add a command so the user can trigger cleanup. This will be implemented soon.

In the meantime, feel free to run KERL_BASE_DIR=~/.asdf/plugins/erlang/kerl-home/ ./kerl cleanup all manually if you like. But also note that once #238 is merged this will no longer work.

#238 has been merged, which means if you are now using the latest version the above workaround will no longer work. However, if you still want to clean up old downloads you should be able to navigate to ~/.asdf/downloads/erlang/ and delete the archives that you no longer want to keep. This shouldn't cause any issues for kerl.