account for musl suffix
This commit is contained in:
parent
9b3952d5c7
commit
85ad28c543
1 changed files with 34 additions and 28 deletions
|
|
@ -89,30 +89,30 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
|||
|
||||
# out <- progressr::with_progress({
|
||||
# p <- progressr::progressor(along = tag)
|
||||
future.apply::future_mapply(function(x, y) {
|
||||
tryCatch(
|
||||
{
|
||||
# p()
|
||||
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform, debug = debug, force = force)
|
||||
future.apply::future_mapply(function(x, y) {
|
||||
tryCatch(
|
||||
{
|
||||
# p()
|
||||
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform, debug = debug, force = force)
|
||||
|
||||
# if for some reason an underlying error didnt' get caught in the tryCatch calls, we check again here for the existence of the binary file on disk and mark the build as failed if it is not found
|
||||
tarball_name <- sprintf("%s_%s.tar.gz", x, y)
|
||||
if (fs::file_exists(sprintf("%s/%s", local_bin_path, tarball_name))) {
|
||||
cli::cli_alert_success("Successfully built package {.pkg {x}} with tag {.field {y}}.")
|
||||
} else {
|
||||
cli::cli_alert_warning("Error in building package {.pkg {x}} with tag {.field {y}}: Uncommon/unspecific error during build.")
|
||||
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = "Uncommon/unspecific error during build")
|
||||
}
|
||||
},
|
||||
error = function(e) {
|
||||
cli::cli_alert_warning("Error in building package {.pkg {package_name}} with tag {.field {tag}}: {e}")
|
||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
||||
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||
# only stderr contains the important information why the build failed
|
||||
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = e$stderr)
|
||||
# if for some reason an underlying error didnt' get caught in the tryCatch calls, we check again here for the existence of the binary file on disk and mark the build as failed if it is not found
|
||||
tarball_name <- sprintf("%s_%s.tar.gz", x, y)
|
||||
if (fs::file_exists(sprintf("%s/%s", local_bin_path, tarball_name))) {
|
||||
cli::cli_alert_success("Successfully built package {.pkg {x}} with tag {.field {y}}.")
|
||||
} else {
|
||||
cli::cli_alert_warning("Error in building package {.pkg {x}} with tag {.field {y}}: Uncommon/unspecific error during build.")
|
||||
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = "Uncommon/unspecific error during build")
|
||||
}
|
||||
)
|
||||
}, package_name, tag, future.seed = TRUE)
|
||||
},
|
||||
error = function(e) {
|
||||
cli::cli_alert_warning("Error in building package {.pkg {package_name}} with tag {.field {tag}}: {e}")
|
||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
||||
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||
# only stderr contains the important information why the build failed
|
||||
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = e$stderr)
|
||||
}
|
||||
)
|
||||
}, package_name, tag, future.seed = TRUE)
|
||||
# })
|
||||
|
||||
total_build_time <- round(Sys.time() - t1, 2)
|
||||
|
|
@ -181,19 +181,25 @@ build_single_tag <- function(
|
|||
}
|
||||
)
|
||||
|
||||
if (any(grepl("alpine", system2("cat", args = c("/etc/os-release"), stdout = TRUE)))) {
|
||||
linux_suffix <- "musl"
|
||||
} else {
|
||||
linux_suffix <- "gnu"
|
||||
}
|
||||
|
||||
if (!file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
||||
if (debug) {
|
||||
cli::cli_alert_info('{.fun build_single_tag}: Moving package from {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag)}} to {.path {sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)}}')
|
||||
cli::cli_alert_info('{.fun build_single_tag}: Moving package from {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-%s.tar.gz", dir_out_bin, package_name, tag, linux_suffix)}} to {.path {sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)}}')
|
||||
}
|
||||
# double-check that file exists (some packages like https://github.com/cran/BACCO/tree/1.0-14 don't include R/ and hence don't procude a valid binary)
|
||||
if (fs::file_exists(sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag))) {
|
||||
# remove _aarch64-unknown-linux-gnu part in filename
|
||||
if (fs::file_exists(sprintf("%s/%s_%s_R_aarch64-unknown-linux-%s.tar.gz", dir_out_bin, package_name, tag, linux_suffix))) {
|
||||
# remove _aarch64-unknown-linux-gnu/musl part in filename
|
||||
fs::file_move(
|
||||
sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag),
|
||||
sprintf("%s/%s_%s_R_aarch64-unknown-linux-%s.tar.gz", dir_out_bin, package_name, tag, linux_suffix),
|
||||
sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)
|
||||
)
|
||||
} else {
|
||||
cli::cli_alert_info('{.fun build_single_tag}: File for package {.pkg {package_name}} {.field {tag}} at {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-gnu.tar.gz", dir_out_bin, package_name, tag)}} does not exist - skipping.')
|
||||
cli::cli_alert_info('{.fun build_single_tag}: File for package {.pkg {package_name}} {.field {tag}} at {.path {sprintf("%s/%s_%s_R_aarch64-unknown-linux-%s.tar.gz", dir_out_bin, package_name, tag, linux_suffix)}} does not exist - skipping.')
|
||||
}
|
||||
} else {
|
||||
cli::cli_alert_warning('{.fun build_single_tag}: Binary {sprintf("%s_%s.tar.gz", package_name, tag)} already exists. Skipping copy.')
|
||||
|
|
|
|||
Loading…
Reference in a new issue