Skip to content

Commit

Permalink
Re-build script
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Apr 10, 2019
1 parent 97703b5 commit 2c5c036
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 38 deletions.
34 changes: 15 additions & 19 deletions inst/install-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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) {
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -3649,8 +3646,7 @@ install_deps <- function(pkgdir = ".", dependencies = NA,
quiet = quiet,
upgrade = upgrade,
build = build,
build_opts = build_opts,
...
build_opts = build_opts
)
}

Expand Down
34 changes: 15 additions & 19 deletions install-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand All @@ -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) {
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -3649,8 +3646,7 @@ install_deps <- function(pkgdir = ".", dependencies = NA,
quiet = quiet,
upgrade = upgrade,
build = build,
build_opts = build_opts,
...
build_opts = build_opts
)
}

Expand Down

0 comments on commit 2c5c036

Please sign in to comment.