use cli_alert
This commit is contained in:
parent
90d4d24697
commit
d4b86485b4
4 changed files with 18 additions and 18 deletions
|
|
@ -25,12 +25,12 @@ store_build_metadata <- function(
|
||||||
))
|
))
|
||||||
|
|
||||||
if (nrow(existing_entries) >= 1 && !force) {
|
if (nrow(existing_entries) >= 1 && !force) {
|
||||||
cli::cli_alert_info("{.fun store_build_metadata}: Build metadata for {.field {.pkg package_name}} {.field {tag}} already exists.")
|
cli::cli_alert("{.fun store_build_metadata}: Build metadata for {.field {.pkg package_name}} {.field {tag}} already exists.")
|
||||||
} else {
|
} else {
|
||||||
if (!force) {
|
if (!force) {
|
||||||
cli::cli_alert_info("{.fun store_build_metadata}: Storing build metadata for {.field {package_name}} {.field {tag}}.")
|
cli::cli_alert("{.fun store_build_metadata}: Storing build metadata for {.field {package_name}} {.field {tag}}.")
|
||||||
} else {
|
} else {
|
||||||
cli::cli_alert_info("{.fun store_build_metadata}: Force overring build metadata for {.field {package_name}} {.field {tag}} because {.code force = TRUE} was set.")
|
cli::cli_alert_info("{.fun store_build_metadata}: Force overwriting build metadata for {.field {package_name}} {.field {tag}} because {.code force = TRUE} was set.")
|
||||||
}
|
}
|
||||||
# Create a data frame with the metadata
|
# Create a data frame with the metadata
|
||||||
metadata <- data.frame(
|
metadata <- data.frame(
|
||||||
|
|
@ -96,7 +96,7 @@ build_metadata_summary <- function(package_name, platform) {
|
||||||
"SELECT * FROM single_builds WHERE package_name = '%s' AND platform = '%s'", package_name, platform
|
"SELECT * FROM single_builds WHERE package_name = '%s' AND platform = '%s'", package_name, platform
|
||||||
))
|
))
|
||||||
|
|
||||||
cli::cli_alert_info("{.fun build_binary_package}: Building/updating metadata summary for {.pkg {package_name[[1]]}}.")
|
cli::cli_alert("{.fun build_binary_package}: Building/updating metadata summary for {.pkg {package_name[[1]]}}.")
|
||||||
|
|
||||||
# add average_build_time_per_tag to metadata summary table
|
# add average_build_time_per_tag to metadata summary table
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
|
|
||||||
dir_out_src <- sprintf("%s/src/contrib/Archive", local_build_root)
|
dir_out_src <- sprintf("%s/src/contrib/Archive", local_build_root)
|
||||||
if (debug) {
|
if (debug) {
|
||||||
cli::cli_alert_info("{.fun build_binary_package}: Creating bin dir {.path {dir_out_bin}}.")
|
cli::cli_alert("{.fun build_binary_package}: Creating bin dir {.path {dir_out_bin}}.")
|
||||||
cli::cli_alert_info("{.fun build_binary_package}: Creating src dir {.path {dir_out_src}}.")
|
cli::cli_alert("{.fun build_binary_package}: Creating src dir {.path {dir_out_src}}.")
|
||||||
}
|
}
|
||||||
dir.create(sprintf("%s/Archive", dir_out_bin), sprintf("%s/Archive", dir_out_src),
|
dir.create(sprintf("%s/Archive", dir_out_bin), sprintf("%s/Archive", dir_out_src),
|
||||||
recursive = TRUE
|
recursive = TRUE
|
||||||
|
|
@ -76,7 +76,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
t1 <- Sys.time()
|
t1 <- Sys.time()
|
||||||
cli::cli_h2("Building ({.pkg {package_name[1]}})")
|
cli::cli_h2("Building ({.pkg {package_name[1]}})")
|
||||||
|
|
||||||
cli::cli_alert_info("Building binaries for {.pkg {package_name[[1]]}} with tags {.field {tag}}.")
|
cli::cli_alert("Building binaries for {.pkg {package_name[[1]]}} with tags {.field {tag}}.")
|
||||||
|
|
||||||
# Set up the progress handler
|
# Set up the progress handler
|
||||||
progressr::handlers(global = TRUE)
|
progressr::handlers(global = TRUE)
|
||||||
|
|
@ -102,7 +102,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
})
|
})
|
||||||
|
|
||||||
total_build_time <- round(Sys.time() - t1, 2)
|
total_build_time <- round(Sys.time() - t1, 2)
|
||||||
cli::cli_alert_info("Execution time for {.pkg {package_name[[1]]}} ({length(tag)} tags): {.strong {total_build_time} {units(difftime(Sys.time(), t1))}}.")
|
cli::cli_alert("Execution time for {.pkg {package_name[[1]]}} ({length(tag)} tags): {.strong {total_build_time} {units(difftime(Sys.time(), t1))}}.")
|
||||||
|
|
||||||
cli::cli_h2("Uploading ({.pkg {package_name[1]}})")
|
cli::cli_h2("Uploading ({.pkg {package_name[1]}})")
|
||||||
out <- progressr::with_progress({
|
out <- progressr::with_progress({
|
||||||
|
|
@ -123,7 +123,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
return(invisible(TRUE))
|
return(invisible(TRUE))
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @importFrom cli cli_alert_info
|
#' @importFrom cli cli_alert
|
||||||
#' @importFrom pkgbuild build
|
#' @importFrom pkgbuild build
|
||||||
#' @export
|
#' @export
|
||||||
build_single_tag <- function(
|
build_single_tag <- function(
|
||||||
|
|
@ -131,7 +131,7 @@ build_single_tag <- function(
|
||||||
platform,
|
platform,
|
||||||
dir_out_bin,
|
dir_out_bin,
|
||||||
local_clone_dir) {
|
local_clone_dir) {
|
||||||
cli::cli_alert_info("{.fun build_single_tag}: (1/4) Cloning package {.pkg {package_name}} with tag {.field {tag}}.")
|
cli::cli_alert("{.fun build_single_tag}: (1/4) Cloning package {.pkg {package_name}} with tag {.field {tag}}.")
|
||||||
|
|
||||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, package_name, tag)
|
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, package_name, tag)
|
||||||
|
|
||||||
|
|
@ -142,9 +142,9 @@ build_single_tag <- function(
|
||||||
))
|
))
|
||||||
|
|
||||||
if (file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
if (file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
||||||
cli::cli_alert_info("{.fun build_single_tag}: (2/4). Tarball for package {.pkg {package_name}} with tag {.field {tag}} already exists. Skipping build.")
|
cli::cli_alert("{.fun build_single_tag}: (2/4). Tarball for package {.pkg {package_name}} with tag {.field {tag}} already exists. Skipping build.")
|
||||||
} else {
|
} else {
|
||||||
cli::cli_alert_info("{.fun build_single_tag}: (2/4). Building package {.pkg {package_name}} with tag {.field {tag}}.")
|
cli::cli_alert("{.fun build_single_tag}: (2/4). Building package {.pkg {package_name}} with tag {.field {tag}}.")
|
||||||
|
|
||||||
t1 <- Sys.time()
|
t1 <- Sys.time()
|
||||||
dump <- pkgbuild::build(
|
dump <- pkgbuild::build(
|
||||||
|
|
@ -154,7 +154,7 @@ build_single_tag <- function(
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
if (!file.exists(sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag))) {
|
||||||
cli::cli_alert_info('{.fun build_single_tag}: (3/4). Moving package from {.path {sprintf("%s/%s*.tar.gz", dir_out_bin, package_name)}} to {.path {sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)}}')
|
cli::cli_alert('{.fun build_single_tag}: (3/4). Moving package from {.path {sprintf("%s/%s*.tar.gz", dir_out_bin, package_name)}} to {.path {sprintf("%s/%s_%s.tar.gz", dir_out_bin, package_name, tag)}}')
|
||||||
# remove _aarch64-unknown-linux-gnu part in filename
|
# remove _aarch64-unknown-linux-gnu part in filename
|
||||||
system2("rsync", args = c(
|
system2("rsync", args = c(
|
||||||
sprintf("%s/%s_%s*.tar.gz", dir_out_bin, package_name, tag),
|
sprintf("%s/%s_%s*.tar.gz", dir_out_bin, package_name, tag),
|
||||||
|
|
@ -165,7 +165,7 @@ build_single_tag <- function(
|
||||||
}
|
}
|
||||||
unlink(sprintf("%s/%s_%s_R*.tar.gz", dir_out_bin, package_name, tag))
|
unlink(sprintf("%s/%s_%s_R*.tar.gz", dir_out_bin, package_name, tag))
|
||||||
|
|
||||||
cli::cli_alert_info("{.fun build_single_tag}: (4/4) Removing {.path {local_clone_dir_single}}.")
|
cli::cli_alert("{.fun build_single_tag}: (4/4) Removing {.path {local_clone_dir_single}}.")
|
||||||
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||||
|
|
||||||
total_build_time <- round(Sys.time() - t1, 2)
|
total_build_time <- round(Sys.time() - t1, 2)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ install_package_system_dependencies <- function(package_name,
|
||||||
tag,
|
tag,
|
||||||
platform = "redhat-9",
|
platform = "redhat-9",
|
||||||
local_clone_dir) {
|
local_clone_dir) {
|
||||||
cli::cli_alert_info("{.fun install_package_system_dependencies}: Cloning package {.pkg {package_name[1]}} with tag {.field {tag}}.")
|
cli::cli_alert("{.fun install_package_system_dependencies}: Cloning package {.pkg {package_name[1]}} with tag {.field {tag}}.")
|
||||||
|
|
||||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, package_name[1], tail(tag, 1))
|
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, package_name[1], tail(tag, 1))
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ install_package_system_dependencies <- function(package_name,
|
||||||
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_info("{.fun install_package_system_dependencies}: 4. Removing {.path {local_clone_dir_single}}.")
|
cli::cli_alert("{.fun install_package_system_dependencies}: 4. Removing {.path {local_clone_dir_single}}.")
|
||||||
|
|
||||||
unlink(sprintf("%s", local_clone_dir_single), recursive = TRUE, force = TRUE)
|
unlink(sprintf("%s", local_clone_dir_single), recursive = TRUE, force = TRUE)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ upload_single_binary_to_s3 <- function(
|
||||||
exists <- s3fs::s3_file_exists(sprintf("%s/%s", remote_bin_path, tarball_name))
|
exists <- s3fs::s3_file_exists(sprintf("%s/%s", remote_bin_path, tarball_name))
|
||||||
|
|
||||||
if ((!exists && !force) || (!exists && force)) {
|
if ((!exists && !force) || (!exists && force)) {
|
||||||
cli::cli_alert_info("{.fun upload_single_binary_to_s3}: 5. Uploading {.pkg {package_name}} {.field {tag}} to S3.")
|
cli::cli_alert("{.fun upload_single_binary_to_s3}: 5. Uploading {.pkg {package_name}} {.field {tag}} to S3.")
|
||||||
s3fs::s3_file_upload(
|
s3fs::s3_file_upload(
|
||||||
sprintf("%s/%s", local_bin_path, tarball_name),
|
sprintf("%s/%s", local_bin_path, tarball_name),
|
||||||
sprintf("%s/%s", remote_bin_path, tarball_name)
|
sprintf("%s/%s", remote_bin_path, tarball_name)
|
||||||
|
|
@ -47,6 +47,6 @@ upload_single_binary_to_s3 <- function(
|
||||||
overwrite = TRUE
|
overwrite = TRUE
|
||||||
)
|
)
|
||||||
} else if (exists && !force) {
|
} else if (exists && !force) {
|
||||||
cli::cli_alert_info("{.fun upload_single_binary_to_s3}: Package {.pkg {package_name}} {.field {tag}} already exists in S3. Skipping upload.")
|
cli::cli_alert("{.fun upload_single_binary_to_s3}: Package {.pkg {package_name}} {.field {tag}} already exists in S3. Skipping upload.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue