diff --git a/R/deps.R b/R/deps.R index 987b7b87..15fac848 100644 --- a/R/deps.R +++ b/R/deps.R @@ -53,7 +53,8 @@ package_deps <- function(packages, dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType")) { + type = getOption("pkgType"), + ...) { repos <- fix_repositories(repos) cran <- available_packages(repos, type) @@ -69,7 +70,7 @@ package_deps <- function(packages, dependencies = NA, remote <- structure(lapply(deps, package2remote, repos = repos, type = type), class = "remotes") inst_ver <- vapply(deps, local_sha, character(1)) - cran_ver <- vapply(remote, function(x) remote_sha(x), character(1)) + cran_ver <- vapply(remote, function(x) remote_sha(x, ...), character(1)) is_cran_remote <- vapply(remote, inherits, logical(1), "cran_remote") diff <- compare_versions(inst_ver, cran_ver, is_cran_remote) @@ -134,7 +135,7 @@ dev_package_deps <- function(pkgdir = ".", dependencies = NA, } combine_deps( - package_deps(deps, repos = repos, type = type), + package_deps(deps, repos = repos, type = type, ...), remote_deps(pkg, ...)) } @@ -510,7 +511,7 @@ remote_deps <- function(pkg, ...) { package <- vapply(remote, function(x) remote_package_name(x), character(1), USE.NAMES = FALSE) installed <- vapply(package, function(x) local_sha(x), character(1), USE.NAMES = FALSE) - available <- vapply(remote, function(x) remote_sha(x), character(1), USE.NAMES = FALSE) + available <- vapply(remote, function(x) remote_sha(x, ...), character(1), USE.NAMES = FALSE) diff <- installed == available diff <- ifelse(!is.na(diff) & diff, CURRENT, BEHIND) diff[is.na(installed)] <- UNINSTALLED diff --git a/R/install-gitlab.R b/R/install-gitlab.R index de7a7f9c..8d4d3a39 100644 --- a/R/install-gitlab.R +++ b/R/install-gitlab.R @@ -115,6 +115,10 @@ remote_package_name.gitlab_remote <- function(remote, ...) { #' @export remote_sha.gitlab_remote <- function(remote, ...) { + if (is.null(remote$auth_token)) { + auth_token <- list(...) + remote$auth_token <- auth_token$auth_token + } gitlab_commit(username = remote$username, repo = remote$repo, host = remote$host, ref = remote$ref, pat = remote$auth_token) } diff --git a/R/install-remote.R b/R/install-remote.R index d057111a..f0e421bf 100644 --- a/R/install-remote.R +++ b/R/install-remote.R @@ -23,7 +23,7 @@ install_remote <- function(remote, package_name <- remote_package_name(remote) local_sha <- local_sha(package_name) - remote_sha <- remote_sha(remote, local_sha) + remote_sha <- remote_sha(remote, local_sha, ...) if (!isTRUE(force) && !different_sha(remote_sha = remote_sha, local_sha = local_sha)) { @@ -142,7 +142,7 @@ local_sha <- function(name) { # is added to the package when it is installed by remotes. If the package is # installed some other way, such as by `install.packages()` there will be no # meta-data, so there we construct a generic CRAN remote. -package2remote <- function(name, lib = .libPaths(), repos = getOption("repos"), type = getOption("pkgType")) { +package2remote <- function(name, lib = .libPaths(), repos = getOption("repos"), type = getOption("pkgType"), ...) { x <- tryCatch(utils::packageDescription(name, lib.loc = lib), error = function(e) NA, warning = function(e) NA) diff --git a/man/package_deps.Rd b/man/package_deps.Rd index ff515222..87a51d55 100644 --- a/man/package_deps.Rd +++ b/man/package_deps.Rd @@ -8,7 +8,7 @@ \title{Find all dependencies of a CRAN or dev package.} \usage{ package_deps(packages, dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType")) + type = getOption("pkgType"), ...) local_package_deps(pkgdir = ".", dependencies = NA) @@ -37,10 +37,10 @@ just check this package, not its dependencies).} \item{type}{Type of package to \code{update}.} -\item{pkgdir}{path to a package directory, or to a package tarball.} - \item{...}{Additional arguments passed to \code{install_packages}.} +\item{pkgdir}{path to a package directory, or to a package tarball.} + \item{object}{A \code{package_deps} object.} \item{upgrade}{One of "default", "ask", "always", or "never". "default"