summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-09 20:25:24 +0200
committerDanilo M. <danix@danix.xyz>2026-07-09 20:25:24 +0200
commit2b421d007e58830036c939494f421fc5c0376aa4 (patch)
treec64a922fb70b30fda6136a4067f0cd25b14d9b18
parenta89e6799a4473ff2d182e1d3268222a9f54cea58 (diff)
downloadmkhintfile-2b421d007e58830036c939494f421fc5c0376aa4.tar.gz
mkhintfile-2b421d007e58830036c939494f421fc5c0376aa4.zip
feat: wire sha reconcile + inventory into --check/--force
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-xmkhint22
-rwxr-xr-xtests/mkhint_test.sh39
2 files changed, 58 insertions, 3 deletions
diff --git a/mkhint b/mkhint
index 7921501..52d3804 100755
--- a/mkhint
+++ b/mkhint
@@ -969,7 +969,10 @@ create_new_hint_file() {
_bm_pkg="${_bm_pkg##*/}"
if pkg_has_manifest "$_bm_pkg"; then
local _bm_ver; _bm_ver=$(grep '^VERSION=' "$normalized_file" | sed 's/VERSION="//;s/"$//')
- local _bm_url; _bm_url=$(manifest_url_for "$_bm_pkg" "$_bm_ver")
+ local _bm_url=""
+ if [[ "$(bundle_mode "$_bm_pkg")" == "url" ]]; then
+ _bm_url=$(manifest_url_for "$_bm_pkg" "$_bm_ver") || _bm_url=""
+ fi
echo ""
echo "$_bm_pkg: bundled-dep manifest check"
reconcile_bundle_deps "$_bm_pkg" "$normalized_file" "$_bm_url" report || true
@@ -1618,6 +1621,7 @@ clean_bak_files() {
# Usage: check_updates [pkg...] (no args = all *.hint in HINT_DIR)
check_updates() {
check_nvchecker
+ local -A prev_version=() # pkg -> version before this run's bump (Job B)
if [[ ! -d "$HINT_DIR" ]]; then
echo "Error: Hint directory does not exist: $HINT_DIR" >&2
@@ -1673,6 +1677,7 @@ check_updates() {
outdated_old+=("$current")
outdated_new+=("$latest_norm")
outdated_flag+=("$flag")
+ prev_version["$pkg"]="$current" # pre-bump version for Job B
done
# Offer to populate nvchecker.toml for packages with no section
@@ -1752,7 +1757,10 @@ check_updates() {
continue
fi
local cur; cur=$(grep '^VERSION=' "$hintpath" | sed 's/VERSION="//;s/"$//')
- local murl; murl=$(manifest_url_for "$pkg" "$cur") || continue
+ local murl=""
+ if [[ "$(bundle_mode "$pkg")" == "url" ]]; then
+ murl=$(manifest_url_for "$pkg" "$cur") || continue
+ fi
echo ""
echo "Bundled-dep reconcile: $pkg (manifest @ $cur)"
local rc=0
@@ -1767,6 +1775,11 @@ check_updates() {
reconcile_bundle_deps "$pkg" "$hintpath" "$murl" apply || true
fi
fi
+ # Job B: submodule inventory / set-drift roster (sha-mode only).
+ if [[ "$(bundle_mode "$pkg")" == "sha" ]]; then
+ local _old_ver="${prev_version[$pkg]:-$cur}" _new_ver="$cur"
+ detect_set_drift "$pkg" "$_old_ver" "$_new_ver" || true
+ fi
done
}
@@ -1961,7 +1974,10 @@ main() {
if pkg_has_manifest "$_bm_pkg"; then
local _bm_hint="${HINT_DIR%/}/${_bm_pkg}.hint"
local _bm_cur; _bm_cur=$(grep '^VERSION=' "$_bm_hint" | sed 's/VERSION="//;s/"$//')
- local _bm_url; _bm_url=$(manifest_url_for "$_bm_pkg" "$_bm_cur")
+ local _bm_url=""
+ if [[ "$(bundle_mode "$_bm_pkg")" == "url" ]]; then
+ _bm_url=$(manifest_url_for "$_bm_pkg" "$_bm_cur") || _bm_url=""
+ fi
echo ""
echo "Bundled-dep reconcile: $_bm_pkg (manifest @ $_bm_cur)"
local _bm_rc=0
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh
index 4dc2e8c..90f6705 100755
--- a/tests/mkhint_test.sh
+++ b/tests/mkhint_test.sh
@@ -2471,6 +2471,45 @@ assert_contains "roster on force" <(echo "$out") "submodule inventory 2024.5.0
assert_not_contains "no + glyph" <(echo "$out") "+ src/plugins/foo"
rm -f "$MOCK_BASE/gitmodules_2024.4.1" "$MOCK_BASE/gitmodules_2024.5.0"
+# ── T-SHA-CHECK: --check --force openvino runs Job A reconcile + Job B roster ───
+# End-to-end wiring test: with openvino sha-mode listed, current (no bump), and
+# --force set, the --check reconcile loop must reach BOTH the sha reconcile
+# (Job A) and the submodule inventory (Job B). Pre-Task-6 the sha package was
+# skipped because manifest_url_for returns non-zero for sha mode.
+echo ""
+echo "T-SHA-CHECK: --check --force openvino runs Job A reconcile + Job B roster"
+emit_openvino_fixtures # openvino.hint, bundle-manifests (sha), api_mlas/onnx
+# nvchecker "sees" openvino as current (2024.4.1) so no bump; --force drives the
+# reconcile loop anyway.
+cat > "$MOCK_BASE/new_ver.json" << 'EOF'
+{ "version": 2, "data": { "openvino": { "version": "2024.4.1" } } }
+EOF
+cp "$MOCK_BASE/new_ver.json" "$MOCK_BASE/old_ver.json"
+# openvino .info in the mock repo (so --check can look it up if needed)
+mkdir -p "$MOCK_REPO/development/openvino"
+cat > "$MOCK_REPO/development/openvino/openvino.info" << 'EOF'
+PRGNAM="openvino"
+VERSION="2024.4.1"
+EOF
+# nvchecker section so the scan recognizes openvino (avoids missing-section path)
+printf '\n[openvino]\nsource = "github"\ngithub = "openvinotoolkit/openvino"\n' >> "$MOCK_BASE/nvchecker.toml"
+# .gitmodules at the current ref for Job B (old==new==2024.4.1)
+cat > "$MOCK_BASE/gitmodules_2024.4.1" << 'EOF'
+[submodule "onnx"]
+ path = thirdparty/onnx/onnx
+ url = https://github.com/onnx/onnx.git
+[submodule "mlas"]
+ path = src/plugins/intel_cpu/thirdparty/mlas
+ url = https://github.com/openvinotoolkit/mlas.git
+EOF
+echo "y" | run_mkhint -C --force openvino > "$MOCK_BASE/chk.out" 2>&1 || true
+assert_contains "Job A ran (sha reconcile)" "$MOCK_BASE/chk.out" "bundled deps (sha)"
+assert_contains "Job B ran (submodule inventory)" "$MOCK_BASE/chk.out" "submodule inventory"
+rm -f "$MOCK_HINT/openvino.hint" "$MOCK_HINT/openvino.hint.bak" \
+ "$MOCK_BASE/bundle-manifests" "$MOCK_BASE/gitmodules_2024.4.1" \
+ "$MOCK_BASE/api_mlas.json" "$MOCK_BASE/api_onnx.json"
+rm -rf "$MOCK_REPO/development/openvino"
+
# ─── SUMMARY ──────────────────────────────────────────────────────────────────
teardown