Yay: Clearing cache?

Created on 15 Oct 2018  路  8Comments  路  Source: Jguer/yay

Is there a way to add a hook to yay in a way similar to how pacman uses paccache?
I like yay because it keeps a cache, but there doesn't seem to be an automated method of clearing out the cache unless I missed something?

Ideally, I'd like yay to check the cache if there are more than 3 older versions of each package, then delete the rest.

Most helpful comment

Is there a way to keep 3 latest versions?

All 8 comments

--cleanafter and -Sc are both ways to do it.

For smarter clearing use paccache itself. For automation either write your own alpm hook (while will probably be annoying because it will trigger after every install, aur packages are installed one by one after all) or write a timer unit.

But use yay -Sc will remove all caches doesn't it?

Is there a way to keep 3 latest versions?

These two pacman hooks I made work for anyone still interested in this. Keeps last 2 installed versions of upgraded packages and removes folders of uninstalled packages. Adopt for your own user and script location.

Im not sure if i should comment here or not, but given how little i understand about package managers, i would also like a safe and builtin way to remove cache automatically, hopefully allowing me to keep the last 2-3 versions, what's the recommended way to achieve this result?

According to luukvball script, paccache removes yay cache aswell (at least it seem so to me), so wouldn't typing paccache -rk 2 keep me the latest two versions of each package both in pacman and yay?

I don't like those particular hooks. But a hook that uses paccache to remove $PKGDIR and using --cleanafter is probably the best way. If a little awkward due to pacman not really being meant to touch home.

Personally I had some problem too with maintaining yay cache due to low disk space on ssd.

I don't like those particular hooks. But a hook that uses paccache to remove $PKGDIR and using --cleanafter is probably the best way. If a little awkward due to pacman not really being meant to touch home.

I felt the same, especially in multi user desktop setup. For me luukvbaal's hooks (modified) works, but idiomatically it would be wonderful if there was something like yaycache util to do what paccache -rkN or paccache -ruk0 do and yay hook similar to pacman's post-transaction hook - for separation of concerns.

Maybe post-transaction AUR pkg hook in yay will be enough for this? Then pacman itself wouldn't touch /home due to running paccache for yay's cache only, of course if i'm not mistaken.
Unfortunately I'm not go developer to try to implement it by myself.

I'm not sure how i missed this in the past, but there's a closed issue about using 'yay -Sc' to clear all cache, both pacman and yay, asking which one we would like to delete separately.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bazeeel picture bazeeel  路  4Comments

Zeioth picture Zeioth  路  3Comments

tapir picture tapir  路  3Comments

captn3m0 picture captn3m0  路  4Comments

pantuts picture pantuts  路  3Comments