Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command to remove outdated packages/binaries #2942

Open
reitzig opened this issue Jun 5, 2024 · 2 comments
Open

Command to remove outdated packages/binaries #2942

reitzig opened this issue Jun 5, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@reitzig
Copy link

reitzig commented Jun 5, 2024

Feature Overview

As a (power 😇) user, I want to maintain my user-space, cross-project tooling with aqua without blowing up storage usage over time.

I understand that an automatism is hard to conceive of, due to the highly dynamic and semi-stateless way aqua works. However, a command for me to call would solve my use case; I would just integrate it into my upgrade routine.

Why is the feature needed?

When I frequently upgrade tools installed through aqua, it assembles quite a volume of files. After just a few days of usage, I have:

🐧❯ du -sh ~/.local/share/aquaproj-aqua/
1,2G	/home/raphael/.local/share/aquaproj-aqua/

Meanwhile, a clean install results in

🐧❯ aqua list -a --installed | wc -l
21
🐧❯ du -sh ~/.local/share/aquaproj-aqua
862M	/home/raphael/.local/share/aquaproj-aqua

With a few rather active tools in my list, I expect to need a cleanup routine sooner rather than later.

Workaround

While I can definitely

aqua rm --all

and rely on lazy install, depending on when/where the install triggers, the experience is less than pretty. For instance, with direnv/direnv and starship/starship:

🐧❯ aqua rm --all
INFO[0000] removing all packages                         aqua_version=2.29.0 env=linux/amd64 program=aqua
/home/raphael/.local/share/aquaproj-aqua/pkgs/github_release/github.com/direnv/direnv/v2.34.0/direnv.linux-amd64/direnv.linux-amd64: command not found
- (line 3): 
        "/home/raphael/.local/share/aquaproj-aqua/pkgs/github_release/github.com/direnv/direnv/v2.34.0/direnv.linux-amd64/direnv.linux-amd64" export fish | source;
        ^
in function '__direnv_export_eval'
in event handler: handler for generic event “fish_prompt”
INFO[0000] download and unarchive the package            aqua_version=2.29.0 env=linux/amd64 exe_name=starship package_name=starship/starship package_version=v1.19.0 program=aqua registry=standard
[WARN] - (starship::modules::custom): Executing custom command "env | grep -c KUBE" timed out.
[WARN] - (starship::modules::custom): You can set command_timeout in your config to a higher value or set ignore_timeout to true for this module to allow longer-running commands to keep executing.

I guess I could do this as an "atomic" action:

aqua rm --all && aqua install -a

But then I would always re-download all tools, which seems a waste of time and bandwidth.

Example Code

I imagine we could have something like:

$ aqua rm --outdated

This would delete all versions except the latest ones.

(This would, of course, cause re-installs for all projects that pin an older version. For me, that'd be acceptable.)

Note sure how one would encode "delete all versions but the ones pinned in the global config" -- --all means different things to aqua install and aqua rm. 🤔

Maybe a dedicated command like

$ aqua clean [--all]

could delete all versions but the once references in the current scope?

Note

I found this, which seems to leave room for future discussions:

You may want to keep the latest version and delete only old versions, but we don't support it now.
Lazy Install will reinstall the latest version.
#538

So here I am. 😁

@reitzig reitzig added the enhancement New feature or request label Jun 5, 2024
@suzuki-shunsuke suzuki-shunsuke moved this to Todo in main Jun 5, 2024
@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Jun 5, 2024

Thank you for your proposal.

I think this proposal makes sense.

I think we need to do the following things.

  1. Search the directory AQUA_ROOT_DIR and get the list of installed packages and their versions
  2. Compare versions and get the latest version by each package
  3. Delete old versions

https://aquaproj.github.io/docs/reference/registry-config/#package-types

  • 🟢 cargo
  • 🟢 github_archive
  • 🟢 github_content
  • 🟢 github_release
  • 🟢 go_build
  • ❌ go_install
  • ❌ http

Another solution is to use a machine with enough storage lol.

@suzuki-shunsuke
Copy link
Member

Related proposal:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Todo
Development

No branches or pull requests

2 participants