downlit icon indicating copy to clipboard operation
downlit copied to clipboard

CRAN_urls() ignores pkgdown.internet = FALSE *and* overwrites default proxy

Open sergiocorreia opened this issue 4 months ago • 0 comments

Got a very similar error to #177 when trying to build a package website from behind a firewall. Until maybe 3-6 months this worked:

options(pkgdown.internet = FALSE)
pkgdown::build_site()

Now we get an error from downlit which we traced to this (premature?) optimization:

CRAN_urls <- function() {
  # Substantially faster to use RStudio mirror: in my testing this reduced
  # download time from ~2s to 0.6s
  withr::local_envvar(R_CRAN_WEB = "https://cran.rstudio.com")
  tools::CRAN_package_db()
}

This overwrites the R_CRAN_WEB variable (thus disabling our internal proxy) and then fails ungracefully.

Maybe as a compromise, CRAN_urls() should only change R_CRAN_WEB if it has the default values? Or maybe there's a way to completely avoid relying on the web when pkgdown.internet = FALSE is set?

Thanks!

sergiocorreia avatar Feb 08 '24 14:02 sergiocorreia