Skip to content

Instantly share code, notes, and snippets.

@adamsardar
Created May 11, 2021 09:38
Show Gist options
  • Save adamsardar/225f5e24fad0f564f219e4a55b6667df to your computer and use it in GitHub Desktop.
Save adamsardar/225f5e24fad0f564f219e4a55b6667df to your computer and use it in GitHub Desktop.
Dependencies can be installed with aptitude for much faster build times. However, you are at the mercy of whatever R version is in the repos
pkgDeps <- remotes::local_package_deps('.', dependencies=TRUE);
pkgDeps <- setdiff(pkgDeps, .packages(all.available = TRUE));
debCRANpkgs <- tolower(paste('r-cran-', pkgDeps, sep = ''));
debBIOCpkgs <- tolower(paste('r-bioc-', pkgDeps, sep = ''));
debPkgsAvailable <- RcppAPT::hasPackages(c(debCRANpkgs,debBIOCpkgs));
binariesToInstall <- names(debPkgsAvailable)[which(debPkgsAvailable)];
if(length(binariesToInstall) > 0){
system.time(processx::run('apt-get', c('install', '--no-install-recommends', '--no-install-suggests', '-y', binariesToInstall), echo_cmd = TRUE, echo = TRUE))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment