diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa02e1c8e34..d48cb3c18ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -338,6 +338,7 @@ repos: ?^ci/scripts/python_wheel_macos_build\.sh$| ?^ci/scripts/python_wheel_xlinux_build\.sh$| ?^ci/scripts/r_build\.sh$| + ?^ci/scripts/r_deps\.sh$| ?^ci/scripts/r_revdepcheck\.sh$| ?^ci/scripts/release_test\.sh$| ?^ci/scripts/ruby_test\.sh$| diff --git a/ci/scripts/r_deps.sh b/ci/scripts/r_deps.sh index 2b432f768c2..94f72ce78e6 100755 --- a/ci/scripts/r_deps.sh +++ b/ci/scripts/r_deps.sh @@ -18,21 +18,21 @@ set -ex -: ${R_BIN:=R} +: "${R_BIN:=R}" -: ${R_PRUNE_DEPS:=FALSE} -R_PRUNE_DEPS=`echo $R_PRUNE_DEPS | tr '[:upper:]' '[:lower:]'` +: "${R_PRUNE_DEPS:=FALSE}" +R_PRUNE_DEPS=$(echo "$R_PRUNE_DEPS" | tr '[:upper:]' '[:lower:]') -: ${R_DUCKDB_DEV:=FALSE} -R_DUCKDB_DEV=`echo $R_DUCKDB_DEV | tr '[:upper:]' '[:lower:]'` +: "${R_DUCKDB_DEV:=FALSE}" +R_DUCKDB_DEV=$(echo "$R_DUCKDB_DEV" | tr '[:upper:]' '[:lower:]') -source_dir=${1}/r +source_dir="${1}/r" -pushd ${source_dir} +pushd "${source_dir}" -if [ ${R_PRUNE_DEPS} = "true" ]; then +if [ "${R_PRUNE_DEPS}" = "true" ]; then # To prevent the build from timing out, let's prune some optional deps (and their possible version requirements) - ${R_BIN} -e 'd <- read.dcf("DESCRIPTION") + "${R_BIN}" -e 'd <- read.dcf("DESCRIPTION") to_prune <- c("duckdb", "DBI", "dbplyr", "decor", "knitr", "rmarkdown", "pkgload", "reticulate") pattern <- paste0("\\n?", to_prune, " (\\\\(.*\\\\))?,?", collapse = "|") d[,"Suggests"] <- gsub(pattern, "", d[,"Suggests"]) @@ -43,15 +43,15 @@ fi # install.packages() emits warnings if packages fail to install, # but we want to error/fail the build. # options(warn=2) turns warnings into errors -${R_BIN} -e "options(warn=2); install.packages('remotes'); remotes::install_cran(c('glue', 'rcmdcheck', 'sys')); remotes::install_deps(INSTALL_opts = '"${INSTALL_ARGS}"')" +"${R_BIN}" -e "options(warn=2); install.packages('remotes'); remotes::install_cran(c('glue', 'rcmdcheck', 'sys')); remotes::install_deps(INSTALL_opts = '${INSTALL_ARGS}')" # Install DuckDB from github when requested -if [ ${R_DUCKDB_DEV} == "true" ]; then - ${R_BIN} -e "remotes::install_github('duckdb/duckdb-r', build = FALSE)" +if [ "${R_DUCKDB_DEV}" == "true" ]; then + "${R_BIN}" -e "remotes::install_github('duckdb/duckdb-r', build = FALSE)" fi # Separately install the optional/test dependencies but don't error on them, # they're not available everywhere and that's ok -${R_BIN} -e "remotes::install_deps(dependencies = TRUE, INSTALL_opts = '"${INSTALL_ARGS}"')" +"${R_BIN}" -e "remotes::install_deps(dependencies = TRUE, INSTALL_opts = '${INSTALL_ARGS}')" popd