aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-13 10:09:13 +0200
committerDanilo M. <danix@danix.xyz>2026-07-13 10:09:13 +0200
commiteb749440407dafe821d390e093f2341478f93640 (patch)
treeb3463efa7d5defa890a5fc4a08cd1cdb85640cb0
parent1e42a7fedfdf60b19cbe336b83a5f9df3b850af3 (diff)
downloadsbo-slackbuilds-eb749440407dafe821d390e093f2341478f93640.tar.gz
sbo-slackbuilds-eb749440407dafe821d390e093f2341478f93640.zip
test-build: scaffold script + self-check
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-x.extras/test-build40
-rw-r--r--.extras/test-logic.sh36
2 files changed, 76 insertions, 0 deletions
diff --git a/.extras/test-build b/.extras/test-build
new file mode 100755
index 0000000..51faadc
--- /dev/null
+++ b/.extras/test-build
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# test-build - verify an already-published SBo package still builds on a target
+# Slackware version inside a throwaway docker container. Resolves + builds its
+# SBo deps from the local tree, caches built deps per image digest, reports
+# per-package status and lints the target.
+#
+# Dependency-resolution, cache, and summary logic are adapted from sbo-batch-test
+# (github: danixland). The overlay chroot is replaced by a docker container: the
+# container IS the disposable environment, so no overlayfs.
+#
+# No em dashes in prose by author convention.
+
+# =============================================================================
+# CONFIG (do not edit here; real values live in the external config file)
+# =============================================================================
+SBO_TREE_CURRENT=""
+SBO_TREE_STABLE=""
+IMAGE_CURRENT=""
+IMAGE_STABLE=""
+LOG_ROOT="/var/log/sbo-test-build"
+PKG_CACHE=""
+
+TB_CONFIG="${TB_CONFIG:-$HOME/.config/sbo-testbuild/config}"
+if [[ -f "$TB_CONFIG" ]]; then
+ # shellcheck disable=SC1090
+ source "$TB_CONFIG"
+fi
+
+TB_OVERRIDES="${TB_OVERRIDES:-$HOME/.config/sbo-testbuild/overrides}"
+
+# =============================================================================
+set -uo pipefail
+# Not -e: a package build failing is a handled outcome, not a script crash.
+
+main() {
+ :
+}
+
+main "$@"
diff --git a/.extras/test-logic.sh b/.extras/test-logic.sh
new file mode 100644
index 0000000..20041a9
--- /dev/null
+++ b/.extras/test-logic.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Logic self-check for .extras/test-build. Covers the pure, host-side parts:
+# dependency resolution, override application, unknown-dep -> UNMET, cache
+# decisions, and BLOCKED-BY-DEP propagation. No docker.
+#
+# Run: bash .extras/test-logic.sh
+#
+set -uo pipefail
+
+SCRIPT="$(dirname "$0")/test-build"
+T=$(mktemp -d)
+BASE_DB=$(mktemp -d); mkdir -p "$BASE_DB"
+
+cleanup() { rm -rf "$T" "$BASE_DB"; }
+trap cleanup EXIT
+
+# Source the script without running main(). Sourcing re-runs the CONFIG block,
+# so set test vars AFTER the source.
+LIB=$(mktemp)
+sed '/^main "\$@"$/d' "$SCRIPT" > "$LIB"
+# shellcheck disable=SC1090
+source "$LIB" 2>/dev/null
+rm -f "$LIB"
+
+pass=0; fail=0
+ok() { echo " ok: $1"; ((pass++)); return 0; }
+bad() { echo " FAIL: $1"; ((fail++)); return 0; }
+
+# Placeholder assertion so this file runs before any logic exists.
+ok "script sources without executing main"
+
+echo
+echo "$pass passed, $fail failed"
+[[ $fail -eq 0 ]] || exit 1
+echo "ALL LOGIC CHECKS PASS"