You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
yafox 6474b0ba3a
initial commit
3 years ago
.gitignore initial commit 3 years ago
LICENSE initial commit 3 years ago
README initial commit 3 years ago
makefile initial commit 3 years ago
sloc.sh initial commit 3 years ago
vercmp.sh initial commit 3 years ago

README

vercmp

======

51 SLOC, not counting format scripts.

vercmp evaluates a version comparison expression and prints "yes" if the
expression evaluates to true and "no" otherwise.

vercmp can be extended with additional formats by adding a shell script defining
a `comparever` function to the `format` subdirectory. no `format` subdirectory
is included by default. to make bootstrapping easier, instructions for pulling
some are included in the makefile. if bootstrapping lix os, for example, the
following will `git clone` lix os' vercmp formats into the format directory:

make lix-os-formats

or, if wanting a basis for creating one's own formats using the same foundatiion
as lix os' formats:

make bare-formats

to install, just `make install`.

usage:

vercmp <comparison string> [format]
vercmp formats

comparison string:
"<version 1> <op> <version 2>"

op:
== equal
>= greater than or equal
<= less than or equal
> greater than
< less than

format:
the name of the format to use for parsing and comparing the versions.
see 'vercmp formats' for a list of formats.
(format scripts are kept in $VERCMPROOT/format)

## examples

$ vercmp "1.2.3 >= 3.2.1"
no

$ vercmp "1.2 == 1.2"
yes

$ vercmp "1.2+meta1 == 1.2+meta2"
yes

$ vercmp "1.2+meta1 > 1.2-rc1+meta2"
yes

$ vercmp "1.2-rc1 < 1.2-rc2"
yes

## caveat

vercmp format scripts assume both versions are in the same format. if this is
not the case, undefined behavior may ensue. even a simple variation like the
following can have unexpected results:

$ vercmp "1.2 == 1.2.0"
no