diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-07 18:20:12 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-07 18:20:12 +0200 |
| commit | 6b7ca94be115b7678074b3880b8f127d17c5267e (patch) | |
| tree | 89ee686195dfeaea421c4f2aa32c6ba1734f7642 | |
| parent | 752269df5515a137a50d05b8df2d11fb287004bd (diff) | |
| download | mkhintfile-6b7ca94be115b7678074b3880b8f127d17c5267e.tar.gz mkhintfile-6b7ca94be115b7678074b3880b8f127d17c5267e.zip | |
feat: parse_manifest reads NAME_URL entries from a deps manifest
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rwxr-xr-x | mkhint | 13 | ||||
| -rwxr-xr-x | tests/mkhint_test.sh | 16 |
2 files changed, 29 insertions, 0 deletions
@@ -425,6 +425,19 @@ fix_current() { echo "Done. $count package(s) with phantom deps." } +# ── bundled-dep manifest handling ───────────────────────────────────────────── +# Reconcile a bundle package's extra DOWNLOAD lines against an upstream deps +# manifest (opt-in via BUNDLE_MANIFEST_FILE). See docs spec 2026-07-07. + +# parse_manifest <file> — print one download URL per line for each NAME_URL +# entry. SHA256 lines ignored (hints use MD5SUM; we re-download and md5). +parse_manifest() { + local file="$1" + [[ -f "$file" ]] || return 0 + awk '/_URL[[:space:]]/ { print $2 }' "$file" +} +# ── end bundled-dep manifest handling ───────────────────────────────────────── + # Create new hint file create_new_hint_file() { cd "$HINT_DIR" diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index 837289a..9830f3b 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -1457,6 +1457,22 @@ assert_contains "URL dashed date bumped" "$MOCK_HINT/datedpkg.hint" 'd assert_not_contains "no stale dashed date" "$MOCK_HINT/datedpkg.hint" '2026-04-30' assert_not_contains "MD5SUM recalculated" "$MOCK_HINT/datedpkg.hint" 'abc123def456' +# ── T-BM1: parse_manifest extracts URLs from NAME_URL/NAME_SHA256 pairs ────── +echo "" +echo "T-BM1: parse_manifest extracts URLs, ignores SHA256 lines" +cat > "$MOCK_BASE/deps.txt" << 'EOF' +LIBUV_URL https://github.com/libuv/libuv/archive/v1.52.1.tar.gz +LIBUV_SHA256 478baf2599bfbc +TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.26.7.tar.gz +TREESITTER_SHA256 4343107ad1097 +EOF +bm_out=$(bash -c 'source <(sed -n "/# ── bundled-dep manifest handling/,/# ── end bundled-dep/p" '"$SCRIPT"'); parse_manifest '"$MOCK_BASE"'/deps.txt') +echo "$bm_out" | grep -qx 'https://github.com/libuv/libuv/archive/v1.52.1.tar.gz' \ + && echo "$bm_out" | grep -qx 'https://github.com/tree-sitter/tree-sitter/archive/v0.26.7.tar.gz' \ + && ! echo "$bm_out" | grep -q '478baf' \ + && { echo " PASS: parse_manifest URLs only"; (( PASS++ )); } \ + || { echo " FAIL: parse_manifest: $bm_out"; (( FAIL++ )); ERRORS+=("T-BM1"); } + # ─── SUMMARY ────────────────────────────────────────────────────────────────── teardown |
