Clean up of yay cache, Can we have a documented way how to do it automaticly?
yay cache can grow monstrously big. Would be nice to have a way to automatically clear it. Fire and forget kinda way.
I tried to make systemd service that would run yay -Sc --aur --noconfirm
But that fails cuz yay can only do shit in context of a user that issus the command, I think.
Is there currently a way that one can setup where I dont have to worry about yay cache ever growing big? Consider that the space we talk about is not trivial but easily GBs with just few package installs, there should really be easy and foolproof way to just god damn do it all, no matter if there are 19 users on the system with all having their own god damn cache taking up space.. just do them all and let the devil sort them out.
considering arch itself offers this for pacman cache... with just two commands giving this functionality
- sudo pacman -S pacman-contrib
- sudo systemctl enable --now paccache.timer
Maybe aur helper should follow in similar fashion?
Is the ultimate way to just have script that deletes ~/.cache/yay for all users?
Thanks.
If you already know how to do a systemd timer, have you heard about user units?
You can create the .timer and .service files in ~/.local/share/systemd/user/ and then start/enable them with systemctl --user enable yay-cache-clear.timer or something like this. These units are then run as your user, and yay doesn't complain about being run as root. 🙂
--cleanafter
Remove untracked files after installation.
Untracked files are removed with the exception of directories. This allows
VCS packages to easily pull an update instead of having to reclone the entire
repo.
Hey @DoTheEvo , --cleanafter (ex: yay -Y --cleanafter --save to set permanently) should remove most of the files after a build.
(.pkg. files will still be kept which are quite big, making clean after only exclude the latest pkg archive would be a nice addition)
(.pkg. files will still be kept which are quite big, making clean after only exclude the latest pkg archive would be a nice addition)
This is not true, the --cleanafter will also remove .pkg. files.
There is a bug in yay v11.3.* where .pkg. files are removed.
Fixed in next in https://github.com/Jguer/yay/pull/1841/files#diff-11def9b172ef25e724ddf6042ba3efa508764aeef57c0a8a7ca9d0354909a3a6R213
If you already know how to do a systemd timer, have you heard about
userunits? You can create the.timerand.servicefiles in~/.local/share/systemd/user/and then start/enable them withsystemctl --user enable yay-cache-clear.timeror something like this. These units are then run as your user, and yay doesn't complain about being run as root. 🙂
It's more appropriate for user unit to be in ~/.config/systemd/user/.
~/.local/share/systemd/user/ is for units provided by user-level package.
As someone who also wanted a paccache-esque tool for managing yay's cache, I ended up just forking paccache and adapting it for yay: https://github.com/aokellermann/yaycache. It supports all the same options as paccache, includes a systemd service, and is available as an AUR package.
https://github.com/Jguer/yay/issues/1847#issuecomment-1465724637
Ups, I was relying on that bug for a long time and when it stopped removing, I even consider to report it as --cleanafter regression.
Is there a way to restore previous behavior? Maybe with some extra flag?
Context: I'm using wrapper to copy packages to standard /var/cache/pacman/pkg so I don't need any extra clean logic other than pacman have. See
UPD: Did workaround using pacman wrapper + mv instead of makepkg wrapper