Skip to content

Commit

Permalink
Better platform matching in installedok()
Browse files Browse the repository at this point in the history
For standard, cran and bioc packages.

Closes r-lib/actions#759
  • Loading branch information
gaborcsardi committed Sep 21, 2023
1 parent c176fd9 commit aa55a3d
Show file tree
Hide file tree
Showing 3 changed files with 13 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
}

0 comments on commit aa55a3d

Please sign in to comment.