Bug 165335 - RFE: rpm --compare-versions ver1 op ver2
Summary: RFE: rpm --compare-versions ver1 op ver2
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-08-08 04:21 UTC by Jeff Moe (jebba)
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-08-25 17:00:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jeff Moe (jebba) 2005-08-08 04:21:56 UTC
It is difficult to compare version numbers of packages to find out which one is
the most recent with RPM. Trying to do this in a simple shell script is near
impossible... It would be cool if you could feed `rpm` two packages and have it
return which is more recent. Debian's dpkg does this and it's quite nice. From
dpkg manpage:

dpkg --compare-versions ver1 op ver2
Compare  version  numbers,  where  op  is a binary operator.  dpkg returns
success (zero result) if the specified condition is satisfied, and failure
(nonzero result) otherwise. There are two groups of operators, which differ in
how they treat an empty ver1 or ver2. These treat an empty version as earlier
than any version: lt le  eq  ne  ge  gt. These treat  an  empty  version as
later than any version: lt-nl le-nl ge-nl gt-nl.  These are provided only for
compatibility with control file syntax: < << <= = >= >> >.

Comment 1 Jeff Johnson 2005-08-25 17:00:28 UTC
This script can be done in 10-20 lines of python, actually exists someplace.

Meanwhile, comparing versions has almost nothing to do with package management,
and so this does *NOT* belong on the rpm CLI (IMHO).

Comment 2 R P Herrold 2005-08-25 17:57:17 UTC
missed this one when it came through. see: ORC-rpm-ver-cmp at:
ftp://ftp.owlriver.com/pub/mirror/ORC/buildfarm/, which wrappes and adds sanity
checking to Seth's /usr/bin/fedora-rpmvercmp (which is itself already in:
fedora-rpmdevtools

This performs the requested comparisons


Note You need to log in before you can comment on or make changes to this bug.