Jguer / yay

Yet another Yogurt - An AUR Helper written in Go
GNU General Public License v3.0
11.23k stars 364 forks source link

How to set the number of historical packages to be retained? #2529

Open witt-bit opened 1 week ago

witt-bit commented 1 week ago

Affected Version

yay -V yay v12.4.2 - libalpm v15.0.0

Describe the bug

My computer has a small disk space, and the ~/.cache/yay directory is always full. I have to manually delete some previously downloaded source packages frequently. I hope there is a configuration item in ~/.config/yay/config.json that can configure the number of historical packages to be retained. The yay command can help me delete the source packages that have been built or downloaded before.

yay -Pg

{
    "aururl": "https://aur.archlinux.org",
    "aurrpcurl": "https://aur.archlinux.org/rpc?",
    "buildDir": "/home/witt/.cache/yay",
    "editor": "vim",
    "editorflags": "",
    "makepkgbin": "makepkg",
    "makepkgconf": "",
    "pacmanbin": "pacman",
    "pacmanconf": "/etc/pacman.conf",
    "redownload": "no",
    "answerclean": "",
    "answerdiff": "",
    "answeredit": "",
    "answerupgrade": "",
    "gitbin": "git",
    "gpgbin": "gpg",
    "gpgflags": "",
    "mflags": "",
    "sortby": "votes",
    "searchby": "name-desc",
    "gitflags": "",
    "removemake": "ask",
    "sudobin": "sudo",
    "sudoflags": "",
    "version": "12.4.2",
    "requestsplitn": 150,
    "completionrefreshtime": 7,
    "maxconcurrentdownloads": 5,
    "bottomup": true,
    "sudoloop": true,
    "timeupdate": false,
    "devel": false,
    "cleanAfter": false,
    "keepSrc": false,
    "provides": true,
    "pgpfetch": true,
    "cleanmenu": true,
    "diffmenu": true,
    "editmenu": false,
    "combinedupgrade": true,
    "useask": false,
    "batchinstall": false,
    "singlelineresults": false,
    "separatesources": true,
    "debug": false,
    "rpc": true,
    "doubleconfirm": true,
    "rebuild": "no"
}
jdholtz commented 1 week ago

There's no configuration option AFAIK. There has been discussion in some other issues though. From those discussions, I found a couple of external programs that may help solve your issue: https://github.com/aokellermann/yaycache https://herbort.me/posts/automatically-cleaning-pacman-and-yay-cache-in-arch-linux/

witt-bit commented 1 week ago

There's no configuration option AFAIK. There has been discussion in some other issues though. From those discussions, I found a couple of external programs that may help solve your issue:AFAIK 没有配置选项。不过,还对其他一些问题进行了讨论。从这些讨论中,我发现了一些可能有助于解决您的问题的外部程序: https://github.com/aokellermann/yaycache https://herbort.me/posts/automatically-cleaning-pacman-and-yay-cache-in-arch-linux/

Thank you very much for your patience. yaycache can completely solve my problem. I can currently complete it by configuring yaycache-hook, but I think this should be the default choice for yay to avoid a very large ~/.cache/yay directory. Most users, as light users, may not investigate so deeply. Using yaycache as a dependency by default is beneficial to the promotion of archLinux/manjaro systems and makes it easier for more people to use it.