zypper, the logic it uses to determine the package version

Friends:

Thank you in advance for you time and attention.

I am trying to understand how package higher and lower versions are determined by zypper

For example
Package 1 is objectgrid-3.6.0_444.2-36
Package 2 is objectgrid-3.6.0_Audit.19-36

The Package 2 was created after the Package 1 was created but zypper says Package 2 is a lower version.

I am not sure on what basis is it determining that Package 2 is lower version than package 1.

The selected package ‘objectgrid-3.6.0_Audit.19-36.x86_64’ from repository ‘Plain RPM files cache’ has lower version than the installed one. Use ‘zypper install --oldpackage objectgrid-3.6.0_Audit.19-36.x86_64’ to force installation of the package.

Any idea why and how to find out the logic zypper uses ?

Regards,
-Narahari

It is probably a really-not-good idea to mix alphas and
numerics/numbers/numerals in versions of packages. Best case scenario,
you’ll get lucky and confuse people; less-great scenario, where you are
now, you confuse the system (or rather, you’re confused by the system
which follows absolute rules).

Next, if you want one version to be higher than another, be sure something
about the obvious version information is different. The date of package
creation has exactly nothing to do with the earlier/later/version of the
package. Older packages are created all of the time, to maintain older
software, even though those packages are created today along with newer
packages, maybe after newer packages. The system uses the metadata you
create in your spec file to determine what is newer or older.

If you want one package that does something about auditing, put that in
the package name and not in the version portion. ‘Audit’ is not a version
anything, so if it is not some kind of indicator to the administrator
regarding different functionality, maybe lose it entirely and instead put
that kind of information in the description or changelog.

The answer to your question is that the ‘rpm’ command, and by extension
‘zypper’ sees numbers as newer than letters. I found an article below
that explains this with a nice breakdown of the rpmcpmver algorithm (see
step 6 of that algorithm):

http://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…