Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/workflows/r_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,20 @@ jobs:
full.names = TRUE
)

current_path <- list.files(art_path, full.names = TRUE, recursive = TRUE)
files <- sub("r-(pkg|lib)", repo_root, current_path)
current_pkg_path <- list.files(art_path,
full.names = TRUE,
pattern = "r-pkg",
recursive = TRUE
)
current_lib_path <- list.files(art_path,
full.names = TRUE,
pattern = "r-lib",
recursive = TRUE
)
files <- c(
sub("r-pkg", repo_root, current_pkg_path),
sub("r-lib", paste0(repo_root, "__r-lib"), current_lib_path),
)

# decode contrib.url from artifact name:
# bin__windows__contrib__4.1 -> bin/windows/contrib/4.1
Expand All @@ -142,17 +154,29 @@ jobs:
run: |
prune() {
# list files | retain $KEEP newest files | delete everything else
ls -t $1/arrow* | tail -n +$((KEEP + 1)) | xargs --no-run-if-empty rm
ls -t "$@" | tail -n +$((KEEP + 1)) | xargs --no-run-if-empty rm
}

# find leaf sub dirs
repo_dirs=$(find repo -type d -links 2)

# Old packages: repo/libarrow/bin/${TARGET}/arrow-${VERSION}.zip
#
# We want to retain $keep (14) versions of each pkg/lib so we call
# prune on each leaf dir and not on repo/.
for dir in ${repo_dirs[@]}; do
prune $dir
for dir in "${repo_dirs[@]}"; do
prune $dir/arrow*
done

# New packages: repo/libarrow/${TARGET}-arrow-${VERSION}.zip
prune repo/libarrow/r-libarrow-darwin-arm64-openssl-1.1-* || :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL what || : does. I think I've used || true or the like for similar behavior elsewhere. Out of curiosity: is one better / more compatible / more idiomatic than the other?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tldr: no practical difference

Copy link
Member Author

@kou kou Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My cases:

  • Use true for condition:
    • e.g.: while true; do ...
  • Use : for ignoring, doing nothing, ...:
    • e.g.: ... || :: Ignore error
    • e.g.: : command line: Ignore this command line (same as # command line but it works with multiline command line. I also use echo command line for this case.)
    • e.g.: if ...; do :; fi: Do nothing (like pass in Python)
    • e.g.: : ${VARIABLE:=DEFAULT_VALUE}: Do nothing (setting default value by ${...:=...} is the important part)

prune repo/libarrow/r-libarrow-darwin-arm64-openssl-3.0-* || :
prune repo/libarrow/r-libarrow-darwin-x86_64-openssl-1.1-* || :
prune repo/libarrow/r-libarrow-darwin-x86_64-openssl-3.0-* || :
prune repo/libarrow/r-libarrow-linux-x86_64-openssl-1.0-* || :
prune repo/libarrow/r-libarrow-linux-x86_64-openssl-1.1-* || :
prune repo/libarrow/r-libarrow-linux-x86_64-openssl-3.0-* || :
prune repo/libarrow/r-libarrow-windows-x86_64-* || :
- name: Update Repository Index
shell: Rscript {0}
run: |
Expand Down