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

Implement Housekeeping features (binenv purge) #176

Open
angrox opened this issue Nov 17, 2021 · 5 comments
Open

Implement Housekeeping features (binenv purge) #176

angrox opened this issue Nov 17, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@angrox
Copy link
Contributor

angrox commented Nov 17, 2021

As a developer I want to have an easy possibility to do housekeeping on my installed binenv binaries in order to keep the storage footprint small over time.

Reason
Over time the used storage of the installed binaries grow for you can easily upgrade but have no specific housekeeping option in place.

Proposed Solution
Integrate a housekeeping function in the install/update and the uninstall feature:

  • binenv update --keep-only-latest
  • binenv uninstall "<1.0.0" (delete everything before version 1.0.0, respectivly < > <= >=)

Workaround
Current solution for me is a helper script that cleans the binenv cache

@angrox angrox changed the title Implement Housekeeping Implement Housekeeping features Nov 17, 2021
@leucos
Copy link
Contributor

leucos commented Nov 17, 2021

Hello. I understand the need, that's an interesting feature.

However the purpose of binenv update is only to update the cache, i.e. what version of which distribution (thing) can be installed.

Also, I guess binenv uninstall "<someversion" would prove pretty useless, given we have hundreds of different binaries ranging various versions.

I suppose some kind of binenv purge --keep-last X could be a better approach I guess ?

@leucos
Copy link
Contributor

leucos commented Nov 17, 2021

In the meantime, binenv uninstall foo && binenv install foo does a pretty good job at cleaning up.

Or for the whole scoop:

for i in $(binenv versions | cut -f1 -d':' | grep -Ev '^(#|binenv)'); do binenv uninstall $i && binenv install $i; done

EDIT: well, the command above is not practical since we have to confirm each uninstall.

@angrox
Copy link
Contributor Author

angrox commented Nov 18, 2021

@leucos You could catch it with an expect script but still: A re-download of the software is just an ugly workaround.

Your suggestion for a purge subcommand would do the the trick, yes

@leucos
Copy link
Contributor

leucos commented Nov 18, 2021

@leucos You could catch it with an expect script but still: A re-download of the software is just an ugly workaround.

Sure

Your suggestion for a purge subcommand would do the the trick, yes

Quite busy on #104 currently, but will look into this afterwards.

@angrox
Copy link
Contributor Author

angrox commented Apr 1, 2022

Workaround: Small shell script for deleting everything but the latest version

#!/bin/bash

BINENV_BIN_DIR="$HOME/.binenv/binaries"

for i in "$BINENV_BIN_DIR"/*
do
  for j in $(ls -t "$i" | tail -n +2)
  do
    echo "rm -rf $i/$j"
    rm -rf "${i:?}/${j:?}"
  done
done

@leucos leucos self-assigned this May 7, 2022
@leucos leucos changed the title Implement Housekeeping features Implement Housekeeping features (binenv purge) Jun 26, 2024
@leucos leucos added the enhancement New feature or request label Jun 27, 2024
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
None yet
Development

No branches or pull requests

2 participants