From e129f089e9e014366591808fc48ad5ccce37858c Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 14 Jul 2026 15:29:45 +0200 Subject: 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: .// under CWD, else CWD itself if it IS / 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 --- .extras/test-logic.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to '.extras/test-logic.sh') 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" -- cgit v1.2.3