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

Clearing cache? #772

Closed
nnleaf opened this issue Oct 14, 2018 · 17 comments
Closed

Clearing cache? #772

nnleaf opened this issue Oct 14, 2018 · 17 comments

Comments

@nnleaf
Copy link

nnleaf commented Oct 14, 2018

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.

@Morganamilo
Copy link
Contributor

--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.

@Jguer Jguer closed this as completed Oct 17, 2018
@roachsinai
Copy link

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

@roachsinai
Copy link

Is there a way to keep 3 latest versions?

@luukvbaal
Copy link

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.

@jpmvferreira
Copy link

jpmvferreira commented Aug 28, 2019

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?

@Morganamilo
Copy link
Contributor

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.

@nedveed
Copy link

nedveed commented Nov 10, 2019

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.

@jpmvferreira
Copy link

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.

@Kein
Copy link

Kein commented May 5, 2022

yay -Sc offer me to clear yay cache but in reality, after confirming all clear action, my
/home/user/.cache/yay is left untouched

@jpmvferreira
Copy link

I've just run an update, cache folder was 3 Gb, running yay -Sc set it down to 15 Mb:

$ size .cache/yay 
3.0G	.cache/yay

$ yay -Sc
[sudo] password for undercover: 
Packages to keep:
  All locally installed packages

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove all other packages from cache? [Y/n] y
removing old packages from cache...

Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] y
removing unused sync repositories...

Build directory: /home/undercover/.cache/yay
==> Do you want to remove all other AUR packages from cache? [Y/n] y
removing AUR packages from cache...
==> Do you want to remove ALL untracked AUR files? [Y/n] y
removing untracked AUR files from cache...
Removing batsignal-1.5.0-1-any.pkg.tar.zst
Removing batsignal-1.5.0.tar.gz
Removing drawio-desktop-bin-18.0.1-1-x86_64.pkg.tar.zst
Removing drawio-desktop-bin-18.0.1.deb
Removing duplicati-2.0.6.102_canary_2022-04-06.zip
Removing duplicati-latest-2.0.6.102-1-x86_64.pkg.tar.zst
Removing balena-etcher-electron_1.7.9_amd64.deb
Removing etcher-bin-1.7.9-1-x86_64.pkg.tar.zst
Removing ffmpeg-3.4.10.tar.xz
Removing ffmpeg-3.4.10.tar.xz.asc
Removing ffmpeg-compat-57-3.4.10-1-x86_64.pkg.tar.zst
Removing jabref-5.6-1-any.pkg.tar.zst
Removing jabref-5.6.tar.gz
Removing micromamba-0.23.0.tar.bz2
Removing micromamba-bin-0.23.0-1-x86_64.pkg.tar.zst
Removing rustlings-4.7.1-1-x86_64.pkg.tar.zst
Removing skypeforlinux-stable-bin-8.83.0.408-1-x86_64.pkg.tar.zst
Removing skypeforlinux_8.83.0.408-1.x86_64.rpm
Removing spicetify-cli-2.9.8-1-x86_64.pkg.tar.zst
Removing v2.9.8.tar.gz
Removing spotify-1.1.84.716-1-Release
Removing spotify-1.1.84.716-1-Release.sig
Removing spotify-1.1.84.716-1-x86_64-Packages
Removing spotify-1.1.84.716-x86_64.deb
Removing spotify-1:1.1.84.716-1-x86_64.pkg.tar.zst
Removing 1.4.0.tar.gz
Removing srain-1:1.4.0-1-x86_64.pkg.tar.zst
Removing teamspeak-5.0.0beta69-1-x86_64.pkg.tar.zst
Removing teamspeak-client-5.0.0beta69.tar.xz
Removing tor-browser-11.0.11-1-x86_64.pkg.tar.zst
Removing tor-browser-linux64-11.0.11_en-US.tar.xz
Removing tor-browser-linux64-11.0.11_en-US.tar.xz.asc
Removing ttf-iosevka-15.2.0-1-LICENSE.md
Removing ttf-iosevka-15.2.0-1-any.pkg.tar.zst
Removing ttf-iosevka-15.2.0.zip
Removing ttf-unifont-14.0.03-1-any.pkg.tar.zst
Removing unifont-14.0.03.tar.gz
Removing unifont-14.0.03.tar.gz.sig
Removing ventoy-1.0.74-linux.tar.gz
Removing ventoy-bin-1.0.74-1-x86_64.pkg.tar.zst
Removing zoom-5.10.4-1-x86_64.pkg.tar.zst
Removing zoom-5.10.4.2845_orig_x86_64.pkg.tar.xz

$ size .cache/yay
14M	.cache/yay

@arch-user-france1
Copy link

arch-user-france1 commented Jun 9, 2022

yay -Sc offer me to clear yay cache but in reality, after confirming all clear action, my /home/user/.cache/yay is left untouched

I experienced the same today. Yay -Sc does not do anything. Still 37GB .cache/yay.

@pulga10
Copy link

pulga10 commented Jun 11, 2022

yay -Sc offer me to clear yay cache but in reality, after confirming all clear action, my /home/user/.cache/yay is left untouched

I'm having the same problem. The issue seems to be, that the dialogues cannot handle non-english keyboard input. In my case (german) it asks [J/N] instead of [Y/N], however pressing J, Y or Z (since Y and Z are swapped in german layout) is interpreted as "no". A workaround is just pressing Return on the last prompt.

@beyond9thousand
Copy link

Why is this issue closed?

@gdbd
Copy link

gdbd commented Aug 17, 2022

yay -Sc now works for me, and clean specified folder

@ralyodio
Copy link

ralyodio commented Dec 3, 2022

how do i rebuilt cache? A bunch of apps no longer load now.

@Morganamilo
Copy link
Contributor

Packages don't depend on yay cache. So I don't know what you're experiencing. It's likely unrelated.

@aokellermann
Copy link

I built https://github.com/aokellermann/yaycache as a tool that supports paccache features to manage yay's cache. There is also a hook available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests