diff options
Diffstat (limited to 'sbo-batch-test')
| -rwxr-xr-x | sbo-batch-test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sbo-batch-test b/sbo-batch-test index f2b9c14..c028df1 100755 --- a/sbo-batch-test +++ b/sbo-batch-test @@ -343,6 +343,32 @@ rsync_tree() { "$SBO_RSYNC_URL/" "$root/" } +# Echo (one per line) the <root>-relative dirs of upstream packages that +# duplicate a package in a personal subtree. Reads only, never removes. A +# personal package is a subdir with a matching <name>.SlackBuild; an upstream +# dup is a same-named depth-2 dir anywhere under <root> outside the personal +# trees. +collect_shadows() { + local root="$1" + local -a personal_dirs=() prune=() + local dir + for dir in "${!SBO_PERSONAL_TREES[@]}"; do + [[ -d "$root/$dir" ]] || continue + personal_dirs+=("$root/$dir") + prune+=(! -path "$root/$dir/*") + done + [[ ${#personal_dirs[@]} -eq 0 ]] && return + local pkgdir pkg match + while IFS= read -r pkgdir; do + pkg=$(basename "$pkgdir") + [[ -f "$pkgdir/$pkg.SlackBuild" ]] || continue + while IFS= read -r match; do + echo "${match#"$root"/}" + done < <(find "$root" -mindepth 2 -maxdepth 2 -type d \ + -name "$pkg" "${prune[@]}") + done < <(find "${personal_dirs[@]}" -mindepth 1 -maxdepth 1 -type d) +} + # ============================================================================= # Package cache. Persistent, on-disk store of built packages so unchanged deps # are installed from cache instead of rebuilt. Layout mirrors the SBo tree: |
