diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-08 11:45:00 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-08 11:45:00 +0200 |
| commit | 67d4196bb3c98b0f6c00e8e514d9060b1cf7be2f (patch) | |
| tree | 7fa81814653a6e613590262f2683b913acccf983 /mkhint | |
| parent | efeeeb045ee8f7d92bc718c40661df0f5fb070c7 (diff) | |
| download | mkhintfile-67d4196bb3c98b0f6c00e8e514d9060b1cf7be2f.tar.gz mkhintfile-67d4196bb3c98b0f6c00e8e514d9060b1cf7be2f.zip | |
fix: complete version-aware reconcile against real URL shapes; release v1.2.2v1.2.2
1.2.1 made the bundled-dep reconcile version-aware but _url_version
mis-parsed several real-world URL shapes, so 1.2.1 was never correct in
the field (found by running mkhint -C --force neovim against the live
0.12.4 hint).
_url_version now derives the version by stripping the URL's own github
repo name from the basename:
- dep names containing digits/dashes (lua-compat-5.3) parse correctly
instead of splitting the name as a version
- a bare-tag basename with no name prefix is taken as the whole version,
fixing package-rev suffixes (luv 1.52.1-0 was truncated to 0)
- non-github and the shared neovim/deps blob host fall back to the
trailing-version/sha heuristic
_url_repo is lowercased so JuliaStrings/utf8proc matches
juliastrings/utf8proc (github repos are case-insensitive); utf8proc had
reported no-match and appeared in the manifest-only FYI.
Verified against all 13 live neovim 0.12.4 bundled deps: all match and
report current, no false change, a real bump still detected. Adds
T-BM22 (one case per URL-shape class) and T-BM23 (case-insensitive
repo match); T-BM17 unchanged. 182 passed.
Bump MKHINT_VERSION and man title to 1.2.2, rebuild mkhint.1.gz.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'mkhint')
| -rwxr-xr-x | mkhint | 52 |
1 files changed, 37 insertions, 15 deletions
@@ -45,7 +45,7 @@ if [[ ! -d $TMP_DIR ]]; then mkdir $TMP_DIR fi -readonly MKHINT_VERSION="1.2.1" +readonly MKHINT_VERSION="1.2.2" # Variables VERSION="" @@ -458,31 +458,53 @@ _url_stem() { } # _url_version <url> — extract the version token from a download URL's basename. -# Same archive stripping as _url_stem, then take the trailing version: a -# leading-v-or-digit tail after a "-" separator, else the whole basename if it -# is itself a version (e.g. "v0.26.7"). Used to detect real version drift -# independent of URL path shape. Empty if no version found. +# Dep names can themselves contain digits/dashes (lua-compat-5.3, win32yank-x64), +# so no fixed regex can split name from version. When the URL is a github one we +# know the repo name: strip a leading "<repo>-"/"<repo>_" prefix (case-insensitive, +# since github is case-insensitive: LuaJIT vs luajit) and the rest is the version. +# Otherwise fall back to a trailing-version / trailing-sha heuristic, then drop a +# leading "v". Both sides of a matched pair reduce to "the part that isn't the +# name", so equal versions in different URL shapes compare equal. +# ponytail: name comes from the github repo. A non-github host whose basename is +# "<digit-containing-name>-<version>" can't derive the name and may misparse; add +# a manifest name hint if such a dep ever appears. _url_version() { - local base="${1##*/}" + local url="$1" + local base="${url##*/}" base="${base%.tar.gz}"; base="${base%.tar.xz}"; base="${base%.tar.bz2}" base="${base%.zip}"; base="${base%.tgz}" - local ver="" - if [[ "$base" =~ -([vV]?[0-9][^/]*)$ ]]; then - ver="${BASH_REMATCH[1]}" + local ver="$base" + local rslug; rslug=$(_url_repo "$url") + local repo="${rslug#*/}" # bare repo name, lowercased + # A shared blob repo (neovim/deps/raw/.../opt/<name>-<ver>) names the host, + # not the dep, so its repo name is useless — fall through to the heuristic, + # same exclusion match_dep_url makes. + [[ "$rslug" == */deps ]] && repo="" + local base_lc="${base,,}" + if [[ -n "$repo" ]]; then + # github: name is known. Strip a "<repo>[-_]" prefix if present; else the + # whole basename is the version (bare-tag shape, e.g. "1.52.1-0", "v0.13"). + if [[ "$base_lc" == "$repo-"* || "$base_lc" == "${repo}_"* ]]; then + ver="${base:${#repo}+1}" + else + ver="$base" + fi + elif [[ "$base" =~ -([vV]?[0-9][^/]*)$ ]]; then + ver="${BASH_REMATCH[1]}" # non-github: trailing version elif [[ "$base" =~ -([0-9a-f]{7,})$ ]]; then - ver="${BASH_REMATCH[1]}" - elif [[ "$base" =~ ^([vV]?[0-9][^/]*)$ ]]; then - ver="${BASH_REMATCH[1]}" - elif [[ "$base" =~ ^([0-9a-f]{7,})$ ]]; then - ver="${BASH_REMATCH[1]}" + ver="${BASH_REMATCH[1]}" # non-github: trailing sha fi ver="${ver#[vV]}" printf '%s\n' "$(_normalize_version "$ver")" } # _url_repo <url> — echo owner/repo for a github URL, empty otherwise. +# Lowercased: github owners/repos are case-insensitive, and the same dep can +# appear as JuliaStrings/utf8proc in one URL and juliastrings/utf8proc in another. _url_repo() { - [[ "$1" =~ github\.com/([^/]+)/([^/]+) ]] && printf '%s/%s\n' "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]%.git}" + [[ "$1" =~ github\.com/([^/]+)/([^/]+) ]] || return 0 + local r; printf -v r '%s/%s' "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]%.git}" + printf '%s\n' "${r,,}" } # match_dep_url <hint_url> <manifest_url_list> — echo the manifest URL that |
