aboutsummaryrefslogtreecommitdiffstats
path: root/.extras/test-logic.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-14 15:29:45 +0200
committerDanilo M. <danix@danix.xyz>2026-07-14 15:29:45 +0200
commite129f089e9e014366591808fc48ad5ccce37858c (patch)
tree4e17baa3b35ffe13404757b319a47b463f58e01b /.extras/test-logic.sh
parente4edbf22caf1558217ea9aff43a81dd4b5263516 (diff)
downloadsbo-slackbuilds-e129f089e9e014366591808fc48ad5ccce37858c.tar.gz
sbo-slackbuilds-e129f089e9e014366591808fc48ad5ccce37858c.zip
test-build: target the local SlackBuild (CWD/path), deps from the tree
The tool resolved the target package from the SBo tree, so it tested the already-published version, not the local edit under test. Useless for the maintenance workflow, where the point is to verify an edited SlackBuild while its deps come from the tree. resolve_target_dir now takes the target from where you are: - a path (absolute, ./x, or containing /): that dir - a bare name: ./<name>/ under CWD, else CWD itself if it IS <name>/ Repo-agnostic; deps still resolve from the configured SBo tree via find_slackbuild_dir. Add four target-resolution self-checks. Also source /etc/profile.d/*.sh in the build container before running the SlackBuild: the heredoc is a non-login shell, so a bare `go build` picked the system gccgo 1.18 instead of the installed google-go-lang; sourcing profile.d activates dep-provided env (GOROOT/PATH, cargo, ...) as a real login build would. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to '.extras/test-logic.sh')
-rw-r--r--.extras/test-logic.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/.extras/test-logic.sh b/.extras/test-logic.sh
index 0616c99..469ac1d 100644
--- a/.extras/test-logic.sh
+++ b/.extras/test-logic.sh
@@ -67,6 +67,23 @@ order="${order% }"
resolve_target "$T/cat/d"
[[ ${#UNMET[@]} -eq 1 ]] && ok "unmet-dep caught" || bad "unmet-dep missed"
+# --- resolve_target_dir (target from CWD/path, NOT the SBo tree) -------------
+# Local package dir, separate from the fake SBo tree above.
+LOCALREPO=$(mktemp -d); mkdir -p "$LOCALREPO/mypkg"
+echo 'REQUIRES=""' > "$LOCALREPO/mypkg/mypkg.info"
+# 1. absolute path
+got="$(resolve_target_dir "$LOCALREPO/mypkg" 2>/dev/null)"
+[[ "$got" == "$LOCALREPO/mypkg" ]] && ok "target: absolute path" || bad "abs path got [$got]"
+# 2. bare name resolved under CWD (./mypkg/)
+got="$(cd "$LOCALREPO" && resolve_target_dir "mypkg" 2>/dev/null)"
+[[ "$got" == "$LOCALREPO/mypkg" ]] && ok "target: bare name in CWD" || bad "bare-in-cwd got [$got]"
+# 3. CWD itself is the package
+got="$(cd "$LOCALREPO/mypkg" && resolve_target_dir "mypkg" 2>/dev/null)"
+[[ "$got" == "$LOCALREPO/mypkg" ]] && ok "target: CWD is the package" || bad "cwd-is-pkg got [$got]"
+# 4. missing -> failure
+resolve_target_dir "nosuchpkg" >/dev/null 2>&1 && bad "missing target should fail" || ok "target: missing fails"
+rm -rf "$LOCALREPO"
+
resolve_target "$T/cat/e"
[[ ${#CYCLES[@]} -ge 1 ]] && ok "cycle caught" || bad "cycle missed"