This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 17:36:53 +01:00
1 parent 5b6d4a7903
commit 4d1087e357
160 files changed
+2407 -1933

No files matched your search

-5
View File
@@ -27,7 +27,6 @@ prune_directories() {
fi
while IFS= read -r -d '' sorted; do
# Strip the mtime sort key before passing paths to rm.
entry="${sorted#* }"
name="${entry##*/}"
@@ -93,13 +92,11 @@ cleanup_installed_releases() {
prune_directories "$releases" "$KEEP_RELEASES" "$current_release"
}
# Only stale incremental state is reclaimed; compiled dependencies are kept.
cleanup_safe_cargo_target() {
local target="${CARGO_TARGET_DIR:-$ROOT/target}"
local profile item
if [[ "$target" != /* ]]; then target="$ROOT/$target"; fi
[[ -d "$target" && ! -L "$target" ]] || return 0
# Reject targets with symlinked ancestor paths; never follow links.
if [[ "$(realpath -ms -- "$target")" != "$(realpath -e -- "$target" 2>/dev/null || true)" ]]; then
printf 'WARNING: target cleanup skipped for symlinked target: %s\n' "$target" >&2
return 0
@@ -107,7 +104,6 @@ cleanup_safe_cargo_target() {
command -v flock >/dev/null 2>&1 || return 0
for profile in release debug; do
[[ -d "$target/$profile" && ! -L "$target/$profile" ]] || continue
# Skip while another cargo build holds the profile lock.
exec {cargo_lock_fd}>>"$target/$profile/.cargo-lock"
if ! flock -n -x "$cargo_lock_fd"; then
exec {cargo_lock_fd}>&-
@@ -188,5 +184,4 @@ if command -v flock >/dev/null 2>&1; then
else
printf 'WARNING: flock unavailable; retention cleanup skipped\n' >&2
fi
# This cleanup does not remove any Cargo dependency/compiler artifacts.
cleanup_safe_cargo_target