Skip to content

Commit 645d7f7

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

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Imports:
2121
knitr,
2222
lubridate,
2323
maketools,
24+
pak,
2425
postdoc (>= 1.3.0),
2526
remotes (>= 2.4.2.9000),
2627
rmarkdown,

R/buildtools.R

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,21 +307,19 @@ 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('.', upgrade = FALSE)$packages$system_packages
313+
syspkgs <- grep(skiplist, unlist(sysreqs), value = TRUE, invert = TRUE)
314+
if(length(syspkgs)){
315+
syspkgs <- paste(syspkgs, collapse = ' ')
316+
message("Installing sysreqs: ", syspkgs)
317+
system("apt-get update -y")
318+
system(paste("apt-get install -y", syspkgs))
319+
writeLines(syspkgs, "/LINUX_PREP_SYSDEPS")
320+
} else {
321+
message("No sysreqs needed")
321322
}
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)
325323
}, error = function(e){
326324
message("Problem looking for system requirements: ", e$message)
327325
})

action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ outputs:
3939
description: 'Base64 encoded JSON list with git stats'
4040
NEEDS_COMPILATION:
4141
description: 'If the source package has a src dir'
42-
42+
LINUX_PREP_SYSDEPS:
43+
description: 'Recursive Linux system requirements'
4344
runs:
4445
using: 'docker'
4546
image: 'docker://ghcr.io/r-universe-org/build-source'

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ fi
268268
if [ -f "/NEED_GOLANG" ]; then
269269
echo "NEED_GOLANG=true" >> $GITHUB_OUTPUT
270270
fi
271+
if [ -f "/LINUX_PREP_SYSDEPS" ]; then
272+
echo "LINUX_PREP_SYSDEPS=$(cat /LINUX_PREP_SYSDEPS)" >> $GITHUB_OUTPUT
273+
fi
274+
275+
echo "Debug GITHUB_OUTPUT"
276+
cat $GITHUB_OUTPUT
271277

272278
# TODO: can we explicitly set action status/outcome in GHA?
273279
echo -e "Build complete.\n"

0 commit comments

Comments
 (0)