Skip to content

Commit

Permalink
Merge pull request #338 from r-lib/fix/installedok-standard
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi authored Sep 22, 2023
2 parents c176fd9 + 002ad12 commit b254f65
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
3 changes: 1 addition & 2 deletions R/type-bioc.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ installedok_remote_bioc <- function(installed, solution, config, ...) {
# that we are installing the same build.
identical(installed$package, solution$package) &&
identical(installed$version, solution$version) &&
(identical(installed[["platform"]], solution[["platform"]]) ||
identical(installed[["platform"]], "*")) &&
installedok_remote_standard_platform(installed, solution, config, ...) &&
identical(installed[["built"]], solution[["built"]])

} else {
Expand Down
3 changes: 1 addition & 2 deletions R/type-cran.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ installedok_remote_cran <- function(installed, solution, config, ...) {
# that we are installing the same build.
identical(installed$package, solution$package) &&
identical(installed$version, solution$version) &&
(identical(installed[["platform"]], solution[["platform"]]) ||
identical(installed[["platform"]], "*")) &&
installedok_remote_standard_platform(installed, solution, config, ...) &&
identical(installed[["built"]], solution[["built"]])

} else {
Expand Down
13 changes: 11 additions & 2 deletions R/type-standard.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ installedok_remote_standard <- function(installed, solution, config, ...) {
# the repo must match
identical(installed$package, solution$package) &&
identical(installed$version, solution$version) &&
(identical(installed[["platform"]], solution[["platform"]]) ||
identical(installed[["platform"]], "*")) &&
installedok_remote_standard_platform(installed, solution, config, ...) &&
identical(installed$remoterepos, solution$metadata[[1]][["RemoteRepos"]])

} else {
Expand All @@ -124,3 +123,13 @@ installedok_remote_standard <- function(installed, solution, config, ...) {
identical(installed$remoterepos, solution$metadata[[1]][["RemoteRepos"]])
}
}

installedok_remote_standard_platform <- function(installed, solution,
config, ...) {
if (identical(installed[["platform"]], solution[["platform"]])) return(TRUE)
if (identical(installed[["platform"]], "*")) return(TRUE)
if (identical(installed$remotepkgplatform, solution$platform)) return(TRUE)
if (is_string(solution$platform) && is_string(installed$platform) &&
startsWith(solution$platform, installed$platform)) return(TRUE)
FALSE
}
30 changes: 30 additions & 0 deletions tests/testthat/test-type-standard.R
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,33 @@ test_that("installedok", {
sol
))
})

test_that("installedok Linux binaries", {
solution <- list(
package = "package",
version = "1.0.0",
platform = "x86_64-pc-linux-gnu-ubuntu-22.04"
)
installed <- list(
package = "package",
version = "1.0.0",
platform = "x86_64-pc-linux-gnu",
built = "R 4.3.1; x86_64-pc-linux-gnu; 2023-09-21 14:53:54 UTC; unix"
)

expect_true(installedok_remote_standard(installed, solution))

solution2 <- list(
package = "package",
version = "1.0.0",
platform = "x86_64-pc-linux-gnu-ubuntu-22.04"
)
installed2 <- list(
package = "package",
version = "1.0.0",
remotepkgplatform = "x86_64-pc-linux-gnu-ubuntu-22.04",
platform = "x86_64-pc-linux-gnu"
)

expect_true(installedok_remote_standard(installed2, solution2))
})

0 comments on commit b254f65

Please sign in to comment.