Wrong version match
Anders F Björklund
afb at algonet.se
Tue Aug 17 01:52:54 PDT 2010
Antenore Gatta wrote:
> As I'm not sure this is a bug, I'd like to have your opinion.
>
> With the repositories I'm using (rpm), I have 3 different amarok
> versions:
>
> smart> ls -v amarok
> amarok-2.1.1-7.6 at i586
> amarok-2.3.1.60svn20100810-85.1 at i586
> amarok-2.3.1-77.4 at i586
In general, if you want to compare two versions there's "vercmp".
This varies between different backends, in how versions compare.
$ python
>>> from smart.backends.rpm.rpmver import vercmp
>>> vercmp("2.3.1-77.4", "2.3.1.60svn20100810-85.1")
-1
There's also two helpers called "splitarch" and "splitrelease",
which splits out an arch or a release from a version string.
$ python
>>> from smart.backends.rpm.rpmver import splitarch, splitrelease
>>> splitarch('2.3.1.60svn20100810-85.1 at i586')
('2.3.1.60svn20100810-85.1', 'i586')
>>> splitrelease('2.3.1.60svn20100810-85.1')
('2.3.1.60svn20100810', '85.1')
Again, just how package architectures and release revisions are
represented as strings varies (greatly) between the backends...
name1-version1-release1.noarch.rpm
name1_version1-release1_all.deb
name1-version1-noarch-release1.tgz
name1-version1-release1-i686.pkg.tar.gz
--anders
More information about the Smart
mailing list