diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-03 13:15:49 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-03 13:15:49 +0200 |
| commit | 21aabc67cb9e8e76c6fab6727690a3a9c02a98da (patch) | |
| tree | 8f80dd92386be5055a12b9cd68dbba5c71d1ad92 /mkhint | |
| parent | 5fdb01eaaa88146e31a611423b269678074085f3 (diff) | |
| download | mkhintfile-21aabc67cb9e8e76c6fab6727690a3a9c02a98da.tar.gz mkhintfile-21aabc67cb9e8e76c6fab6727690a3a9c02a98da.zip | |
feat: treat dashed upstream version as equivalent to packaged underscore form
SlackBuild versions cannot contain '-' (it breaks PRGNAM parsing), so an
upstream date like 2026-06-02 is packaged as 2026_06_02. mkhint was
comparing them byte-for-byte and offering a spurious upgrade/downgrade.
Add _normalize_version ('-' -> '_') and apply it to the upstream version
in --check and --hintfile (no -v) before comparing and before storing, so
equivalent versions compare equal and accepted updates are written in the
underscore form. nvtake still uses nvchecker's raw keyfile value.
Tests T48/T49 cover equivalence and normalized storage (105 passing).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'mkhint')
| -rwxr-xr-x | mkhint | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -263,6 +263,13 @@ _nvchecker_newver_path() { } # Echo the latest version nvchecker found for a package, or return non-zero +# Normalize an upstream version to our packaging convention: '-' is illegal in +# a SlackBuild version (breaks PRGNAM parsing), so we store it as '_'. Compare +# the normalized forms so e.g. upstream 2026-06-02 == packaged 2026_06_02. +_normalize_version() { + printf '%s\n' "${1//-/_}" +} + # Usage: latest=$(nvchecker_latest pkg) || handle "no version" nvchecker_latest() { local pkg="$1" @@ -544,6 +551,7 @@ suggest_version() { echo "Error: no nvchecker result for '$pkg'. Add/fix its [${pkg}] section in $NVCHECKER_CONFIG" >&2 return 1 } + latest=$(_normalize_version "$latest") # Read current version from the hint file (best effort, for display) local hintpath="${HINT_DIR%/}/${pkg}.hint" @@ -785,14 +793,15 @@ check_updates() { fi continue fi - [[ "$current" == "$latest" ]] && continue # up to date - # determine direction with sort -V - local newest; newest=$(printf '%s\n%s\n' "$current" "$latest" | sort -V | tail -1) + local latest_norm; latest_norm=$(_normalize_version "$latest") + [[ "$current" == "$latest_norm" ]] && continue # up to date + # determine direction with sort -V (compare normalized forms) + local newest; newest=$(printf '%s\n%s\n' "$current" "$latest_norm" | sort -V | tail -1) local flag="update" [[ "$newest" == "$current" ]] && flag="?downgrade" outdated_pkgs+=("$pkg") outdated_old+=("$current") - outdated_new+=("$latest") + outdated_new+=("$latest_norm") outdated_flag+=("$flag") done |
