Skip to content
Snippets Groups Projects
Commit af189842 authored by Florian Angerer's avatar Florian Angerer
Browse files

Clean up old package versions in cache.

parent caed34fa
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,19 @@ pkg.cache.insert <- function(pkg.cache.env, pkg, lib) {
# to produce a ZIP with relative paths, we need to change the working dir
prev.wd <- getwd()
setwd(lib)
# cleanup older package versions
tryCatch({
fs <- list.files(version.dir, full.names=TRUE, recursive=FALSE)
pkg.cached.versions.idxs <- grepl(pkgname, fs)
if (length(pkg.cached.versions.idxs) != 0L) {
log.message("cleaning up old package versions '", fs[pkg.cached.versions.idxs], "'", level=1)
unlink(fs[pkg.cached.versions.idxs], recursive=FALSE)
}
}, error = function(e) {
log.message("could not cleanup old package versions of '", pkgname, "' because: ", e$message)
})
if(zip(toPath, pkgname, flags="-r9Xq") != 0L) {
log.message("could not compress package dir ", fromPath , " and store it to ", toPath, level=1)
return (FALSE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment