Module version: version compare functions

This module compares versions. It also defines version policies (i. e. which versions are considered as usable).

version_parse version_string dest

version_string: string with version

returns ${pwiz_result[@]}: array with version components

Parses version string to its component separated by one of known version element separators.

version_compare p1 p2

p1: name of array with first parsed version

p2: name of array with second parsed version

returns: 0: p1 newer than p2, 1: p1 older than p2, 2: p1 equal to p2

Compares two versions parsed by version_parse into arrays.

NOTE: p2 can be an empty array

WARNING: p1 and p2 are used without leading '$'.

version_policy_register name string hotkey

name: function name without leading "version_policy_"

string: text description of version policy (can be empty string)

hotkey: version policy hotkey (can be empty string)

Registers version policy to version policy registry.

version_policy_{type} version_array

version_array: version array from version_parse

returns: 0: is considered stable, 1: is considered unstable

Version policy gets release type from version string.

WARNING: version_array is used without leading '$'

version_ask_policy

Ask for policy. (internal)

WARNING: Call it after setting $pwiz_project_project!

version_policy_check

 returns: 0: version complies product version policy, 1: version does not comply product version policy

Check version using actual version policy.