Comment 3 for bug 674372

Revision history for this message
Philip Munksgaard (pmunksgaard) wrote :

The attached patch adds SB-EXT:VERSION-ASSERT.

It takes a version number as a string, and asserts that (lisp-implementation-version) is equal to or greater than the given version.

I've chosen to only parse leading numerical components in the version strings and ignore anything after the numerical components stop. Trying to make sense of whether a bunch of letters are some kind of versioning scheme (1.1.12a vs. 1.1.12b), a designator for release candidates (1.1.12rc1), a specific git commit or branch (1.1.12.14-b2ed34b-dirty), distribution-specific (1.1.12-debian) is futile.

Thus, as soon as version-assert encounters a non-digit character that isn't a period in either the version-string or (lisp-implementation-version), it stops parsing any more. Beyond that it pretty much works as expected:

If the current version is 1.1.12, (version-assert "1.1.12") passes.
If the current version is 1.1.12, (version-assert "1.1.12.1") does not pass.
If the current version is 1.1.1, (version-assert "1.0") passes.