Skip to content

Commit 4f99494

Browse files
committed
Switch to pak for resolving sysreqs
See r-universe-org/help#519
1 parent da41c11 commit 4f99494

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

R/buildtools.R

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,21 +307,17 @@ install_sysdeps <- function(path = '.'){
307307
}
308308

309309
# Try to install missing sysdeps.
310-
# This only installs the first match; system_requirements may return many recursive sysdeps.
311-
# But most sysdeps are preinstalled for us anyway
312-
313-
# Temp workaround for: https://github.com/r-lib/remotes/pull/705
314-
#ubuntu <- gsub(" ", "-", tolower(substring(utils::osVersion,1,12)))
315-
ubuntu <- 'ubuntu-20.04'
316310
tryCatch({
317-
aptline <- remotes::system_requirements(ubuntu)
318-
system("apt-get update")
319-
if(length(aptline) && !grepl('(libcurl|pandoc|cargo|rustc)', aptline[1])){
320-
system(aptline[1])
311+
skiplist <- '(libcurl|pandoc|cargo|rustc)'
312+
sysreqs <- pak::pkg_sysreqs('.')$packages$system_packages
313+
syspkgs <- grep(skiplist, unlist(sysreqs), value = TRUE, invert = TRUE)
314+
if(length(syspkgs)){
315+
message("Installing sysreqs: ", paste(syspkgs, collapse = ','))
316+
system("apt-get update")
317+
system(paste(c("apt-get install -y", syspkgs), collapse = " "))
318+
} else {
319+
message("No sysreqs needed")
321320
}
322-
# Special case extra libs that we don't have in the base image
323-
extras <- grep('qgis|librdf0-dev|default-jdk', aptline, value = TRUE)
324-
lapply(extras, system)
325321
}, error = function(e){
326322
message("Problem looking for system requirements: ", e$message)
327323
})

0 commit comments

Comments
 (0)