aboutsummaryrefslogtreecommitdiffstats
path: root/mkhint
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-07 20:21:27 +0200
committerDanilo M. <danix@danix.xyz>2026-07-07 20:24:29 +0200
commit870b97b0ace6792b18a710e85f78bf7731efa326 (patch)
tree230fdd25f89b820efbe9090744c813b94f2f0387 /mkhint
parentd792150c601c2f516ed9360d9ce6aad0bf6257f5 (diff)
downloadmkhintfile-870b97b0ace6792b18a710e85f78bf7731efa326.tar.gz
mkhintfile-870b97b0ace6792b18a710e85f78bf7731efa326.zip
fix: reconcile backup, versioned change report, no double reportv1.2.0
Review findings before v1.2.0 deploy: - apply mode now writes a .bak before mutating (parity with every other mutator; the --force recovery path had no rollback) - the changed-deps report shows old->new basenames so bumps are visible, not the version-stripped 'dep -> dep' - apply mode no longer re-prints the report (report/apply split) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'mkhint')
-rwxr-xr-xmkhint23
1 files changed, 14 insertions, 9 deletions
diff --git a/mkhint b/mkhint
index 1e171d9..e606f86 100755
--- a/mkhint
+++ b/mkhint
@@ -598,25 +598,30 @@ reconcile_bundle_deps() {
for m in "${manifest_urls[@]}"; do
[[ -z "${matched_manifest[$m]:-}" ]] && extra+=("$(_dep_label "$m")")
done
- if [[ ${#extra[@]} -gt 0 ]]; then
+ if [[ ${#extra[@]} -gt 0 && "$mode" == report ]]; then
echo "$pkg: manifest has ${#extra[@]} deps not in hint:"
printf '%s\n' "${extra[@]}"
fi
if [[ ${#changed_idx[@]} -eq 0 ]]; then
- echo " $pkg: bundled deps all current"
+ [[ "$mode" == report ]] && echo " $pkg: bundled deps all current"
return 0
fi
- echo ""
- echo "$pkg bundled deps changed upstream:"
- for (( i=0; i<${#changed_idx[@]}; i++ )); do
- printf ' %s -> %s\n' "$(_dep_label "${changed_from[$i]}")" "$(_dep_label "${changed_to[$i]}")"
- done
-
- [[ "$mode" == report ]] && return 0
+ if [[ "$mode" == report ]]; then
+ echo ""
+ echo "$pkg bundled deps changed upstream:"
+ for (( i=0; i<${#changed_idx[@]}; i++ )); do
+ printf ' %s -> %s\n' "${changed_from[$i]##*/}" "${changed_to[$i]##*/}"
+ done
+ return 0
+ fi
# apply mode: recompute md5 only for changed lines, rewrite DOWNLOAD+MD5SUM.
+ # Back up first (mkhint convention) — only reached when there is something
+ # to write, since the no-change case already returned above.
+ cp "$hint" "${hint}.bak"
+
local -a new_md5s=("${md5s[@]}")
local idx md5
for idx in "${changed_idx[@]}"; do