aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmkhint93
-rwxr-xr-xtests/mkhint_test.sh85
2 files changed, 144 insertions, 34 deletions
diff --git a/mkhint b/mkhint
index 990eeb3..48a11af 100755
--- a/mkhint
+++ b/mkhint
@@ -1202,46 +1202,71 @@ check_updates() {
fi
fi
+ local updated=()
if [[ ${#outdated_pkgs[@]} -eq 0 ]]; then
echo "all up to date"
- return 0
- fi
+ else
+ # Report
+ echo ""
+ echo "Updates available:"
+ local i
+ for (( i=0; i<${#outdated_pkgs[@]}; i++ )); do
+ local note=""; [[ "${outdated_flag[$i]}" == "?downgrade" ]] && note=" (?downgrade)"
+ printf " %-30s %s -> %s%s\n" "${outdated_pkgs[$i]}" "${outdated_old[$i]}" "${outdated_new[$i]}" "$note"
+ done
+ echo ""
- # Report
- echo ""
- echo "Updates available:"
- local i
- for (( i=0; i<${#outdated_pkgs[@]}; i++ )); do
- local note=""; [[ "${outdated_flag[$i]}" == "?downgrade" ]] && note=" (?downgrade)"
- printf " %-30s %s -> %s%s\n" "${outdated_pkgs[$i]}" "${outdated_old[$i]}" "${outdated_new[$i]}" "$note"
- done
- echo ""
+ # Per-package confirm + update
+ for (( i=0; i<${#outdated_pkgs[@]}; i++ )); do
+ local p="${outdated_pkgs[$i]}"
+ local note=""; [[ "${outdated_flag[$i]}" == "?downgrade" ]] && note=" (?downgrade)"
+ local answer
+ read -r -p "${p} ${outdated_old[$i]} -> ${outdated_new[$i]}${note}. Update? [Y/n] " answer
+ answer="${answer:-Y}"
+ if [[ "$answer" =~ ^[Yy]$ ]]; then
+ update_hint_file "$p" "${outdated_new[$i]}"
+ nvtake -c "$NVCHECKER_CONFIG" "$p" >&2 || true
+ updated+=("$p")
+ fi
+ done
- # Per-package confirm + update
- local updated=()
- for (( i=0; i<${#outdated_pkgs[@]}; i++ )); do
- local p="${outdated_pkgs[$i]}"
- local note=""; [[ "${outdated_flag[$i]}" == "?downgrade" ]] && note=" (?downgrade)"
- local answer
- read -r -p "${p} ${outdated_old[$i]} -> ${outdated_new[$i]}${note}. Update? [Y/n] " answer
- answer="${answer:-Y}"
- if [[ "$answer" =~ ^[Yy]$ ]]; then
- update_hint_file "$p" "${outdated_new[$i]}"
- nvtake -c "$NVCHECKER_CONFIG" "$p" >&2 || true
- updated+=("$p")
+ # Split updated packages: existing → update, new → build.
+ if [[ ${#updated[@]} -gt 0 ]]; then
+ local -a existing=() fresh=()
+ local up
+ for up in "${updated[@]}"; do
+ if pkg_in_repo "$up"; then existing+=("$up"); else fresh+=("$up"); fi
+ done
+ run_slackrepo update "${existing[@]}"
+ run_slackrepo build "${fresh[@]}"
fi
- done
-
- # Split updated packages: existing → update, new → build.
- if [[ ${#updated[@]} -gt 0 ]]; then
- local -a existing=() fresh=()
- local up
- for up in "${updated[@]}"; do
- if pkg_in_repo "$up"; then existing+=("$up"); else fresh+=("$up"); fi
- done
- run_slackrepo update "${existing[@]}"
- run_slackrepo build "${fresh[@]}"
fi
+
+ # Phase 2: bundled-dep manifest reconcile for listed packages.
+ load_bundle_manifests
+ local was_updated
+ for pkg in "${targets[@]}"; do
+ pkg_has_manifest "$pkg" || continue
+ local hintpath="${HINT_DIR%/}/${pkg}.hint"
+ [[ -f "$hintpath" ]] || continue
+ was_updated=0
+ local u
+ for u in "${updated[@]}"; do [[ "$u" == "$pkg" ]] && was_updated=1; done
+ if [[ $was_updated -eq 0 && $FORCE -ne 1 ]]; then
+ continue
+ fi
+ local cur; cur=$(grep '^VERSION=' "$hintpath" | sed 's/VERSION="//;s/"$//')
+ local murl; murl=$(manifest_url_for "$pkg" "$cur") || continue
+ echo ""
+ echo "Bundled-dep reconcile: $pkg (manifest @ $cur)"
+ reconcile_bundle_deps "$pkg" "$hintpath" "$murl" report || true
+ local ans
+ read -r -p "Apply bundled-dep updates for $pkg? [Y/n] " ans
+ ans="${ans:-Y}"
+ if [[ "$ans" =~ ^[Yy]$ ]]; then
+ reconcile_bundle_deps "$pkg" "$hintpath" "$murl" apply || true
+ fi
+ done
}
# Main function
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh
index 62e9f2f..9ec0037 100755
--- a/tests/mkhint_test.sh
+++ b/tests/mkhint_test.sh
@@ -1657,6 +1657,91 @@ set -e
&& { echo " PASS: --force mutually exclusive"; (( PASS++ )); } \
|| { echo " FAIL: exits $c1 $c2 $c3"; (( FAIL++ )); ERRORS+=("T-BM12"); }
+# ── T-BM13..16: --check Phase 2 bundled-dep reconcile for listed packages ────
+setup_bmnvim_check() {
+ cat > "$MOCK_BASE/bundle-manifests" << 'EOF'
+bmnvim https://example.com/bmnvim/v{VERSION}/deps.txt
+EOF
+ cat > "$MOCK_BASE/manifest_fixture" << 'EOF'
+NVIM_URL https://github.com/neovim/neovim/archive/v0.13.0.tar.gz
+NVIM_SHA256 a
+TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.26.8.tar.gz
+TREESITTER_SHA256 b
+EOF
+ cat > "$MOCK_HINT/bmnvim.hint" << 'EOF'
+VERSION="0.13.0"
+DOWNLOAD="https://github.com/neovim/neovim/archive/v0.13.0/bmnvim-0.13.0.tar.gz \
+ https://github.com/tree-sitter/tree-sitter/archive/v0.26.7/tree-sitter-0.26.7.tar.gz"
+MD5SUM="aaa \
+ bbb"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+ARCH="x86_64"
+EOF
+ # Seed nvchecker the same way T23/T25/etc do: an [bmnvim] section in the
+ # toml (required by _has_nvchecker_section) and a keyfile entry reporting
+ # latest == 0.13.0, so the primary version is unchanged this run.
+ cat > "$MOCK_BASE/nvchecker.toml" << EOF
+[__config__]
+oldver = "$MOCK_BASE/old_ver.json"
+newver = "$MOCK_BASE/new_ver.json"
+
+[bmnvim]
+source = "github"
+github = "neovim/neovim"
+EOF
+ cat > "$MOCK_BASE/new_ver.json" << 'EOF'
+{ "version": 2, "data": { "bmnvim": { "version": "0.13.0" } } }
+EOF
+ cp "$MOCK_BASE/new_ver.json" "$MOCK_BASE/old_ver.json"
+}
+
+# T-BM13: primary unchanged, no --force → Phase 2 skipped (dep stays v0.26.7)
+echo ""
+echo "T-BM13: --check listed, primary current, no --force → deps untouched"
+setup_bmnvim_check
+run_mkhint -C bmnvim < <(printf '\n') >/dev/null 2>&1 || true
+grep -q 'v0.26.7' "$MOCK_HINT/bmnvim.hint" \
+ && { echo " PASS: Phase 2 skipped"; (( PASS++ )); } \
+ || { echo " FAIL: dep changed without --force"; (( FAIL++ )); ERRORS+=("T-BM13"); }
+
+# T-BM14: primary unchanged, --force → Phase 2 runs, dep bumped on Y
+echo ""
+echo "T-BM14: --check --force listed, primary current → deps reconciled"
+setup_bmnvim_check
+run_mkhint -C --force bmnvim < <(printf 'Y\n') >/dev/null 2>&1 || true
+grep -q 'tree-sitter/archive/v0.26.8' "$MOCK_HINT/bmnvim.hint" \
+ && { echo " PASS: --force ran Phase 2"; (( PASS++ )); } \
+ || { echo " FAIL: --force did not bump dep"; cat "$MOCK_HINT/bmnvim.hint"; (( FAIL++ )); ERRORS+=("T-BM14"); }
+
+# T-BM15: manifest fetch fails → deps unchanged, retry msg
+echo ""
+echo "T-BM15: --check --force, manifest fetch fails → deps unchanged"
+setup_bmnvim_check
+rm -f "$MOCK_BASE/manifest_fixture"
+out=$(run_mkhint -C --force bmnvim < <(printf 'Y\n') 2>&1) || true
+grep -q 'v0.26.7' "$MOCK_HINT/bmnvim.hint" && echo "$out" | grep -qi 'manifest unavailable' \
+ && { echo " PASS: fetch fail handled"; (( PASS++ )); } \
+ || { echo " FAIL: fetch fail. out=$out"; (( FAIL++ )); ERRORS+=("T-BM15"); }
+
+# T-BM16: manifest-only deps FYI printed
+echo ""
+echo "T-BM16: --check --force prints manifest-only-deps FYI"
+setup_bmnvim_check
+cat > "$MOCK_BASE/manifest_fixture" << 'EOF'
+NVIM_URL https://github.com/neovim/neovim/archive/v0.13.0.tar.gz
+NVIM_SHA256 a
+TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.26.7.tar.gz
+TREESITTER_SHA256 b
+WASMTIME_URL https://github.com/bytecodealliance/wasmtime/archive/v36.0.6.tar.gz
+WASMTIME_SHA256 c
+EOF
+out=$(run_mkhint -C --force bmnvim < <(printf 'n\n') 2>&1) || true
+echo "$out" | grep -q 'deps not in hint:' && echo "$out" | grep -qi 'wasmtime' \
+ && { echo " PASS: FYI list printed"; (( PASS++ )); } \
+ || { echo " FAIL: FYI. out=$out"; (( FAIL++ )); ERRORS+=("T-BM16"); }
+rm -f "$MOCK_BASE/manifest_fixture" "$MOCK_BASE/bundle-manifests" "$MOCK_HINT/bmnvim.hint"
+
# ─── SUMMARY ──────────────────────────────────────────────────────────────────
teardown