diff --git a/NEWS.md b/NEWS.md index e9c68af4..3700bd1c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,15 +4,8 @@ credential store, if `GITHUB_PAT` and `GITHUB_TOKEN` are not set. * The `Remotes` field in `DESCRIPTION` now accepts explicit package names: `=::/` (#719, @heavywatal). -* `dev_package_deps()` noq has a `remote_precedence` parameter which allows - the user to choose whether remote sources should have a priority over - CRAN sources (#732, @maksymiuks). * `dev_package_deps()` now works for packages with `Enhances` dependencies (#711, @maksymiuks). -* `dev_package_deps()` now has an `additional_repositories` parameter - which allows the user to choose whether `Additional_repositories` should - be extracted from the `DESCRIPTION` file and appended to repos - (#782, @maksymiuks). * `install_dev()` now ignores a trailing slash (#692, @krlmlr). * System requirements now support Ubuntu 22.04. * `local_package_deps()` now errors for non-existent directories diff --git a/R/deps.R b/R/deps.R index 13d1c873..6300c53a 100644 --- a/R/deps.R +++ b/R/deps.R @@ -32,10 +32,7 @@ #' "always" and "never" respectively. #' @param repos A character vector giving repositories to use. #' @param type Type of package to `update`. -#' @param remote_precedence A logical flag specifying whether remote sources should take precedence over -#' CRAN when both were found. -#' @param additional_repositories A logical flag specifying whether `Additional_repositories` should -#' be extracted from the DESCRIPTION and appended to `repos`. +#' #' @param object A `package_deps` object. #' @param ... Additional arguments passed to `install_packages`. #' @inheritParams install_github @@ -125,12 +122,10 @@ local_package_deps <- function(pkgdir = ".", dependencies = NA) { dev_package_deps <- function(pkgdir = ".", dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType"), - remote_precedence = TRUE, - additional_repositories = TRUE) { + type = getOption("pkgType")) { pkg <- load_pkg_description(pkgdir) - repos <- c(repos, if (additional_repositories) parse_additional_repositories(pkg)) + repos <- c(repos, parse_additional_repositories(pkg)) deps <- local_package_deps(pkgdir = pkgdir, dependencies = dependencies) @@ -145,14 +140,14 @@ dev_package_deps <- function(pkgdir = ".", dependencies = NA, cran_deps <- package_deps(deps, repos = repos, type = type) - res <- combine_remote_deps(cran_deps, extra_deps(pkg, "remotes"), remote_precedence) + res <- combine_remote_deps(cran_deps, extra_deps(pkg, "remotes")) res <- do.call(rbind, c(list(res), lapply(get_extra_deps(pkg, dependencies), extra_deps, pkg = pkg), stringsAsFactors = FALSE)) res[is.na(res$package) | !duplicated(res$package, fromLast = TRUE), ] } -combine_remote_deps <- function(cran_deps, remote_deps, remote_precedence) { +combine_remote_deps <- function(cran_deps, remote_deps) { # If there are no dependencies there will be no remote dependencies either, # so just return them (and don't force the remote_deps promise) if (nrow(cran_deps) == 0) { @@ -163,13 +158,7 @@ combine_remote_deps <- function(cran_deps, remote_deps, remote_precedence) { remote_deps <- remote_deps[is.na(remote_deps$package) | remote_deps$package %in% cran_deps$package, ] # If there are remote deps remove the equivalent CRAN deps - if (remote_precedence) { - cran_deps <- cran_deps[!(cran_deps$package %in% remote_deps$package), ] - # Otherwise remove remotes already covered by CRAN - } else { - remote_deps <- remote_deps[!(remote_deps$package %in% cran_deps$package), ] - } - + cran_deps <- cran_deps[!(cran_deps$package %in% remote_deps$package), ] rbind(remote_deps, cran_deps) } diff --git a/inst/install-github.R b/inst/install-github.R index a642288e..5c3b8077 100644 --- a/inst/install-github.R +++ b/inst/install-github.R @@ -585,10 +585,7 @@ function(...) { #' "always" and "never" respectively. #' @param repos A character vector giving repositories to use. #' @param type Type of package to `update`. - #' @param remote_precedence A logical flag specifying whether remote sources should take precedence over - #' CRAN when both were found. - #' @param additional_repositories A logical flag specifying whether `Additional_repositories` should - #' be extracted from the DESCRIPTION and appended to `repos`. + #' #' @param object A `package_deps` object. #' @param ... Additional arguments passed to `install_packages`. #' @inheritParams install_github @@ -678,12 +675,10 @@ function(...) { dev_package_deps <- function(pkgdir = ".", dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType"), - remote_precedence = TRUE, - additional_repositories = TRUE) { + type = getOption("pkgType")) { pkg <- load_pkg_description(pkgdir) - repos <- c(repos, if (additional_repositories) parse_additional_repositories(pkg)) + repos <- c(repos, parse_additional_repositories(pkg)) deps <- local_package_deps(pkgdir = pkgdir, dependencies = dependencies) @@ -698,14 +693,14 @@ function(...) { cran_deps <- package_deps(deps, repos = repos, type = type) - res <- combine_remote_deps(cran_deps, extra_deps(pkg, "remotes"), remote_precedence) + res <- combine_remote_deps(cran_deps, extra_deps(pkg, "remotes")) res <- do.call(rbind, c(list(res), lapply(get_extra_deps(pkg, dependencies), extra_deps, pkg = pkg), stringsAsFactors = FALSE)) res[is.na(res$package) | !duplicated(res$package, fromLast = TRUE), ] } - combine_remote_deps <- function(cran_deps, remote_deps, remote_precedence) { + combine_remote_deps <- function(cran_deps, remote_deps) { # If there are no dependencies there will be no remote dependencies either, # so just return them (and don't force the remote_deps promise) if (nrow(cran_deps) == 0) { @@ -716,13 +711,7 @@ function(...) { remote_deps <- remote_deps[is.na(remote_deps$package) | remote_deps$package %in% cran_deps$package, ] # If there are remote deps remove the equivalent CRAN deps - if (remote_precedence) { - cran_deps <- cran_deps[!(cran_deps$package %in% remote_deps$package), ] - # Otherwise remove remotes already covered by CRAN - } else { - remote_deps <- remote_deps[!(remote_deps$package %in% cran_deps$package), ] - } - + cran_deps <- cran_deps[!(cran_deps$package %in% remote_deps$package), ] rbind(remote_deps, cran_deps) } diff --git a/install-github.R b/install-github.R index a642288e..5c3b8077 100644 --- a/install-github.R +++ b/install-github.R @@ -585,10 +585,7 @@ function(...) { #' "always" and "never" respectively. #' @param repos A character vector giving repositories to use. #' @param type Type of package to `update`. - #' @param remote_precedence A logical flag specifying whether remote sources should take precedence over - #' CRAN when both were found. - #' @param additional_repositories A logical flag specifying whether `Additional_repositories` should - #' be extracted from the DESCRIPTION and appended to `repos`. + #' #' @param object A `package_deps` object. #' @param ... Additional arguments passed to `install_packages`. #' @inheritParams install_github @@ -678,12 +675,10 @@ function(...) { dev_package_deps <- function(pkgdir = ".", dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType"), - remote_precedence = TRUE, - additional_repositories = TRUE) { + type = getOption("pkgType")) { pkg <- load_pkg_description(pkgdir) - repos <- c(repos, if (additional_repositories) parse_additional_repositories(pkg)) + repos <- c(repos, parse_additional_repositories(pkg)) deps <- local_package_deps(pkgdir = pkgdir, dependencies = dependencies) @@ -698,14 +693,14 @@ function(...) { cran_deps <- package_deps(deps, repos = repos, type = type) - res <- combine_remote_deps(cran_deps, extra_deps(pkg, "remotes"), remote_precedence) + res <- combine_remote_deps(cran_deps, extra_deps(pkg, "remotes")) res <- do.call(rbind, c(list(res), lapply(get_extra_deps(pkg, dependencies), extra_deps, pkg = pkg), stringsAsFactors = FALSE)) res[is.na(res$package) | !duplicated(res$package, fromLast = TRUE), ] } - combine_remote_deps <- function(cran_deps, remote_deps, remote_precedence) { + combine_remote_deps <- function(cran_deps, remote_deps) { # If there are no dependencies there will be no remote dependencies either, # so just return them (and don't force the remote_deps promise) if (nrow(cran_deps) == 0) { @@ -716,13 +711,7 @@ function(...) { remote_deps <- remote_deps[is.na(remote_deps$package) | remote_deps$package %in% cran_deps$package, ] # If there are remote deps remove the equivalent CRAN deps - if (remote_precedence) { - cran_deps <- cran_deps[!(cran_deps$package %in% remote_deps$package), ] - # Otherwise remove remotes already covered by CRAN - } else { - remote_deps <- remote_deps[!(remote_deps$package %in% cran_deps$package), ] - } - + cran_deps <- cran_deps[!(cran_deps$package %in% remote_deps$package), ] rbind(remote_deps, cran_deps) } diff --git a/man/install_bitbucket.Rd b/man/install_bitbucket.Rd index 118cf339..0180f187 100644 --- a/man/install_bitbucket.Rd +++ b/man/install_bitbucket.Rd @@ -108,10 +108,8 @@ environment variable \code{BITBUCKET_PASSWORD} (e.g. \code{evelynwaugh:swordofho Note that on Windows, authentication requires the "libcurl" download method. You can set the default download method via the -\code{download.file.method} option: - -\if{html}{\out{
}}\preformatted{options(download.file.method = "libcurl") -}\if{html}{\out{
}} +\code{download.file.method} option:\preformatted{options(download.file.method = "libcurl") +} In particular, if unset, RStudio sets the download method to "wininet". To override this, you might want to set it to "libcurl" in your diff --git a/man/package_deps.Rd b/man/package_deps.Rd index 67be6455..a79f4585 100644 --- a/man/package_deps.Rd +++ b/man/package_deps.Rd @@ -20,9 +20,7 @@ dev_package_deps( pkgdir = ".", dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType"), - remote_precedence = TRUE, - additional_repositories = TRUE + type = getOption("pkgType") ) \method{update}{package_deps}( @@ -67,12 +65,6 @@ common ones include: \item{pkgdir}{Path to a package directory, or to a package tarball.} -\item{remote_precedence}{A logical flag specifying whether remote sources should take precedence over -CRAN when both were found.} - -\item{additional_repositories}{A logical flag specifying whether \code{Additional_repositories} should -be extracted from the DESCRIPTION and appended to \code{repos}.} - \item{object}{A \code{package_deps} object.} \item{upgrade}{Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default"