amoeba commented on code in PR #39148:
URL: https://github.com/apache/arrow/pull/39148#discussion_r1421210665


##########
r/bootstrap.R:
##########
@@ -0,0 +1,84 @@
+# 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.
+
+git_sc <- system2("git", c("rev-parse", "--is-inside-work-tree"), stdout = 
FALSE, stderr = FALSE)
+if (git_sc != 0) {
+  cli::cli_alert_warning("Not in a git repository, skipping bootstrap.R")
+  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", 
default = "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 {
+    stop("No matching checksums found, can't proceed.")
+  }
+  version
+}
+
+if (!is_release) {
+  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", "'/^<!--- badges: start -->$/,/^<!--- badges: stop 
-->$/d'", "README.md"))

Review Comment:
   macOS uses BSD sed which needs to be called like,
   
   ```
   sed -i -e '/^<!--- badges: start -->$/,/^<!--- badges: stop -->$/d' README.md
   ```
   
   The alternative would be to use gsed on macOS and require whoever runs this 
to install gsed (like from brew).



##########
r/bootstrap.R:
##########
@@ -0,0 +1,84 @@
+# 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.
+
+git_sc <- system2("git", c("rev-parse", "--is-inside-work-tree"), stdout = 
FALSE, stderr = FALSE)
+if (git_sc != 0) {
+  cli::cli_alert_warning("Not in a git repository, skipping bootstrap.R")
+  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", 
default = "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 {
+    stop("No matching checksums found, can't proceed.")
+  }
+  version
+}
+
+if (!is_release) {
+  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", "'/^<!--- badges: start -->$/,/^<!--- badges: stop 
-->$/d'", "README.md"))

Review Comment:
   It looks like update-checksums-R also calls sed assuming it's GNU sed not 
BSD so whatever change is made here should be made there too.



##########
r/bootstrap.R:
##########
@@ -0,0 +1,84 @@
+# 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.
+
+git_sc <- system2("git", c("rev-parse", "--is-inside-work-tree"), stdout = 
FALSE, stderr = FALSE)
+if (git_sc != 0) {
+  cli::cli_alert_warning("Not in a git repository, skipping bootstrap.R")
+  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", 
default = "false")), "true")

Review Comment:
   What is the `default` arg here? Did you mean `unset`?



##########
r/bootstrap.R:
##########
@@ -0,0 +1,84 @@
+# 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.
+
+git_sc <- system2("git", c("rev-parse", "--is-inside-work-tree"), stdout = 
FALSE, stderr = FALSE)
+if (git_sc != 0) {
+  cli::cli_alert_warning("Not in a git repository, skipping bootstrap.R")
+  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", 
default = "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 {
+    stop("No matching checksums found, can't proceed.")

Review Comment:
   Could this be `cli::cli_abort` to match how we stop on line 69?



-- 
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]

Reply via email to