Skip to content

Commit

Permalink
Add RemoteBuildPlatform when building binary
Browse files Browse the repository at this point in the history
With `pkg_build`. It is not good to add it at
install time, because it is added to binary packages
as well. Ideally we would add it with pkgbuild.
  • Loading branch information
gaborcsardi committed Apr 30, 2023
1 parent 5177b3d commit 2c4ecf5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 4 additions & 2 deletions R/builder.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ pkg_build <- function(pkg, library = .libPaths()[1]) {
"Cannot find package {.pkg {pkg}} in library at {.path {library}}."
))
}
version <- desc::desc_get_field("Version", file = pkgdir)
rversion <- get_minor_r_version(getRversion())
platform <- pkgcache::current_r_platform()
add_metadata(pkgdir, c(RemoteBuildPlatform = platform))
dsc <- desc::desc(file = pkgdir)
version <- dsc$get_field("Version")
rversion <- get_minor_r_version(getRversion())

sys <- sysname()
if (sys == "windows") {
Expand Down
4 changes: 0 additions & 4 deletions R/install-binary.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ install_extracted_binary <- function(filename, lib_cache, pkg_cache, lib,

#' @importFrom utils modifyList
add_metadata <- function(pkg_path, metadata) {
if (! "RemoteBuildPlatform" %in% names(metadata)) {
metadata[["RemoteBuildPlatform"]] <- current_r_platform()
}

## During installation, the DESCRIPTION file is read and an package.rds
## file created with most of the information from the DESCRIPTION file.
## Functions that read package metadata may use either the DESCRIPTION
Expand Down

0 comments on commit 2c4ecf5

Please sign in to comment.