aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-11 10:56:40 +0200
committerDanilo M. <danix@danix.xyz>2026-07-11 10:56:40 +0200
commitb2ca2b700da2c3e7b84173402fc9736fb374ebdd (patch)
tree93c545cc2d6b0fff47d0fc7ed5421947d5b51529
parentd0ea4601820e639a261a9f1075e5358a8cb089af (diff)
downloadsbo-batch-tester-b2ca2b700da2c3e7b84173402fc9736fb374ebdd.tar.gz
sbo-batch-tester-b2ca2b700da2c3e7b84173402fc9736fb374ebdd.zip
Add rsync_excludes helper + self-check
Emits one anchored --exclude=/<dir>/ per SBO_PERSONAL_TREES key, so a future rsync-based tree sync never deletes personal/pentesting clones that are not on the sync source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-xsbo-batch-test10
-rwxr-xr-xtest-logic.sh9
2 files changed, 19 insertions, 0 deletions
diff --git a/sbo-batch-test b/sbo-batch-test
index 5f9695d..a29461b 100755
--- a/sbo-batch-test
+++ b/sbo-batch-test
@@ -321,6 +321,16 @@ update_base() {
echo "Base patched."
}
+# Echo one anchored `--exclude=/<dir>/` per SBO_PERSONAL_TREES key, one per
+# line. Anchored to the tree root so rsync --delete never wipes a personal
+# clone (they are not on the rsync source). Empty when no personal trees.
+rsync_excludes() {
+ local dir
+ for dir in "${!SBO_PERSONAL_TREES[@]}"; do
+ echo "--exclude=/$dir/"
+ done
+}
+
# =============================================================================
# Package cache. Persistent, on-disk store of built packages so unchanged deps
# are installed from cache instead of rebuilt. Layout mirrors the SBo tree:
diff --git a/test-logic.sh b/test-logic.sh
index 797041f..423d2b5 100755
--- a/test-logic.sh
+++ b/test-logic.sh
@@ -143,6 +143,15 @@ mkdir -p "$T/cat/verpkg"
printf 'PRGNAM="verpkg"\nVERSION="3.4.5"\nREQUIRES=""\n' > "$T/cat/verpkg/verpkg.info"
[[ "$(version_of "$T/cat/verpkg")" == "3.4.5" ]] && ok "version_of reads VERSION" || bad "version_of wrong, got [$(version_of "$T/cat/verpkg")]"
+# --- rsync_excludes: one anchored --exclude per personal tree key ------------
+declare -A SBO_PERSONAL_TREES=([personal]=url1 [pentesting]=url2)
+ex="$(rsync_excludes)"
+echo "$ex" | grep -qx -- "--exclude=/personal/" && ok "rsync_excludes personal" || bad "missing --exclude=/personal/, got [$ex]"
+echo "$ex" | grep -qx -- "--exclude=/pentesting/" && ok "rsync_excludes pentesting" || bad "missing --exclude=/pentesting/, got [$ex]"
+
+declare -A SBO_PERSONAL_TREES=()
+[[ -z "$(rsync_excludes)" ]] && ok "rsync_excludes empty for no trees" || bad "rsync_excludes should be empty, got [$(rsync_excludes)]"
+
# --- result -----------------------------------------------------------------
echo
echo "$pass passed, $fail failed"