diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-08 12:11:02 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-08 12:11:02 +0200 |
| commit | 6de9cec3ff26620c6e11de0dc426310346d7786c (patch) | |
| tree | b6ce6a6bb6d351f0931b809dcc16e05ffe0a2660 /mkhint | |
| parent | 9b57db37b6dca87247e30b1e5e2259094c7157b5 (diff) | |
| download | mkhintfile-6de9cec3ff26620c6e11de0dc426310346d7786c.tar.gz mkhintfile-6de9cec3ff26620c6e11de0dc426310346d7786c.zip | |
feat: suppress continuation-URL prompt for manifest-listed pkgs; release v1.2.4v1.2.4
On a primary version bump of a manifest-listed package, mkhint used to
prompt interactively for each extra DOWNLOAD (continuation) URL, then
Phase 2 (reconcile_bundle_deps) rewrote those same lines from the
upstream manifest — a pointless double-touch (13 prompts for neovim).
update_hint_file now detects a listed package and threads a skip_cont
flag through update_checksums -> _process_download_var, which leaves the
continuation URLs for the manifest reconcile and prints a short notice
instead of prompting. Non-listed packages prompt exactly as before.
Also fixes a set -e abort: the manifest-lookup guard was written as
`pkg_has_manifest ... && _skip_cont=1`, whose false result (non-listed
package) killed the run right after the backup. Rewritten as an if. This
would have broken every non-listed --hintfile -V update. Verified live on
a non-listed multiline package (exploitdb).
Tests: T-BM18 now asserts the listed-pkg suppression, T-BM25 guards
against over-suppression (non-listed still prompts); the read -p prompt
is invisible under piped stdin, so both assert on the always-echoed
"line N (current)" header. 184 passed.
Also defers the multi-file split TODO with a rationale and revisit
triggers (extract only the bundled-dep block when the time comes).
Bump MKHINT_VERSION and man title to 1.2.4, rebuild mkhint.1.gz.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'mkhint')
| -rwxr-xr-x | mkhint | 36 |
1 files changed, 28 insertions, 8 deletions
@@ -45,7 +45,7 @@ if [[ ! -d $TMP_DIR ]]; then mkdir $TMP_DIR fi -readonly MKHINT_VERSION="1.2.3" +readonly MKHINT_VERSION="1.2.4" # Variables VERSION="" @@ -992,11 +992,17 @@ suggest_version() { } # Download files and update MD5SUM/MD5SUM_x86_64 in hint file +# update_checksums <file> [skip_continuation_prompt] +# skip_continuation_prompt=1 leaves continuation (index >= 1) URLs untouched and +# does not prompt for them — used for manifest-listed packages, whose extra +# lines Phase 2 (reconcile_bundle_deps) rewrites from the upstream manifest, so +# hand-editing them here would be a pointless double-touch. update_checksums() { local file="$1" + local skip_cont="${2:-0}" - _process_download_var "DOWNLOAD" "MD5SUM" "$file" - _process_download_var "DOWNLOAD_x86_64" "MD5SUM_x86_64" "$file" + _process_download_var "DOWNLOAD" "MD5SUM" "$file" "$skip_cont" + _process_download_var "DOWNLOAD_x86_64" "MD5SUM_x86_64" "$file" "$skip_cont" } # Process one DOWNLOAD/MD5SUM variable pair in a hint file @@ -1004,6 +1010,7 @@ _process_download_var() { local dl_var="$1" local md5_var="$2" local file="$3" + local skip_cont="${4:-0}" # Read current URLs into array mapfile -t urls < <(parse_multiline_var "$dl_var" "$file") @@ -1017,11 +1024,17 @@ _process_download_var() { # Save original URLs for change detection after prompt local orig_urls=("${urls[@]}") - # Prompt user to update continuation URLs if present + # Prompt user to update continuation URLs if present. Skipped for + # manifest-listed packages: Phase 2 (reconcile_bundle_deps) owns those lines. if (( ${#urls[@]} > 1 )); then - echo "" - echo "Multiline ${dl_var} detected in $(basename "$file")." - prompt_continuation_urls urls "$dl_var" + if [[ "$skip_cont" == 1 ]]; then + echo "" + echo "Multiline ${dl_var} in $(basename "$file"): continuation URLs left to bundled-dep reconcile." + else + echo "" + echo "Multiline ${dl_var} detected in $(basename "$file")." + prompt_continuation_urls urls "$dl_var" + fi fi # Download and calculate md5 for each URL @@ -1099,7 +1112,14 @@ update_hint_file() { sed -i "s/${old_version//_/-}/${new_version//_/-}/g" "$normalized_file" fi - update_checksums "$normalized_file" + # For manifest-listed packages, skip the continuation-URL prompt — Phase 2 + # (reconcile_bundle_deps) rewrites those lines from the upstream manifest. + load_bundle_manifests + local _pkg="${normalized_file%.hint}"; _pkg="${_pkg##*/}" + local _skip_cont=0 + if pkg_has_manifest "$_pkg"; then _skip_cont=1; fi + + update_checksums "$normalized_file" "$_skip_cont" if [[ $NO_DL -eq 1 ]]; then add_nodownload "$normalized_file" |
