Skip to content

Commit

Permalink
Switch to pak for resolving sysreqs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Nov 4, 2024
1 parent da41c11 commit 4f99494
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions R/buildtools.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,17 @@ install_sysdeps <- function(path = '.'){
}

# Try to install missing sysdeps.
# This only installs the first match; system_requirements may return many recursive sysdeps.
# But most sysdeps are preinstalled for us anyway

# Temp workaround for: https://github.com/r-lib/remotes/pull/705
#ubuntu <- gsub(" ", "-", tolower(substring(utils::osVersion,1,12)))
ubuntu <- 'ubuntu-20.04'
tryCatch({
aptline <- remotes::system_requirements(ubuntu)
system("apt-get update")
if(length(aptline) && !grepl('(libcurl|pandoc|cargo|rustc)', aptline[1])){
system(aptline[1])
skiplist <- '(libcurl|pandoc|cargo|rustc)'
sysreqs <- pak::pkg_sysreqs('.')$packages$system_packages
syspkgs <- grep(skiplist, unlist(sysreqs), value = TRUE, invert = TRUE)
if(length(syspkgs)){
message("Installing sysreqs: ", paste(syspkgs, collapse = ','))
system("apt-get update")
system(paste(c("apt-get install -y", syspkgs), collapse = " "))
} else {
message("No sysreqs needed")
}
# Special case extra libs that we don't have in the base image
extras <- grep('qgis|librdf0-dev|default-jdk', aptline, value = TRUE)
lapply(extras, system)
}, error = function(e){
message("Problem looking for system requirements: ", e$message)
})
Expand Down

0 comments on commit 4f99494

Please sign in to comment.