[wpkg-users] [Bug 120] Enhanced revision check and handling

bugzilla-daemon at bugzilla.wpkg.org bugzilla-daemon at bugzilla.wpkg.org
Sun Jun 14 17:38:14 CEST 2009


http://bugzilla.wpkg.org/show_bug.cgi?id=120





--- Comment #5 from Rainer Meier <r.meier at wpkg.org>  2009-06-14 17:38:07 ---
Created an attachment (id=148)
 --> (http://bugzilla.wpkg.org/attachment.cgi?id=148)
New version comparison algorithm for testing.

Hi,

This report has been open for a while now. Finally I spent some effort to
improve the version comparison of WPKG. This attachment includes three files:

- versionCompare.js
- versionCompareTestSuite.cmd
- wpkg.js

The file "wpkg.js" is based on WPKG 1.1.1-RC2 and includes the new algorighm.
The script "versionCompare.js" is there to test the new algorithm
independently. To use it run
cscript versionCompare.js "1.0" "2.0"

Then check the output if it fits your expectation.
The script versionCompareTestSuite.cmd is a batch file which includes a couple
of test-cases for versionCompare.js.

Here's a description of changes:
MOD: The comparison of of version strings the same way how a human would read
     it is quite difficult. Up to now WPKG supported only versions containing a
     sequence of colon-separated digits. The algorithm has been re-worked to
     support much more complicated version strings. Some examples include:
     A        B              Result            
     "1"      "2"            B is newer        
     "1"      "15"           B is newer        
     "1.0"    "1.2.b"        B is newer        
     "1.35"   "1.35-2"       B is newer        
     "1.35-2" "1.36"         B is newer        
     "1.35R3" "1.36"         B is newer        
     "1"      "1.0.00.0000"  Versions are equal
     "1"      "1.0"          Versions are equal
     "1.35"   "1.35-2"       B is newer        
     "1.35-2" "1.35"         A is newer        
     "1.35R3" "1.36R4"       B is newer        
     "1.35-2" "1.35-2.0"     Versions are equal
     "1.35.1" "1.35.1.0"     Versions are equal
     Thanks to Jens Geile for asking an improved algorithm.


The current output of the test suite looks as follows:
Testing versions
Comparing revision '1' (A) and '2' (B). B is newer!

Comparing revision '1' (A) and '15' (B). B is newer!

Comparing revision '1.0' (A) and '1.2.b' (B). B is newer!

Comparing revision '1.1' (A) and '1b.0' (B). B is newer!

Comparing revision '1.0b' (A) and '1.0' (B). A is newer!

Comparing revision '1.0b1' (A) and '1.0' (B). A is newer!

Comparing revision '1.0b2' (A) and '1.0b009' (B). B is newer!

Comparing revision '2' (A) and '2' (B). Revisions are equal.

Comparing revision '1' (A) and '1.0' (B). Revisions are equal.

Comparing revision '1' (A) and '1.0.00.0000' (B). Revisions are equal.

Comparing revision '1.35' (A) and '1.35R2' (B). B is newer!

Comparing revision '1.35R2' (A) and '1.35R3' (B). B is newer!

Comparing revision '1.35R3' (A) and '1.36' (B). B is newer!

Comparing revision '1.35R3' (A) and '1.36R1' (B). B is newer!

Comparing revision '1.35-2' (A) and '1.36' (B). B is newer!

Comparing revision '1.35-2' (A) and '1.36-2' (B). B is newer!

Comparing revision '1.35' (A) and '1.35-2' (B). B is newer!

Comparing revision '1.35-2' (A) and '1.35' (B). A is newer!

Comparing revision '1.35-2' (A) and '1.35-2.0' (B). Revisions are equal.

Comparing revision '1.35.1' (A) and '1.35.1.0' (B). Revisions are equal.

Comparing revision '2.4.0' (A) and '2.4.0.1' (B). B is newer!



Please use the script to test if it produces expected results for your own
version comparisons. If it produces wrong/unexpected results please report the
following data:
- Version A (left side)
- Version B (right side)
- Expected result (left is newer/right is newer/versions equal)
- Program using such a version scheme

I can of course not promise that the algorithm will provide correct results for
eavery comparison but I hope it will cover more cases than the previous
algorithm. I am asking for a field test here in order to sort out bugs before
it's going to be officially released as a part of WPKG.

-- 
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the wpkg-users mailing list