vn971 / rua

Build tool for Arch Linux providing control, review and jailed build options
GNU General Public License v3.0
424 stars 42 forks source link

Feature suggestion: clear cache #145

Closed refaelsh closed 2 years ago

refaelsh commented 3 years ago

Here is a scenario that happened to me. I was doing a rua install foo-bar-package (1 GB download) and the WiFi got disconnected in the middle of the download. This happened several times. I now have multiple fragments downloaded that are eating disk space. I suggest a rua clean cache command to get rid of them.

Thanks.

vn971 commented 3 years ago

@refaelsh hey! In the particular situation that you describe, duplication wouldn't (shouldn't) happen, because only the last build can ever leave garbage.

On the other hand, I imagine it could be nice to have the garbage cleared even for 1 build. I'd imagine two things could help:

What do you think?

refaelsh commented 3 years ago

Sounds great!

vn971 commented 3 years ago

I've added the tags to invite collaboration. (Personally busy with another task ATM, building the seccomp rules on non-x86_64 architectures.)

refaelsh commented 3 years ago

Theoretically, if somebody would open a PR on this, what the command should do? Delete something, right? But what? This folder maybe: ~/.cache/rua/build/foo-bar-package/ or maybe ~/.cache/rua/build/?

vn971 commented 3 years ago

To give an intermediate update, I'm super-busy with work ATM, but I'll really try to get back to it soon!

vn971 commented 3 years ago

Hey, sorry, that was a very slow "soon". I made it within 1 month though! :sweat_smile: (was really busy with personal things and work)

I think ~/.cache/rua/build/foo-bar-package/ can be deleted at the end of a successful build and ~/.cache/rua/build/ can be deleted by rua clean-cache

That should be really straightforward, and an improvement upon the current situation. I think it's a really good thing to do

refaelsh commented 3 years ago

Thank you for the reply. I will try and see wether my Rust skill are not rusted. If they are not, I will open a PR.

refaelsh commented 3 years ago

One more question please. If ~/.cache/rua/build/ gets deleted, would it not break rua upgrade?

vn971 commented 3 years ago

@refaelsh shouldn't, build is only used during build, but not after. Git history of AUR itself is kept in ~/.config/rua/pkg/, then copied inside ~/.cache/rua and built, and the built artifacts are then copied to ~/.local/share/rua. This was done intentionally so that a user can delete the XDG cache and not lose anything important.

See the directories section: https://github.com/vn971/rua#how-it-works--directories

As for figuring out what package needs upgrading, rua solely uses AUR and the local pacman state. E.g. it gets all current local packages, excludes the ones available in pacman itself, and queries AUR for the rest.

refaelsh commented 3 years ago

I will be submitting a PR for this shortly.