Skip to content

Commit

Permalink
Revert dev_package_deps new arguments
Browse files Browse the repository at this point in the history
It breaks the devtools package.
  • Loading branch information
gaborcsardi committed Mar 17, 2024
1 parent 82da608 commit bee893b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 71 deletions.
7 changes: 0 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
`<pkgname>=<type>::<username>/<repo>` (#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
Expand Down
23 changes: 6 additions & 17 deletions R/deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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) {
Expand All @@ -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)
}
Expand Down
23 changes: 6 additions & 17 deletions inst/install-github.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions install-github.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions man/install_bitbucket.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions man/package_deps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bee893b

Please sign in to comment.