From e15de724d9a6b109dca62e58325963e0d949b64b Mon Sep 17 00:00:00 2001 From: wkmor1 Date: Thu, 14 Mar 2024 16:04:25 +0200 Subject: [PATCH] Update base image and packages --- Dockerfile | 2 +- renv.lock | 39 +++++++++++++++++++-------------------- renv/activate.R | 39 ++++++++++++++++++++++++++++++--------- 3 files changed, 50 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3f5069ae..9a21a515 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/luomus/base-r-image@sha256:0f9cc984724cfc5a268ecc9bfea057fc8f6ef2251f7dcf96baa173de4579e711 +FROM ghcr.io/luomus/base-r-image@sha256:b274fdd5ea06de31652330f805ea75e4ecdfb054399a2da812088fde11e3e309 ENV FINBIF_USER_AGENT=https://github.com/luomus/fin-biodiv-indicators diff --git a/renv.lock b/renv.lock index f1fdff0e..e5c5ce2c 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.3.2", + "Version": "4.3.3", "Repositories": [ { "Name": "CRAN", @@ -104,7 +104,7 @@ }, "RcppEigen": { "Package": "RcppEigen", - "Version": "0.3.3.9.4", + "Version": "0.3.4.0.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -113,7 +113,7 @@ "stats", "utils" ], - "Hash": "acb0a5bf38490f26ab8661b467f4f53a" + "Hash": "df49e3306f232ec28f1604e36a202847" }, "abind": { "Package": "abind", @@ -352,24 +352,24 @@ }, "curl": { "Package": "curl", - "Version": "5.2.0", + "Version": "5.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9" + "Hash": "411ca2c03b1ce5f548345d2fc2685f7a" }, "data.table": { "Package": "data.table", - "Version": "1.15.0", + "Version": "1.15.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "cfbbb4aed6e78cd45f17123a9ec9981a" + "Hash": "536dfe4ac4093b5d115caed7a1a7223b" }, "dbplyr": { "Package": "dbplyr", @@ -429,14 +429,14 @@ }, "digest": { "Package": "digest", - "Version": "0.6.34", + "Version": "0.6.35", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "7ede2ee9ea8d3edbf1ca84c1e333ad1a" + "Hash": "698ece7ba5a4fa4559e3d537e7ec3d31" }, "downlit": { "Package": "downlit", @@ -1155,14 +1155,14 @@ }, "ragg": { "Package": "ragg", - "Version": "1.2.7", + "Version": "1.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "systemfonts", "textshaping" ], - "Hash": "90a1b8b7e518d7f90480d56453b4d062" + "Hash": "082e1a198e3329d571f4448ef0ede4bc" }, "rapidoc": { "Package": "rapidoc", @@ -1211,13 +1211,13 @@ }, "renv": { "Package": "renv", - "Version": "1.0.4", + "Version": "1.0.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "utils" ], - "Hash": "11abaf7c540ff33f94514d50f929bfd1" + "Hash": "32c3f93e8360f667ca5863272ec8ba6a" }, "rlang": { "Package": "rlang", @@ -1232,7 +1232,7 @@ }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.25", + "Version": "2.26", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1245,14 +1245,13 @@ "jsonlite", "knitr", "methods", - "stringr", "tinytex", "tools", "utils", "xfun", "yaml" ], - "Hash": "d65e35823c817f09f4de424fcdfa812a" + "Hash": "9b148e7f95d33aac01f31282d49e4f44" }, "rprojroot": { "Package": "rprojroot", @@ -1391,14 +1390,14 @@ }, "systemfonts": { "Package": "systemfonts", - "Version": "1.0.5", + "Version": "1.0.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cpp11" ], - "Hash": "15b594369e70b975ba9f064295983499" + "Hash": "6d538cff441f0f1f36db2209ac7495ac" }, "testthat": { "Package": "testthat", @@ -1496,7 +1495,7 @@ }, "tidyselect": { "Package": "tidyselect", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1508,7 +1507,7 @@ "vctrs", "withr" ], - "Hash": "79540e5fcd9e0435af547d885f184fd5" + "Hash": "829f27b9c4919c16b593794a6344d6c0" }, "timechange": { "Package": "timechange", diff --git a/renv/activate.R b/renv/activate.R index 2937ee1d..9b2e7f18 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,7 +2,7 @@ local({ # the requested version of renv - version <- "1.0.4" + version <- "1.0.5" attr(version, "sha") <- NULL # the project directory @@ -31,6 +31,14 @@ local({ if (!is.null(override)) return(override) + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + # next, check environment variables # TODO: prefer using the configuration one in the future envvars <- c( @@ -50,9 +58,22 @@ local({ }) - if (!enabled) + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + return(FALSE) + } + # avoid recursion if (identical(getOption("renv.autoloader.running"), TRUE)) { warning("ignoring recursive attempt to run renv autoloader") @@ -1041,7 +1062,7 @@ local({ # if jsonlite is loaded, use that instead if ("jsonlite" %in% loadedNamespaces()) { - json <- catch(renv_json_read_jsonlite(file, text)) + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -1050,7 +1071,7 @@ local({ } # otherwise, fall back to the default JSON reader - json <- catch(renv_json_read_default(file, text)) + json <- tryCatch(renv_json_read_default(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -1063,14 +1084,14 @@ local({ } renv_json_read_jsonlite <- function(file = NULL, text = NULL) { - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") jsonlite::fromJSON(txt = text, simplifyVector = FALSE) } renv_json_read_default <- function(file = NULL, text = NULL) { # find strings in the JSON - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' locs <- gregexpr(pattern, text, perl = TRUE)[[1]] @@ -1118,14 +1139,14 @@ local({ map <- as.list(map) # remap strings in object - remapped <- renv_json_remap(json, map) + remapped <- renv_json_read_remap(json, map) # evaluate eval(remapped, envir = baseenv()) } - renv_json_remap <- function(json, map) { + renv_json_read_remap <- function(json, map) { # fix names if (!is.null(names(json))) { @@ -1152,7 +1173,7 @@ local({ # recurse if (is.recursive(json)) { for (i in seq_along(json)) { - json[i] <- list(renv_json_remap(json[[i]], map)) + json[i] <- list(renv_json_read_remap(json[[i]], map)) } }