lib.version: Fix version range expansion #109
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/fix/20260915-lib-version-fix-version-range-expansion"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Debian packages that should satisfy a jw-pkg dependency specification
"= 1.2.3"need that pin expanded to ">= 1.2.3, < 1.2.4", which doesn't work. The resulting pin remains= 1.2.3, which Debian requires as an exact match on installation, and which is unsatisfiable. The pin expansion machinery in lib.version is broken in several places, and this commit addresses that.lib.version.Version.__resolved_id(): Resolve VERSION to core
__resolved_id()returns the full version if onlyVERSIONwas specified, fix that.Also: raise
Version.Errorinstead of a bare Exception.Tests written by AI.
lib.version.Dependency.__version_boundaries(): Expand non-full specs
Full version dependency specs (
= 1.2.3-4or= VERSION-REVISION) don't need expansion, they pin the wanted version with an=fine exactly.__version_boundary has that the wrong way around, fix that.
Also fix the
is_fullandversion_boundaries()docstrings, which still describe the old behavior.Tests written by AI.
lib.version.Dependency.constraint_str(): Delimit by comma
A multi-boundary constraint is rendered as
foo >= 1.2.3-45 foo < 1.2.4, which is invalid: the RPM spec template writes the Requires: line from it verbatim, and RPM entries are comma-separated, so the second clause is swallowed into one bad entry. Debian'sformat_depends()normalizes runs of whitespace to commas, so it tolerates the space join, but the comma is the only delimiter that is correct for both.Join the boundary clauses with
,instead of a space.Also:
version_boundaries()call.Tests written by AI.
lib.version.Version.next(): Step the last part
Range expansion needs a bound that steps the last existing part of a version, add that.
next()increments the last part, whatever it is: next of1is2, of1.0is1.1, of1.2.3is1.2.4, of1.2.3-45is1.2.3-46.Tests written by AI.
lib.version.Dependency.__version_boundaries(): Use Version.next()
Use
Version.next()in__version_boundaries(), which steps the last existing part, so= 1.0spans>= 1.0, < 1.1.Tests written by AI.
Full version dependency specs ("= 1.2.3-4" or "= VERSION-REVISION") don't need expansion, they pin the wanted version with an = fine exactly. __version_boundary has that the wrong way around, fix that. Also fix the is_full and version_boundaries() docstrings, which still describe the old behavior. Tests written by AI. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1 Signed-off-by: Jan Lindemann <jan@janware.com>