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 1554177
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Imports:
knitr,
lubridate,
maketools,
pak,
postdoc (>= 1.3.0),
remotes (>= 2.4.2.9000),
rmarkdown,
Expand Down
26 changes: 13 additions & 13 deletions R/buildtools.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,21 @@ 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('.', upgrade = FALSE)$packages$system_packages
syspkgs <- grep(skiplist, unlist(sysreqs), value = TRUE, invert = TRUE)
if(length(syspkgs)){
syspkgs <- paste(syspkgs, collapse = ' ')
message("Installing sysreqs: ", syspkgs)
system("apt-get update -y")
system(paste("apt-get install -y", syspkgs))
con <- file("DESCRIPTION", open = 'a')
writeLines(paste("Config/pak/sysreqs:", syspkgs), con)
close(con)
} 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 1554177

Please sign in to comment.