From bb24e7ab9ef4a1a97e00575f8c13497ec6a3e32d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 25 Sep 2026 11:56:29 +0200 Subject: fix: bump dotless build number in download URLs Some upstreams name tarballs by a dotless build number while the SlackBuild VERSION is dotted (sublime_text: VERSION 4.2.00, URL build_4200), so the version swap missed the URL and the md5 was recomputed for the old tarball. Also swap the dotless form, only inside URLs and only as a whole number, leaving md5 hex alone. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 +++++ CLAUDE.md | 3 ++- mkhint | 13 +++++++++++++ tests/mkhint_test.sh | 16 ++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f7f803..2ca29d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ All notable changes to this project are documented here. The format is based on ## [Unreleased] +### Fixed +- Version bumps now also rewrite the dotless form of a dotted version inside + download URLs (sublime_text: VERSION `4.2.00`, URL `build_4200`), so the + URL follows the bump and the md5 is computed for the new tarball. + ### Added - `--strip-version`/`-S`: remove the version pin *and* the version-dependent download/checksum variables (`VERSION`, `DOWNLOAD`, `MD5SUM`, and their diff --git a/CLAUDE.md b/CLAUDE.md index 3746996..d96c56a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -159,12 +159,13 @@ Test coverage: | T90 | `--versions` multiple packages — both shown; no args exit 1 | | T91 | `--versions` with nvchecker section — Upstream shown, green when newest | | T92 | `--versions` no nvchecker section — note printed, exit 0 | +| T93 | `-f -V 4.2.15` on hint `4.2.00` with URL `build_4200` — URL bumped to `build_4215`, md5 untouched by the swap | When adding new features, add a corresponding test case to `tests/mkhint_test.sh`. ## Key Behaviors -- `--hintfile` update: backs up to `.bak`, replaces old version string globally via `sed`, re-downloads both URLs to recalculate MD5 checksums. Skips download if value is `UNSUPPORTED` or `UNTESTED`. After a successful update it dispatches slackrepo for the single package via `prompt_slackrepo`, which uses `pkg_in_repo` (glob `PACKAGES_DIR/*//-*.txz`) to choose `slackrepo update` for a built package or `slackrepo build` for an absent one, both run through `run_slackrepo`. +- `--hintfile` update: backs up to `.bak`, replaces old version string globally via `sed` (plus the `_`→`-` form, and via `_swap_dotless_url_version` the dotless form inside URLs only, as a whole number: `4.2.00`→`4200` for sublime_text-style build-number tarballs), re-downloads both URLs to recalculate MD5 checksums. Skips download if value is `UNSUPPORTED` or `UNTESTED`. After a successful update it dispatches slackrepo for the single package via `prompt_slackrepo`, which uses `pkg_in_repo` (glob `PACKAGES_DIR/*//-*.txz`) to choose `slackrepo update` for a built package or `slackrepo build` for an absent one, both run through `run_slackrepo`. - `--new` with existing `.info`: copies `.info` as template, strips `PRGNAM`, `HOMEPAGE`, `MAINTAINER`, `EMAIL`, comments out `REQUIRES`, sets `ARCH="x86_64"`. Keeps `VERSION` from `.info`. If `-V` given, updates version string and recalculates checksums. Also appends an nvchecker `[section]` to the config via `add_nvchecker_section`. - `add_nvchecker_section` autodetection: `_detect_nvchecker_source` recognizes github, gitlab, bitbucket, gitea, codeberg, and pagure owner/repo URLs plus the pypi, npm, gems, crates.io (`cratesio`), cpan, hackage, packagist, and cran registries, else leaves a commented stub. Github gets `use_latest_release = true` with commented `use_max_tag`/`prefix = "v"` fallbacks; the other forges get `use_max_tag = true` plus a commented `# prefix = "v"`; registries use the package name parsed from the URL via `_registry_name_from_url`, falling back to `PRGNAM` when no host-specific pattern matches. Either way, the managed stanza (freshly added or already present) is echoed fenced on stdout via `_extract_nvchecker_section`. - `--new` when hint already exists: backs up old, creates empty skeleton. diff --git a/mkhint b/mkhint index 038d4a6..008eeaf 100755 --- a/mkhint +++ b/mkhint @@ -1050,6 +1050,7 @@ create_new_hint_file() { if [[ "$old_version" == *_* || "$VERSION" == *_* ]]; then sed -i "s/${old_version//_/-}/${VERSION//_/-}/g" "$normalized_file" fi + _swap_dotless_url_version "$old_version" "$VERSION" "$normalized_file" update_checksums "$normalized_file" fi @@ -1696,6 +1697,17 @@ _process_download_var() { } # Update existing hint file +# Some upstreams name tarballs by a dotless build number while the SlackBuild +# VERSION is dotted (sublime_text: VERSION 4.2.00, URL build_4200), so the +# plain swap misses the URL and the md5 is recomputed for the old tarball. +# Also bump the dotless form, only inside URLs and only as a whole number, +# so md5 hex and unrelated digits are left alone. +_swap_dotless_url_version() { + local old="${1//./}" new="${2//./}" file="$3" + [[ "$1" == *.* && "$old" != "$new" ]] || return 0 + O="$old" N="$new" perl -pi -e 's{(://[^\s"]*?)(? "$MOCK_HINT/curl.hint" << 'EOF' +VERSION="4.2.00" +DOWNLOAD="UNSUPPORTED" +MD5SUM="" +DOWNLOAD_x86_64="https://download.example.org/app_build_4200_x64.tar.xz" +MD5SUM_x86_64="4200aaaabbbbccccddddeeeeffff0000" +EOF +run_mkhint -f curl -V 4.2.15 +assert_contains "VERSION updated" "$MOCK_HINT/curl.hint" 'VERSION="4.2.15"' +assert_contains "URL build bumped" "$MOCK_HINT/curl.hint" 'app_build_4215_x64' +assert_not_contains "old md5 gone" "$MOCK_HINT/curl.hint" '4200aaaa' +assert_not_contains "md5 not dotless-swapped" "$MOCK_HINT/curl.hint" '4215aaaa' + # ── T7: --hintfile -v -N → version + md5 updated + NODOWNLOAD ───────────────── echo "" echo "T7: --hintfile -v -N → version + md5 + NODOWNLOAD=yes" -- cgit v1.2.3