diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-13 10:26:01 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-13 10:26:01 +0200 |
| commit | 368023455770538ad0f7568ee83cf4cef0a4eabc (patch) | |
| tree | e2c5adabee31da3333666b176b33ffc106644906 /.extras/test-build | |
| parent | b8281632a92d3b85db0beab8f43022180000720d (diff) | |
| download | sbo-slackbuilds-368023455770538ad0f7568ee83cf4cef0a4eabc.tar.gz sbo-slackbuilds-368023455770538ad0f7568ee83cf4cef0a4eabc.zip | |
test-build: current-vs-stable override engine
Diffstat (limited to '.extras/test-build')
| -rwxr-xr-x | .extras/test-build | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/.extras/test-build b/.extras/test-build index fa24fa6..a7e796e 100755 --- a/.extras/test-build +++ b/.extras/test-build @@ -178,6 +178,7 @@ declare -A UNMET=() declare -a CYCLES=() declare -A HAS_README=() declare -A _vstate=() +declare -A FETCH_DEPS=() # prog -> 1: resolve via sbopkg in-container # Is a prog already present in the container base? Overridden at build time to # consult the image; in resolution we treat "in base" as a callback so the pure @@ -203,6 +204,11 @@ _resolve_visit() { HAS_README["$dir"]=1 continue fi + tok="$(apply_rename "$tok")" + if [[ "${OV_FETCH[$tok]:-}" == "1" ]]; then + FETCH_DEPS["$tok"]=1 + continue + fi if depdir="$(find_slackbuild_dir "$tok")"; then _resolve_visit "$depdir" "$key" || rc=1 elif installed_in_base "$tok"; then @@ -223,15 +229,69 @@ resolve_target() { RESOLVED_ORDER=() CYCLES=() UNMET=() + FETCH_DEPS=() _vstate=() _resolve_visit "$dir" "(top)" } +# ============================================================================= +# current-vs-stable overrides. Parsed from $TB_OVERRIDES. Applied only when +# targeting -current (15.0 is the SBo baseline, no deltas). +# ============================================================================= +declare -A OV_DROP=() # prog -> 1 +declare -A OV_RENAME=() # old -> new +declare -A OV_FETCH=() # prog -> 1 + +load_overrides() { + OV_DROP=(); OV_RENAME=(); OV_FETCH=() + # 15.0 is the baseline: no overrides. + [[ "$VERSION_ID" == "15.0" ]] && return + [[ -f "$TB_OVERRIDES" ]] || return + local line kind rest + while IFS= read -r line; do + line="${line%%#*}" # strip comments + line="${line#"${line%%[![:space:]]*}"}" # ltrim + [[ -z "$line" ]] && continue + kind="${line%%:*}"; rest="${line#*:}" + kind="${kind//[[:space:]]/}" + rest="${rest#"${rest%%[![:space:]]*}"}" # ltrim value + case "$kind" in + drop) OV_DROP["${rest//[[:space:]]/}"]=1 ;; + fetch) OV_FETCH["${rest//[[:space:]]/}"]=1 ;; + rename) + # rest is "old -> new" + local old new + old="${rest%%->*}"; new="${rest##*->}" + old="${old//[[:space:]]/}"; new="${new//[[:space:]]/}" + [[ -n "$old" && -n "$new" ]] && OV_RENAME["$old"]="$new" ;; + *) echo "WARN: unknown override rule: $line" >&2 ;; + esac + done < "$TB_OVERRIDES" +} + +# Map a dep token through rename rules (identity if no rule). +apply_rename() { + local tok="$1" + echo "${OV_RENAME[$tok]:-$tok}" +} + +# Remove dropped packages from RESOLVED_ORDER in place. +apply_overrides_to_order() { + local d prog keep=() + for d in "${RESOLVED_ORDER[@]}"; do + prog="$(basename "$d")" + [[ "${OV_DROP[$prog]:-}" == "1" ]] && continue + keep+=("$d") + done + RESOLVED_ORDER=("${keep[@]:-}") +} + main() { parse_args "$@" init_color require_config SBO_TREE_ROOTS=("$ACTIVE_TREE") + load_overrides } main "$@" |
