On Fri, 18 Jun 2004, Enrique Perez-Terron wrote: > On Fri, 2004-06-18 at 00:52, James Olin Oden wrote: > > #!/usr/bin/perl > > use RPM2; > > > > my $v1 = shift; > > my $v2 = shift; > > exit(RPM2::rpmvercmp($v1, $v2) + 1); > > > Thanks! > > Looking closer, I found that rpmvercmp is supposed to compare two > versions or two releases, but not two version-release strings. > > There is a function rpmVersionCompare() in lib/psm.c that compares two > headers by first comparing the epoch numbers (which I did not even know > about), then the versions, and if still ties, the releases. > Yeah, your example only showed one "version" string for comparison, so I neglected to mention rpmVersionCompare(). Essentially, all rpmVersionCompare adds to the mix is: compare epochs of two headers if not equal return result compare versions of two headers if not equal return result compare releases of two headers if not equal return result As it happens, if you use RPM2, and have two package header objects, either from the DB or a package, then you can just compare them to one another. IIRC, this works: $pkg1 <> $pkg2 which will compare epoch, version and release. Cheers...james _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list