jw-pkg/src/python/jw/pkg/lib
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jan Lindemann 40a12571e2
lib.version: Add module to parse dependency specs
pkg_relations() parses dependency specifications such as 'foo-devel >=
1.2.3-4' with inline regular expressions and mixes the parsing with version
macro expansion and rendering in three different syntaxes.

This commit adds the lib.version module that owns the parsing of a single
specification: the base and full name and the version boundary with its
operator. Rendering happens in constraint_str() in SEM_VER, DEBIAN or
NAMES_ONLY syntax, with untemplated, include_revision, as_range,
no_subpackages and quote options. The VERSION, VERSION-REVISION and
REVISION macros are resolved through a version lookup callback,
lib.version.Version.parse_deps_spec() splits comma-separated specification
strings into Version objects, and Version breaks a version down into its
major, minor, micro and revision parts.

Unit tests cover parsing, macro resolution, rendering in all syntaxes and
the range expansion.

The module is designed to be integrated into the status quo and
intentionally does not address a couple of further TODOs. Notably
version.Syntax.SEM_VER is intended to replace
pkg_relations.VersionSyntax.SemVer, but neither are really semantic
versioning according to spec. They are close but more targeted toward RPM
and Debian package versioning. And the naming and semantics differ from
SemVer.

Naming of the four components (major and minor version) is identical,
semantic meaning aside, there's no disagreement between real SemVer,
Debian, RPM and jw-pkg. The third and fourth component deviate:

    SemVer      Debian      RPM        jw-pkg      lib.version
 3  PATCH                              RELEASE     MICRO
 4  PRERELEASE  Revision    Release    REVISION    REVISION

TODOs: RELEASE over the rest of jw-pkg needs to be adjusted by a later
commit. Syntax.SEM_VER should also be renamed, to Syntax.JW_PKG maybe,
because, as said, it's not SemVer and will probably never be - SemVer
doesn't provide the compatibility guarantees that the jw-pkg versioning
scheme offers. To be documented.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-09 15:22:19 +02:00
..
distros lib.distros.redhat.Distro: Add missing file 2026-08-15 20:08:32 +02:00
ec lib.ec.ssh.AsyncSSH: Actually hide password 2026-09-05 20:53:33 +02:00
pm py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00
version lib.version: Add module to parse dependency specs 2026-09-09 15:22:19 +02:00
App.py lib.App: Find invoked path by walking argv 2026-08-18 01:14:40 +02:00
AsyncRunner.py lib.AsyncRunner: Fix asyncio.Event() for Python 3.12+ 2026-08-15 19:51:36 +02:00
base.py lib.Result: Add module 2026-06-02 17:52:49 +02:00
Cmd.py lib.Cmd: Build the command tree lazily 2026-08-18 01:14:40 +02:00
CopyContext.py App, cmds, lib: Fix Any returns from typed functions 2026-08-09 12:07:37 +00:00
Distro.py py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00
ExecApp.py lib.ExecApp: Add class 2026-08-22 17:31:57 +02:00
ExecContext.py lib.ExecContext: Fix error message in _put() 2026-09-05 19:36:46 +02:00
FileContext.py lib.FileContext: Interpolate path in _is_dir() 2026-09-05 19:36:46 +02:00
init.py init.detect_modules(): Add base_types filter 2026-08-24 14:23:27 +02:00
log.py py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00
Makefile jw.pkg.build.lib: Move to jw.pkg.lib 2026-01-26 17:58:23 +01:00
Package.py py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00
PackageFilter.py py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00
ProcFilter.py App, lib, cmds: Fix mypy.explicit-override fallout 2026-08-07 18:02:26 +02:00
ProcFilterGpg.py App, lib, cmds: Fix mypy.explicit-override fallout 2026-08-07 18:02:26 +02:00
ProjectConf.py lib.ProjectConf: Add module 2026-06-30 12:46:36 +02:00
Result.py App, cmds, lib: Fix Any returns from typed functions 2026-08-09 12:07:37 +00:00
TarIo.py py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00
Types.py lib.Types: Restrict LoadTypes to ABC-derived classes 2026-09-07 09:12:42 +02:00
Uri.py lib.Uri: Fix path join for empty authority 2026-09-05 14:01:46 +02:00
util.py py-check.mk: Run isort with "make format" 2026-08-11 16:45:14 +02:00