diff options
| author | ruki <[email protected]> | 2019-05-09 00:34:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-05-08 21:24:18 +0800 |
| commit | 51af9c5c30a3bd22ca6687b1474d0cccf98a798a (patch) | |
| tree | 56f33d9addbfdb6401fc6f55205a191eb4dfaabc | |
| parent | 93ecf0db9bb7d76dc552c33e57d592c0ec1179a4 (diff) | |
cleanup package cache dir
| -rw-r--r-- | xmake/actions/build/cleaner.lua | 11 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/xmake/actions/build/cleaner.lua b/xmake/actions/build/cleaner.lua index d55c30925..011520674 100644 --- a/xmake/actions/build/cleaner.lua +++ b/xmake/actions/build/cleaner.lua @@ -20,7 +20,9 @@ -- imports import("core.base.option") +import("core.base.global") import("core.project.config") +import("core.package.package") import("core.platform.platform") import("core.platform.environment") @@ -62,7 +64,7 @@ end -- the main function function main() - -- clean up the temporary files at last 30 days + -- clean up the temporary files at last 30 days, @see os.tmpdir() local parentdir = path.directory(os.tmpdir()) for day = 1, 30 do local tmpdir = path.join(parentdir, os.date("%y%m%d", os.time() - day * 24 * 3600)) @@ -71,4 +73,11 @@ function main() os.tryrm(tmpdir) end end + + -- clean up the previous month package cache files, @see package.cachedir() + local cachedir = path.join(global.directory(), "cache", "packages", os.date("%y%m", os.time() - 31 * 24 * 3600)) + if os.isdir(cachedir) and cachedir ~= package.cachedir() then + print("cleanup %s ..", cachedir) + os.tryrm(cachedir) + end end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index eed3081a0..9ddef427d 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -1035,7 +1035,7 @@ end -- the cache directory function package.cachedir() - return path.join(global.directory(), "cache", "packages") + return path.join(global.directory(), "cache", "packages", os.date("%y%m")) end -- the install directory |
