diff --git a/docker/depends/Dockerfile b/docker/depends/Dockerfile index 81967a8f012..0f6eccff8ca 100644 --- a/docker/depends/Dockerfile +++ b/docker/depends/Dockerfile @@ -43,8 +43,7 @@ RUN apt-get update \ COPY pecan.depends.R pecan_package_dependencies.csv pecan_deps_from_github.txt / RUN --mount=type=secret,id=github_token \ export GITHUB_PAT=`cat /run/secrets/github_token` \ - && Rscript -e "install.packages(c('devtools'))" \ - && Rscript -e "devtools::install_version('roxygen2', '7.2.3', repos = 'cran.r-project.org')" \ + && Rscript -e "install.packages(c('desc', 'remotes'))" \ && R_LIBS_USER='/usr/local/lib/R/site-library' Rscript /pecan.depends.R \ && rm -rf /tmp/* diff --git a/docker/depends/pecan.depends.R b/docker/depends/pecan.depends.R index 0de1c9c2353..64ef77eb10d 100644 --- a/docker/depends/pecan.depends.R +++ b/docker/depends/pecan.depends.R @@ -13,17 +13,26 @@ condense_version_requirements <- function(specs) { return("*") } specs <- unique(specs[specs != "*"]) - if (any(!grepl(">", specs))) { - # we *could* write more to handle this case if needed, but it seems very rare: - # available.packages() shows `<=` or `==` deps in just 4 of 20297 CRAN packages - stop( - "pecan_depends only supports minimum versions (e.g. `>= 2.8.1`), ", - "not exact (`==`) or maximum versions (`<=`).", - "Problem seen in (", paste(dQuote(specs), collapse = ", "), ")") - } versions <- package_version( gsub("[^[:digit:].-]+", "", specs)) + if ((length(unique(versions)) > 1) && any(!grepl(">", specs))) { + # Can't assume the latest version works for all, so give up. + # We *could* write more to handle this case if needed, but it seems very rare: + # available.packages() shows `<=` or `==` deps in just 4 of 20297 CRAN packages + # + # Since the package name wasn't passed in here, we unhelpfully print *just* + # the offending versions and send the user back to the CSV for details. + stop( + "Found multiple version requirements (", + paste(dQuote(specs), collapse = ", "), ") for the same dependency, ", + "and not all are minimum versions (e.g. `>= x.y.z`). ", + "Exact (`==`) or maximum (`<=`) version reuirements are only allowed ", + "if all PEcAn packages declare the same version. ", + "Sorry, this function doesn't know which dependency caused this. ", + "To find it, search for these version strings in ", + "'pecan_package_dependencies.csv'.") + } specs[versions == max(versions)] } diff --git a/docker/depends/pecan_package_dependencies.csv b/docker/depends/pecan_package_dependencies.csv index f83a09de0ef..fc14f5ee330 100644 --- a/docker/depends/pecan_package_dependencies.csv +++ b/docker/depends/pecan_package_dependencies.csv @@ -479,6 +479,49 @@ "rmarkdown",">= 2.19","modules/assim.batch","Suggests",FALSE "rmarkdown",">= 2.19","modules/meta.analysis","Suggests",FALSE "rmarkdown",">= 2.19","modules/photosynthesis","Suggests",FALSE +"roxygen2","== 7.2.3","base/all","Roxygen",FALSE +"roxygen2","== 7.2.3","base/db","Roxygen",FALSE +"roxygen2","== 7.2.3","base/logger","Roxygen",FALSE +"roxygen2","== 7.2.3","base/qaqc","Roxygen",FALSE +"roxygen2","== 7.2.3","base/remote","Roxygen",FALSE +"roxygen2","== 7.2.3","base/settings","Roxygen",FALSE +"roxygen2","== 7.2.3","base/utils","Roxygen",FALSE +"roxygen2","== 7.2.3","base/visualization","Roxygen",FALSE +"roxygen2","== 7.2.3","base/workflow","Roxygen",FALSE +"roxygen2","== 7.2.3","models/basgra","Roxygen",FALSE +"roxygen2","== 7.2.3","models/biocro","Roxygen",FALSE +"roxygen2","== 7.2.3","models/cable","Roxygen",FALSE +"roxygen2","== 7.2.3","models/clm45","Roxygen",FALSE +"roxygen2","== 7.2.3","models/dalec","Roxygen",FALSE +"roxygen2","== 7.2.3","models/dvmdostem","Roxygen",FALSE +"roxygen2","== 7.2.3","models/ed","Roxygen",FALSE +"roxygen2","== 7.2.3","models/fates","Roxygen",FALSE +"roxygen2","== 7.2.3","models/gday","Roxygen",FALSE +"roxygen2","== 7.2.3","models/jules","Roxygen",FALSE +"roxygen2","== 7.2.3","models/ldndc","Roxygen",FALSE +"roxygen2","== 7.2.3","models/linkages","Roxygen",FALSE +"roxygen2","== 7.2.3","models/lpjguess","Roxygen",FALSE +"roxygen2","== 7.2.3","models/maat","Roxygen",FALSE +"roxygen2","== 7.2.3","models/maespa","Roxygen",FALSE +"roxygen2","== 7.2.3","models/preles","Roxygen",FALSE +"roxygen2","== 7.2.3","models/sibcasa","Roxygen",FALSE +"roxygen2","== 7.2.3","models/sipnet","Roxygen",FALSE +"roxygen2","== 7.2.3","models/stics","Roxygen",FALSE +"roxygen2","== 7.2.3","models/template","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/allometry","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/assim.batch","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/assim.sequential","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/benchmark","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/data.atmosphere","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/data.hydrology","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/data.land","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/data.remote","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/emulator","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/meta.analysis","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/photosynthesis","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/priors","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/rtm","Roxygen",FALSE +"roxygen2","== 7.2.3","modules/uncertainty","Roxygen",FALSE "RPostgres","*","base/db","Suggests",FALSE "RPostgreSQL","*","base/db","Suggests",FALSE "RPostgreSQL","*","models/biocro","Suggests",FALSE diff --git a/models/cable/DESCRIPTION b/models/cable/DESCRIPTION index 621b64ba9ad..c8576cce4f1 100644 --- a/models/cable/DESCRIPTION +++ b/models/cable/DESCRIPTION @@ -22,4 +22,4 @@ Copyright: Authors LazyLoad: yes LazyData: FALSE Encoding: UTF-8 -RoxygenNote: 6.1.0 +RoxygenNote: 7.2.3 diff --git a/models/cable/man/write_restart.CABLE.Rd b/models/cable/man/write_restart.CABLE.Rd index 52945b79ee6..aad831a79c9 100644 --- a/models/cable/man/write_restart.CABLE.Rd +++ b/models/cable/man/write_restart.CABLE.Rd @@ -4,8 +4,7 @@ \alias{write_restart.CABLE} \title{Write restart template for SDA} \usage{ -write_restart.CABLE(outdir, runid, start.time, stop.time, settings, - new.state) +write_restart.CABLE(outdir, runid, start.time, stop.time, settings, new.state) } \arguments{ \item{start.time}{Time of current assimilation step} diff --git a/scripts/generate_dependencies.R b/scripts/generate_dependencies.R index d409dd4c051..63e64e5b5cc 100755 --- a/scripts/generate_dependencies.R +++ b/scripts/generate_dependencies.R @@ -52,6 +52,7 @@ parse_desc <- function(path) { package = d$get_field("Package"), package_dir = dirname(path)), remotes = remote_sources, + roxygen_version = d$get_field("RoxygenNote"), deps = deps) } @@ -83,7 +84,19 @@ deps <- pkgs_parsed |> # ignore R version requirements (e.g. "Depends: R (>= 3.2.0)") dplyr::filter(package != "R") |> dplyr::mutate(is_pecan = grepl("^PEcAn", package)) |> - dplyr::select(package, version, needed_by_dir, tidyselect::everything()) |> + dplyr::select(package, version, needed_by_dir, tidyselect::everything()) + +# Add Roxygen, used to build all packages but not declared as a dependency +roxy <- pkgs_parsed |> + purrr::map_dfr( + ~c(needed_by_dir = .$mapping$package_dir, version = .$roxygen_version)) |> + dplyr::mutate( + package = "roxygen2", + version = paste("==", version), + type = "Roxygen", + is_pecan = FALSE) +deps <- deps |> + rbind(roxy) |> dplyr::arrange(package, version, needed_by_dir, .locale = "en_US") # Save these for use at install time