aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-25 11:56:29 +0200
committerDanilo M. <danix@danix.xyz>2026-09-25 11:56:29 +0200
commitbb24e7ab9ef4a1a97e00575f8c13497ec6a3e32d (patch)
tree6c41d26ba71348645ab59673594668996c2ac0fd
parente1476496aec827af919a33e2b59d3be48c565770 (diff)
downloadmkhintfile-master.tar.gz
mkhintfile-master.zip
fix: bump dotless build number in download URLsHEADmaster
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 <noreply@anthropic.com>
-rw-r--r--CHANGELOG.md5
-rw-r--r--CLAUDE.md3
-rwxr-xr-xmkhint13
-rwxr-xr-xtests/mkhint_test.sh16
4 files changed, 36 insertions, 1 deletions
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/*/<pkg>/<pkg>-*.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/*/<pkg>/<pkg>-*.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"]*?)(?<!\d)\Q$ENV{O}\E(?!\d)}{$1$ENV{N}}g' "$file"
+}
+
update_hint_file() {
cd "$HINT_DIR"
local file="$1"
@@ -1730,6 +1742,7 @@ update_hint_file() {
if [[ "$old_version" == *_* || "$new_version" == *_* ]]; then
sed -i "s/${old_version//_/-}/${new_version//_/-}/g" "$normalized_file"
fi
+ _swap_dotless_url_version "$old_version" "$new_version" "$normalized_file"
# For manifest-listed packages, skip the continuation-URL prompt — Phase 2
# (reconcile_bundle_deps) rewrites those lines from the upstream manifest.
diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh
index 2e885dd..36b0676 100755
--- a/tests/mkhint_test.sh
+++ b/tests/mkhint_test.sh
@@ -542,6 +542,22 @@ assert_contains "URL updated" "$MOCK_HINT/curl.hint" 'curl-8.
assert_not_contains "MD5SUM updated" "$MOCK_HINT/curl.hint" 'abc123def456'
assert_file_exists "backup created" "$MOCK_HINT/curl.hint.bak"
+# ── T93: dotless build number in URL (sublime_text 4.2.00 ↔ build 4200) ───────
+echo ""
+echo "T93: --hintfile -V 4.2.15 → URL build_4200 bumped to build_4215"
+cat > "$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"