doccaz / scc-tools

A set of simple tools to interact with SUSE Customer Center (SCC)
MIT License
12 stars 1 forks source link

error comparing: 2.35-7.11.1 and 2.35.1-7.18.1 #18

Closed Thr3d closed 2 years ago

Thr3d commented 2 years ago

e20ca18 May have broken some of the comparing, wasn't seeing these before hand.

> vercheck.py -d.
Analyzing supportconfig directory: .
product name = SUSE Linux Enterprise Server 15 SP2 x86_64 (id 1939, x86_64)
found 838 total packages to check
gathering results...    
error comparing: 2.35-7.11.1 and 2.35.1-7.18.1 ([2, 35, '-', 7, 11, 1] and [2, 35, 1, '-', 7, 18, 1])
error comparing: 2.35-7.11.1 and 2.35.1-7.18.1 ([2, 35, '-', 7, 11, 1] and [2, 35, 1, '-', 7, 18, 1])
error comparing: 2.35-7.11.1 and 2.35.1-7.18.1 ([2, 35, '-', 7, 11, 1] and [2, 35, 1, '-', 7, 18, 1])
> grep -E '2.35.1-7.18.1|2.35-7.11.1' rpm.txt 
binutils                            SUSE Linux Enterprise 15            2.35.1-7.18.1
libctf-nobfd0                       SUSE Linux Enterprise 15            2.35.1-7.18.1
libctf0                             SUSE Linux Enterprise 15            2.35.1-7.18.1
doccaz commented 2 years ago

So, instead of trying to "fix" whatever the LooseVersion class (from Python distutils) thinks is unparseable, I'm taking a more "holistic" approach: if LooseVersion causes an exception, I'll ask the oracle (e.g. zypper vcmp). Since it's very infrequent (I've only seen it happen with 4 or 5 packages over thousands in my tests), this should be okay.

This should clear out inconsistencies when comparing between marvelous version strings like these: 7.2.1_k4.12.14_95.13-4.6.2 and 7.2.1_k4.12.14_95.71-4.12.1 9.3.1+git1296-1.6.1 and 9.2.1+r275327-1.3.7 8.2.1+r264010-1.3.7 and 10.3.0+git1587-1.6.4 15.4-3.29.1 and 15+git47-3.8.1

doccaz commented 2 years ago

you can see it working if -v is specified:

latest version for shim on product ID 1939 is 15.4-3.32.1 in repository Basesystem Module 15 SP2 x86_64
dont know how to compare: 15.4-3.32.1 and 15+git47-3.13.1, lets ask the oracle
the oracle says: 15.4-3.32.1 is newer