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

zef keeps some stuff around in ~/.zef/store #179

Open
zoffixznet opened this issue Jun 22, 2017 · 1 comment
Open

zef keeps some stuff around in ~/.zef/store #179

zoffixznet opened this issue Jun 22, 2017 · 1 comment
Labels

Comments

@zoffixznet
Copy link
Contributor

Today my toaster runs started crashing due to low disk space and when I went to investigate what was nomming all my disk space, turned out it was the ~/.zef/store directory.

It contained 4.2GB of stuff and it took rm -fr ~/.zef 4 minutes to complete.

The toaster uses custom --instal-to= directories, so I assume ~/.zef/store isn't the place where installed dists are kept.

What's in that dir and is there any way to make it not keep that much stuff around?

Your Environment

cpan@toaster:~$ perl6 -e 'say $*VM.config<os>'
linux
cpan@toaster:~$ perl6 -v
This is Rakudo version 2017.05-393-g8b86b50 built on MoarVM version 2017.05-71-gad6ab26
implementing Perl 6.c.
cpan@toaster:~$
@ugexe
Copy link
Owner

ugexe commented Jun 23, 2017

~/.zef/tmp   # downloaded to here
~/.zef/store # extracted/checked-out/moved/etc here

Zef::Repository::LocalCache uses a lines based manifest (each line has identifiers and ultimately the path to the distribution). It has a update method and cli invocation (zef update cached) for rebuilding this manfest based on the assumption of a pretty simple folder layout:
$extracted-from-basename/$could-be-anything/* (META6.json, lib/Foo.pm6, etc)

::LocalCache will rebuild itself automatically if its missing, so I usually use zef nuke StoreDir TempDir as a cleanup step. If someone really wants to keep a cache of saved modules that won't be nuked by referring to the StoreDir they can add another cache and point it at a different directory:

    {
        "short-name" : "cached",
        "enabled" : 1,
        "module" : "Zef::Repository::LocalCache",
        "options" : { }
    },
     {
        "short-name" : "historic",
        "enabled" : 1,
        "module" : "Zef::Repository::LocalCache",
        "options" : { "cache" : ".work" }
    },

"cached" has no "options" : { "cache" : ".work" } so it uses the default which is usually ~/.zef/store. "historic" uses $*CWD/.work. zef nuke StoreDir deletes everything in "cached" but "historic" still has everything stored (no nuke command for these custom directories either).

So doing --/cached will appear to be caching things but its not (its just pointing at the directory where stuff is conviently extracted/checked-out to in the proper structure). And --/historic won't cache anything, nor will it appear to (since its directory isn't the directory stuff is being extracted into)

zef nuke StoreDir TempDir is the current solution for clearing the cache (although for gigabytes this is probably slow as hell). Auto cleanup is a possible option.

It might be good to get stats on how much space various distributions use in ~/.zef/store after being installed - I suspect some of the Build.pm files download a whole bunch of stuff. For these I think we need to establish hooks, so that distributions can include clean up code (make clean, etc).

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

No branches or pull requests

2 participants