Bug 165335

Summary: RFE: rpm --compare-versions ver1 op ver2
Product: [Fedora] Fedora Reporter: Jeff Moe (jebba) <moe>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED WONTFIX QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 4Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-08-25 17:00:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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