diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-16 11:50:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-16 11:50:04 +0200 |
| commit | 3610ad0b72d3bee64c54cb475516a6a20442c07f (patch) | |
| tree | a8c9d2e6b603283e779b89c769f91b353abce123 | |
| parent | 766a11b18578e754eebc9d2ca69b198ef01129e1 (diff) | |
| download | sbo-dockerbuild-3610ad0b72d3bee64c54cb475516a6a20442c07f.tar.gz sbo-dockerbuild-3610ad0b72d3bee64c54cb475516a6a20442c07f.zip | |
test-build: add --local-deps for in-repo deps
Resolve deps that are siblings in the target's own repo (not on SBo or
official Slackware) by prepending the target's repo root to the dep search
roots when --local-deps is passed. The SBo tree is still searched after.
Covers packages like huggingface_cli whose deps live in the same
maintenance repo. Adds two logic self-checks and updates CLAUDE.md,
README, and the test-build-slackbuild skill.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | CLAUDE.md | 8 | ||||
| -rw-r--r-- | README.md | 5 | ||||
| -rw-r--r-- | skills/test-build-slackbuild/SKILL.md | 15 | ||||
| -rwxr-xr-x | test-build | 14 | ||||
| -rw-r--r-- | test-logic.sh | 13 |
5 files changed, 52 insertions, 3 deletions
@@ -64,6 +64,10 @@ Deps are resolved from the SBo tree in the config (`SBO_TREE_CURRENT` / per run from the image's `/var/log/packages`), or 3. an override (see below). +With `--local-deps`, the target's own repo root (its grandparent dir) is +prepended to the search roots, so a dep that is a sibling in the same repo (not +on SBo) resolves and builds from there before the SBo tree is consulted. + Deps build first and are cached; the target always rebuilds (that is the test). ### current-vs-stable overrides @@ -101,7 +105,9 @@ built deps). Only **deps** are cached, never the target. `--stable` (15.0), `--dry-run`, `--yes`, `--no-cache`, `--keep` (copy the built target `.txz` to `<data>/kept/` so it can be installed on the host, e.g. to -regenerate post-install artifacts), `--no-color`. +regenerate post-install artifacts), `--local-deps` (also resolve deps from the +target's own repo, its grandparent dir, prepended before the SBo tree, for +packages whose deps are siblings in the same repo and not on SBo), `--no-color`. ## image-builder @@ -49,8 +49,13 @@ Test-build a package you are editing (from its dir, or by path): cd some-slackbuild-dir && test-build <name> # -current test-build --stable <name> # 15.0 test-build --keep <name> # also keep the built .txz +test-build --local-deps <name> # deps live in the same repo ``` +`--local-deps` also searches the target's own repo (its grandparent dir) for +deps, for packages whose deps are siblings in the same repo and not on SBo. The +configured SBo tree is still searched after. + Build the images (on the docker host; see `image-builder/README`): ```bash diff --git a/skills/test-build-slackbuild/SKILL.md b/skills/test-build-slackbuild/SKILL.md index 3cac388..e8b553c 100644 --- a/skills/test-build-slackbuild/SKILL.md +++ b/skills/test-build-slackbuild/SKILL.md @@ -14,7 +14,7 @@ description: Use when driving the sbo-dockerbuild `test-build` tool to verify a There are TWO different package sources. Do not conflate them: - **Target** = the SlackBuild *under edit*. Resolved from **where you are** (CWD or a path you pass), NOT from the config tree. Always rebuilt. -- **Deps** = resolved from the **config tree** (`SBO_TREE_CURRENT` / `SBO_TREE_STABLE`). Built once and cached. +- **Deps** = resolved from the **config tree** (`SBO_TREE_CURRENT` / `SBO_TREE_STABLE`). Built once and cached. (With `--local-deps`, also from the target's own repo, see below.) Common mistake: `cd`ing into the config SBo tree to test an edit. Wrong. The edit lives wherever it was edited. `cd` into *that* dir. If the edit and the config tree happen to be the same dir, fine, but never assume it. @@ -41,6 +41,18 @@ test-build --yes --stable foo # 15.0 **`--yes` for any non-interactive run.** Without it `test-build` prints the order then blocks on `read -rp "Proceed?"`. Driving it non-interactively without `--yes` hangs. The order is still printed with `--yes`. +## Deps that live in the target's own repo + +If the target's deps are **siblings in the same repo** (not on SBo and not official Slackware, e.g. a package plus its private deps in one maintenance repo), the default tree search won't find them and they show as UNMET. Pass `--local-deps`: it prepends the target's repo root (its grandparent dir, since the target sits at `<repo>/<category>/<pkg>`) to the search roots, so those siblings resolve and build before the SBo tree is consulted. + +```bash +cd my-slackbuilds/<category>/foo +test-build --local-deps --dry-run foo # confirm the local deps now resolve +test-build --local-deps --yes foo +``` + +The local deps must themselves be valid, buildable SlackBuilds. Without the flag, behavior is unchanged. + ## Deps that -current already ships 15.0 is the SBo baseline; `-current` has deltas. `~/.config/sbo-testbuild/overrides` (applied **only on -current**, inert on 15.0) handles them: @@ -60,6 +72,7 @@ test-build --yes --stable foo # 15.0 | `--yes` | Skip the confirm prompt (order still printed). Use for non-interactive runs. | | `--no-cache` | Rebuild all deps this run. | | `--keep` | Copy the built target `.txz` to `kept/` so it can be installed on the host. | +| `--local-deps` | Also resolve deps from the target's own repo (grandparent dir), for deps that are siblings in the same repo and not on SBo. | | `--no-color` | Disable ANSI color (auto-off when not a TTY). | | `-V`, `--version` | Print version. | @@ -53,6 +53,7 @@ DRY_RUN=0 # --dry-run: resolve + print order, do not build ASSUME_YES=0 # --yes: skip the confirm prompt (still prints the order) USE_CACHE=1 # --no-cache disables the dep cache for one run KEEP_TARGET=0 # --keep: copy the built target package out to KEEP_DIR +LOCAL_DEPS=0 # --local-deps: also resolve deps from the target's own repo VERSION_ID="current" # "current" | "15.0"; set by --stable TARGET_ARG="" @@ -85,6 +86,9 @@ OPTIONS: --keep Copy the built target package out to a kept/ dir (path is printed), so it can be installed on the host. The build is otherwise throwaway. + --local-deps Also resolve deps from the target's own repo (its grandparent + dir), for packages whose deps are siblings in the same repo and + not on SBo. The configured SBo tree is still searched after. --no-color Disable ANSI color (auto-disabled when stdout is not a TTY). EOF } @@ -99,6 +103,7 @@ parse_args() { --yes) ASSUME_YES=1; shift ;; --no-cache) USE_CACHE=0; shift ;; --keep) KEEP_TARGET=1; shift ;; + --local-deps) LOCAL_DEPS=1; shift ;; --no-color) USE_COLOR=0; shift ;; -*) echo "Unknown option: $1" >&2; usage >&2; exit 2 ;; *) @@ -851,7 +856,7 @@ main() { parse_args "$@" init_color require_config - SBO_TREE_ROOTS=("$ACTIVE_TREE") + SBO_TREE_ROOTS=("$ACTIVE_TREE") # target's repo root prepended below if --local-deps load_overrides # image + cache namespace (skip the image check on a pure dry-run so the order @@ -873,6 +878,13 @@ main() { exit 1 fi + # --local-deps: search the target's own repo (grandparent of <repo>/<cat>/<pkg>) + # before the SBo tree, so deps that are siblings in the same repo resolve. + if [[ $LOCAL_DEPS -eq 1 ]]; then + local repo_root; repo_root="$(dirname "$(dirname "$tdir")")" + SBO_TREE_ROOTS=("$repo_root" "${SBO_TREE_ROOTS[@]}") + fi + run_target "$tdir" print_summary } diff --git a/test-logic.sh b/test-logic.sh index da50513..563eb30 100644 --- a/test-logic.sh +++ b/test-logic.sh @@ -96,6 +96,19 @@ got="$(cd "$LOCALREPO/mypkg" && resolve_target_dir "mypkg" 2>/dev/null)" resolve_target_dir "nosuchpkg" >/dev/null 2>&1 && bad "missing target should fail" || ok "target: missing fails" rm -rf "$LOCALREPO" +# --- --local-deps: dep resolved from a second (local repo) root ------------- +# 'a' needs 'b'/'c' (already in $T) plus 'loc' which lives only in a separate +# repo root. With just $T it's UNMET; prepend the local root and it resolves. +LR=$(mktemp -d); mkdir -p "$LR/cat/loc"; echo 'REQUIRES=""' > "$LR/cat/loc/loc.info" +mk k "loc" +SBO_TREE_ROOTS=("$T") +resolve_target "$T/cat/k" +[[ ${#UNMET[@]} -eq 1 ]] && ok "local dep unmet without --local-deps" || bad "local dep should be unmet" +SBO_TREE_ROOTS=("$LR" "$T") # what --local-deps prepends +resolve_target "$T/cat/k" +[[ ${#UNMET[@]} -eq 0 ]] && ok "local dep resolved via extra root" || bad "local dep still unmet with extra root" +SBO_TREE_ROOTS=("$T"); rm -rf "$LR" + resolve_target "$T/cat/e" [[ ${#CYCLES[@]} -ge 1 ]] && ok "cycle caught" || bad "cycle missed" |
