better logging

This commit is contained in:
Patrick Schratz 2024-07-28 10:40:59 +02:00
commit f847cc6b66
Signed by: pat-s
GPG key ID: 3C6318841EF78925
2 changed files with 3 additions and 1 deletions

View file

@ -67,6 +67,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
{ {
install_package_system_dependencies(package_name, tag, platform, local_clone_dir) install_package_system_dependencies(package_name, tag, platform, local_clone_dir)
}, },
# NB: here we need to use conditionMessage() to extract the actual error - as opposed to using $stderr for errors within the tryCatch used in the future* calls
error = function(e) { error = function(e) {
message(sprintf("Error in installing dependencies for package %s with tag %s: %s", package_name[1], tag[1], e)) message(sprintf("Error in installing dependencies for package %s with tag %s: %s", package_name[1], tag[1], e))
store_build_metadata(package_name[1], tag[1], platform, error_occurred = TRUE, force = TRUE, error = conditionMessage(e)) store_build_metadata(package_name[1], tag[1], platform, error_occurred = TRUE, force = TRUE, error = conditionMessage(e))

View file

@ -16,12 +16,13 @@ install_package_system_dependencies <- function(package_name,
)) ))
} }
cli::cli_alert("{.fun install_package_system_dependencies}: Installing R package dependencies for {.pkg {package_name[1]}} with tag {.field {tail(tag, 1)}}.")
Sys.setenv(PKG_SYSREQS_PLATFORM = platform) Sys.setenv(PKG_SYSREQS_PLATFORM = platform)
Sys.setenv(PKG_SYSREQS = TRUE) Sys.setenv(PKG_SYSREQS = TRUE)
Sys.setenv(PKG_SYSREQS_VERBOSE = TRUE) Sys.setenv(PKG_SYSREQS_VERBOSE = TRUE)
suppressMessages(pak::local_install_dev_deps(sprintf("%s", local_clone_dir_single))) suppressMessages(pak::local_install_dev_deps(sprintf("%s", local_clone_dir_single)))
cli::cli_alert("{.fun install_package_system_dependencies}: Removing {.path {local_clone_dir_single}}.") cli::cli_alert("{.fun install_package_system_dependencies}: Removing temporary clone dir at {.path {local_clone_dir_single}}.")
total_build_time <- round(Sys.time() - t1, 2) total_build_time <- round(Sys.time() - t1, 2)
cli::cli_alert("Dependency installation time ({.pkg {package_name[[1]]}}): {.strong {total_build_time} {units(difftime(Sys.time(), t1))}}.") cli::cli_alert("Dependency installation time ({.pkg {package_name[[1]]}}): {.strong {total_build_time} {units(difftime(Sys.time(), t1))}}.")