paleolimbot commented on code in PR #39148: URL: https://github.com/apache/arrow/pull/39148#discussion_r1423020585
########## r/bootstrap.R: ########## @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (!dir.exists('../cpp')) { + cli::cli_alert_warning("Arrow C++ sources not found, skipping bootstrap.") + q(save = "no") Review Comment: I think using `q()` here might lead to surprising results if somebody tries to `source()` this file. (I know we do this in nixlibs.R, but in that file we care a lot about the return code and I don't think that matters here). ########## r/bootstrap.R: ########## @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (!dir.exists('../cpp')) { + cli::cli_alert_warning("Arrow C++ sources not found, skipping bootstrap.") + q(save = "no") +} + +pkg_version <- package_version(desc::desc_get("Version")) +is_release <- is.na(pkg_version[1, 4]) || pkg_version[1, 4] < "100" +# for testing and CI +force_bootstrap <- identical(tolower(Sys.getenv("ARROW_FORCE_BOOTSTRAP", unset = "false")), "true") + +get_checksum_version <- function() { + url_exists <- function(url) { + headers <- curlGetHeaders(url) + attr(headers, "status") == 200 + } + # Run update-checksums.R manually if the checksums already exists + # but have an unexpected version. + if (dir.exists("tools/checksums") || force_bootstrap) { + cli::cli_alert_success("Found existing checksums, skipping download.") + return(NA) + } + + # We currently don't support prebuild binaries with a differing version. + jfrog_url <- "https://apache.jfrog.io/artifactory/arrow/r/%s/libarrow" + matching_url <- url_exists(sprintf(jfrog_url, pkg_version[1, 1:3])) + if (matching_url) { + version <- pkg_version[1, 1:3] + } else { + cli::cli_abort("No matching checksums found, can't proceed.") + } + version +} + +cli::cli_alert_info("Vendoring C++ sources") +system2("make", c("sync-cpp")) Review Comment: I think this will need to avoid `system()` to be useful: on Windows there's no guarantee that RTools is on PATH and I don't think there's any guarantee that `rsync` is installed anywhere. That said, `rsync` is probably faster. The recursive copy written in R I use is here: https://github.com/apache/arrow-adbc/blob/main/r/adbcsnowflake/bootstrap.R#L18-L64 ########## r/bootstrap.R: ########## @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (!dir.exists('../cpp')) { + cli::cli_alert_warning("Arrow C++ sources not found, skipping bootstrap.") + q(save = "no") Review Comment: Maybe `cli_abort()`? ########## r/bootstrap.R: ########## @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (!dir.exists('../cpp')) { + cli::cli_alert_warning("Arrow C++ sources not found, skipping bootstrap.") + q(save = "no") +} + +pkg_version <- package_version(desc::desc_get("Version")) +is_release <- is.na(pkg_version[1, 4]) || pkg_version[1, 4] < "100" +# for testing and CI +force_bootstrap <- identical(tolower(Sys.getenv("ARROW_FORCE_BOOTSTRAP", unset = "false")), "true") + +get_checksum_version <- function() { + url_exists <- function(url) { + headers <- curlGetHeaders(url) + attr(headers, "status") == 200 + } + # Run update-checksums.R manually if the checksums already exists + # but have an unexpected version. + if (dir.exists("tools/checksums") || force_bootstrap) { + cli::cli_alert_success("Found existing checksums, skipping download.") + return(NA) + } + + # We currently don't support prebuild binaries with a differing version. + jfrog_url <- "https://apache.jfrog.io/artifactory/arrow/r/%s/libarrow" + matching_url <- url_exists(sprintf(jfrog_url, pkg_version[1, 1:3])) + if (matching_url) { + version <- pkg_version[1, 1:3] + } else { + cli::cli_abort("No matching checksums found, can't proceed.") + } + version +} + +cli::cli_alert_info("Vendoring C++ sources") +system2("make", c("sync-cpp")) + +if (!is_release && !force_bootstrap) { + cli::cli_alert_warning("Skipping releases preparations for dev version.") + q(save = "no") +} + +cli::cli_alert_info("Installing dependencies") +devtools::install_dev_deps(".", upgrade = "never") +devtools::install_cran("styler") + +cli::cli_alert_info("Removing badges from Readme.md") +system2("sed", c("-i", "-e", "'/^<!--- badges: start -->$/,/^<!--- badges: stop -->$/d'", "README.md")) + +cli::cli_alert_info("Running urlchecker") +url_res <- urlchecker::url_check() +print(url_res) + +if (nrow(url_res) > 0 && !force_bootstrap) { + cli::cli_abort("Broken URLs found, can't proceed.") +} + +VERSION <- get_checksum_version() +if (!is.na(VERSION)) { + cli::cli_alert_info("Updating checksums for libarrow version: {VERSION}") + source("tools/update-checksums.R", local = TRUE) +} + +cli::cli_alert_info("Building documentation") +system2("make", c("doc")) Review Comment: Can this be `devtools::document()`? ########## r/bootstrap.R: ########## @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (!dir.exists('../cpp')) { + cli::cli_alert_warning("Arrow C++ sources not found, skipping bootstrap.") + q(save = "no") +} + +pkg_version <- package_version(desc::desc_get("Version")) +is_release <- is.na(pkg_version[1, 4]) || pkg_version[1, 4] < "100" +# for testing and CI +force_bootstrap <- identical(tolower(Sys.getenv("ARROW_FORCE_BOOTSTRAP", unset = "false")), "true") + +get_checksum_version <- function() { + url_exists <- function(url) { + headers <- curlGetHeaders(url) + attr(headers, "status") == 200 + } + # Run update-checksums.R manually if the checksums already exists + # but have an unexpected version. + if (dir.exists("tools/checksums") || force_bootstrap) { + cli::cli_alert_success("Found existing checksums, skipping download.") + return(NA) + } + + # We currently don't support prebuild binaries with a differing version. + jfrog_url <- "https://apache.jfrog.io/artifactory/arrow/r/%s/libarrow" + matching_url <- url_exists(sprintf(jfrog_url, pkg_version[1, 1:3])) + if (matching_url) { + version <- pkg_version[1, 1:3] + } else { + cli::cli_abort("No matching checksums found, can't proceed.") + } + version +} + +cli::cli_alert_info("Vendoring C++ sources") +system2("make", c("sync-cpp")) + +if (!is_release && !force_bootstrap) { + cli::cli_alert_warning("Skipping releases preparations for dev version.") + q(save = "no") Review Comment: Again, I think we want `stop()` or `cli_abort()` ########## r/bootstrap.R: ########## @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +if (!dir.exists('../cpp')) { + cli::cli_alert_warning("Arrow C++ sources not found, skipping bootstrap.") + q(save = "no") +} + +pkg_version <- package_version(desc::desc_get("Version")) +is_release <- is.na(pkg_version[1, 4]) || pkg_version[1, 4] < "100" +# for testing and CI +force_bootstrap <- identical(tolower(Sys.getenv("ARROW_FORCE_BOOTSTRAP", unset = "false")), "true") + +get_checksum_version <- function() { + url_exists <- function(url) { + headers <- curlGetHeaders(url) + attr(headers, "status") == 200 + } + # Run update-checksums.R manually if the checksums already exists + # but have an unexpected version. + if (dir.exists("tools/checksums") || force_bootstrap) { + cli::cli_alert_success("Found existing checksums, skipping download.") + return(NA) + } + + # We currently don't support prebuild binaries with a differing version. + jfrog_url <- "https://apache.jfrog.io/artifactory/arrow/r/%s/libarrow" + matching_url <- url_exists(sprintf(jfrog_url, pkg_version[1, 1:3])) + if (matching_url) { + version <- pkg_version[1, 1:3] + } else { + cli::cli_abort("No matching checksums found, can't proceed.") + } + version +} + +cli::cli_alert_info("Vendoring C++ sources") +system2("make", c("sync-cpp")) + +if (!is_release && !force_bootstrap) { + cli::cli_alert_warning("Skipping releases preparations for dev version.") + q(save = "no") +} + +cli::cli_alert_info("Installing dependencies") +devtools::install_dev_deps(".", upgrade = "never") +devtools::install_cran("styler") + +cli::cli_alert_info("Removing badges from Readme.md") +system2("sed", c("-i", "-e", "'/^<!--- badges: start -->$/,/^<!--- badges: stop -->$/d'", "README.md")) Review Comment: This is done prior to creating a release branch by the version bumping script, no? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
