From 652545913a714bed3a2a983c6ea04d4373d1015f Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Mon, 1 Jul 2024 18:42:33 +0200 Subject: [PATCH] Delete orphaned packages Closes https://github.com/r-universe-org/help/issues/435 --- R/setup.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/R/setup.R b/R/setup.R index 8405425..8f006b5 100644 --- a/R/setup.R +++ b/R/setup.R @@ -61,6 +61,15 @@ setup_universes <- function(){ lapply(deleted, delete_universe_repo, only_if_empty = FALSE) } } + + # Remove packages that do not belong to an existing universe + orphans <- setdiff(stats$universe, universes) + if(length(orphans) > 10){ + stop("More than 10 orphan universes found:", paste(orphans, collapse = ', ')) + } + lapply(orphans, function(x){ + try(delete_universe_repo(x)) + }) } #' @export