Skip to content

tools: bootstrap: fix version checking algorithm

Khalid Masum requested to merge Labnann/vlc:fix-version-check-tool into master
If major number is not equal for needmajor and gotmajor, the version
checker returns old, which can lead to faulty results.

For example:
check_version meson 1.0.0 0.6.0 returns old; where expected is ok.

Fix this issue by changing the check of ne to gt. So that it returns
old if needmajor is greater than gotmajor.



Testcases:
==========
After change:
-------------
MyApp got:1.0.0 need:0.6.0 | actual: ok expected: ok
MyApp got:1.0.0 need:1.0.0 | actual: ok expected: ok
MyApp got:2.0.0 need:1.0.0 | actual: ok expected: ok
MyApp got:1.1.0 need:1.0.0 | actual: ok expected: ok
MyApp got:1.0.1 need:1.0.0 | actual: ok expected: ok
MyApp got:1.0.0 need:2.0.0 | actual: old expected: old
MyApp got:1.0.0 need:1.1.0 | actual: old expected: old
MyApp got:1.0.0 need:1.0.1 | actual: old expected: old
MyApp got:0.9.9 need:1.0.0 | actual: old expected: old
MyApp got:1.9.9 need:2.0.0 | actual: old expected: old
MyApp got:1.2.3 need:1.3.0 | actual: old expected: old
MyApp got:2.0.5 need:2.1.0 | actual: old expected: old



Before change
-------------
MyApp got:1.0.0 need:0.6.0 | actual: old expected: ok <-- error
MyApp got:1.0.0 need:1.0.0 | actual: ok expected: ok
MyApp got:2.0.0 need:1.0.0 | actual: old expected: ok <-- error
MyApp got:1.1.0 need:1.0.0 | actual: ok expected: ok
MyApp got:1.0.1 need:1.0.0 | actual: ok expected: ok
MyApp got:1.0.0 need:2.0.0 | actual: old expected: old
MyApp got:1.0.0 need:1.1.0 | actual: old expected: old
MyApp got:1.0.0 need:1.0.1 | actual: old expected: old
MyApp got:0.9.9 need:1.0.0 | actual: old expected: old
MyApp got:1.9.9 need:2.0.0 | actual: old expected: old
MyApp got:1.2.3 need:1.3.0 | actual: old expected: old
MyApp got:2.0.5 need:2.1.0 | actual: old expected: old
Edited by Khalid Masum

Merge request reports

Loading