From 2c5c0368faf35fefe415387c6da85fdab0430462 Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Wed, 10 Apr 2019 08:58:47 -0400 Subject: [PATCH] Re-build script --- inst/install-github.R | 34 +++++++++++++++------------------- install-github.R | 34 +++++++++++++++------------------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/inst/install-github.R b/inst/install-github.R index db65da27..8b88151f 100644 --- a/inst/install-github.R +++ b/inst/install-github.R @@ -359,9 +359,7 @@ package_deps <- function(packages, dependencies = NA, is_cran = is_cran_remote, stringsAsFactors = FALSE ), - class = c("package_deps", "data.frame"), - repos = repos, - type = type + class = c("package_deps", "data.frame") ) res$remote <- remote @@ -393,7 +391,7 @@ local_package_deps <- function(pkgdir = ".", dependencies = NA) { dev_package_deps <- function(pkgdir = ".", dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType"), ...) { + type = getOption("pkgType")) { pkg <- load_pkg_description(pkgdir) repos <- c(repos, parse_additional_repositories(pkg)) @@ -411,7 +409,7 @@ dev_package_deps <- function(pkgdir = ".", dependencies = NA, combine_deps( package_deps(deps, repos = repos, type = type), - remote_deps(pkg, ...)) + remote_deps(pkg)) } combine_deps <- function(cran_deps, remote_deps) { @@ -573,8 +571,10 @@ update.package_deps <- function(object, behind <- is.na(object$installed) | object$diff < CURRENT if (any(object$is_cran & !unavailable_on_cran & behind)) { - install_packages(object$package[object$is_cran & behind], repos = attr(object, "repos"), - type = attr(object, "type"), dependencies = dependencies, quiet = quiet, ...) + # get the first cran-like remote and use its repos and pkg_type + r <- object$remote[object$is_cran & behind][[1]] + install_packages(object$package[object$is_cran & behind], repos = r$repos, + type = r$pkg_type, dependencies = dependencies, quiet = quiet, ...) } install_remotes(object$remote[!object$is_cran & behind], @@ -776,13 +776,13 @@ split_remotes <- function(x) { } -remote_deps <- function(pkg, ...) { +remote_deps <- function(pkg) { if (!has_dev_remotes(pkg)) { return(NULL) } dev_packages <- split_remotes(pkg[["remotes"]]) - remote <- lapply(dev_packages, parse_one_remote, ...) + remote <- lapply(dev_packages, parse_one_remote) 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) @@ -1818,7 +1818,7 @@ install_bitbucket <- function(repo, ref = "master", subdir = NULL, bitbucket_remote <- function(repo, ref = "master", subdir = NULL, auth_user = NULL, password = NULL, sha = NULL, - host = NULL, ...) { + host = "api.bitbucket.org/2.0", ...) { meta <- parse_git_repo(repo) @@ -1880,7 +1880,7 @@ remote_package_name.bitbucket_remote <- function(remote, ...) { #' @export remote_sha.bitbucket_remote <- function(remote, ...) { bitbucket_commit(username = remote$username, repo = remote$repo, - host = remote$host, ref = remote$ref, auth = basic_auth(remote))$sha %||% NA_character_ + host = remote$host, ref = remote$ref, auth = basic_auth(remote))$hash %||% NA_character_ } #' @export @@ -3488,7 +3488,7 @@ install <- function(pkgdir, dependencies, quiet, build, build_opts, upgrade, } install_deps(pkgdir, dependencies = dependencies, quiet = quiet, - build = build, build_opts = build_opts, upgrade = upgrade, repos = repos, type = type, ...) + build = build, build_opts = build_opts, upgrade = upgrade, repos = repos, type = type) if (isTRUE(build)) { dir <- tempfile() @@ -3630,15 +3630,12 @@ install_deps <- function(pkgdir = ".", dependencies = NA, upgrade = c("default", "ask", "always", "never"), quiet = FALSE, build = TRUE, - build_opts = c("--no-resave-data", "--no-manual", "--no-build-vignettes"), - ...) { - + build_opts = c("--no-resave-data", "--no-manual", "--no-build-vignettes")) { packages <- dev_package_deps( pkgdir, repos = repos, dependencies = dependencies, - type = type, - ... + type = type ) dep_deps <- if (isTRUE(dependencies)) NA else dependencies @@ -3649,8 +3646,7 @@ install_deps <- function(pkgdir = ".", dependencies = NA, quiet = quiet, upgrade = upgrade, build = build, - build_opts = build_opts, - ... + build_opts = build_opts ) } diff --git a/install-github.R b/install-github.R index db65da27..8b88151f 100644 --- a/install-github.R +++ b/install-github.R @@ -359,9 +359,7 @@ package_deps <- function(packages, dependencies = NA, is_cran = is_cran_remote, stringsAsFactors = FALSE ), - class = c("package_deps", "data.frame"), - repos = repos, - type = type + class = c("package_deps", "data.frame") ) res$remote <- remote @@ -393,7 +391,7 @@ local_package_deps <- function(pkgdir = ".", dependencies = NA) { dev_package_deps <- function(pkgdir = ".", dependencies = NA, repos = getOption("repos"), - type = getOption("pkgType"), ...) { + type = getOption("pkgType")) { pkg <- load_pkg_description(pkgdir) repos <- c(repos, parse_additional_repositories(pkg)) @@ -411,7 +409,7 @@ dev_package_deps <- function(pkgdir = ".", dependencies = NA, combine_deps( package_deps(deps, repos = repos, type = type), - remote_deps(pkg, ...)) + remote_deps(pkg)) } combine_deps <- function(cran_deps, remote_deps) { @@ -573,8 +571,10 @@ update.package_deps <- function(object, behind <- is.na(object$installed) | object$diff < CURRENT if (any(object$is_cran & !unavailable_on_cran & behind)) { - install_packages(object$package[object$is_cran & behind], repos = attr(object, "repos"), - type = attr(object, "type"), dependencies = dependencies, quiet = quiet, ...) + # get the first cran-like remote and use its repos and pkg_type + r <- object$remote[object$is_cran & behind][[1]] + install_packages(object$package[object$is_cran & behind], repos = r$repos, + type = r$pkg_type, dependencies = dependencies, quiet = quiet, ...) } install_remotes(object$remote[!object$is_cran & behind], @@ -776,13 +776,13 @@ split_remotes <- function(x) { } -remote_deps <- function(pkg, ...) { +remote_deps <- function(pkg) { if (!has_dev_remotes(pkg)) { return(NULL) } dev_packages <- split_remotes(pkg[["remotes"]]) - remote <- lapply(dev_packages, parse_one_remote, ...) + remote <- lapply(dev_packages, parse_one_remote) 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) @@ -1818,7 +1818,7 @@ install_bitbucket <- function(repo, ref = "master", subdir = NULL, bitbucket_remote <- function(repo, ref = "master", subdir = NULL, auth_user = NULL, password = NULL, sha = NULL, - host = NULL, ...) { + host = "api.bitbucket.org/2.0", ...) { meta <- parse_git_repo(repo) @@ -1880,7 +1880,7 @@ remote_package_name.bitbucket_remote <- function(remote, ...) { #' @export remote_sha.bitbucket_remote <- function(remote, ...) { bitbucket_commit(username = remote$username, repo = remote$repo, - host = remote$host, ref = remote$ref, auth = basic_auth(remote))$sha %||% NA_character_ + host = remote$host, ref = remote$ref, auth = basic_auth(remote))$hash %||% NA_character_ } #' @export @@ -3488,7 +3488,7 @@ install <- function(pkgdir, dependencies, quiet, build, build_opts, upgrade, } install_deps(pkgdir, dependencies = dependencies, quiet = quiet, - build = build, build_opts = build_opts, upgrade = upgrade, repos = repos, type = type, ...) + build = build, build_opts = build_opts, upgrade = upgrade, repos = repos, type = type) if (isTRUE(build)) { dir <- tempfile() @@ -3630,15 +3630,12 @@ install_deps <- function(pkgdir = ".", dependencies = NA, upgrade = c("default", "ask", "always", "never"), quiet = FALSE, build = TRUE, - build_opts = c("--no-resave-data", "--no-manual", "--no-build-vignettes"), - ...) { - + build_opts = c("--no-resave-data", "--no-manual", "--no-build-vignettes")) { packages <- dev_package_deps( pkgdir, repos = repos, dependencies = dependencies, - type = type, - ... + type = type ) dep_deps <- if (isTRUE(dependencies)) NA else dependencies @@ -3649,8 +3646,7 @@ install_deps <- function(pkgdir = ".", dependencies = NA, quiet = quiet, upgrade = upgrade, build = build, - build_opts = build_opts, - ... + build_opts = build_opts ) }