From 21aabc67cb9e8e76c6fab6727690a3a9c02a98da Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 3 Jul 2026 13:15:49 +0200 Subject: 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 --- mkhint | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'mkhint') diff --git a/mkhint b/mkhint index 6a2c71c..b18cbc3 100755 --- a/mkhint +++ b/mkhint @@ -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 -- cgit v1.2.3