Re: Reliable sorting of version strings?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> The end result though, is that your version comparison will always agree
> with rpm because you are asking rpm (rpmvercmp is actually subroutine
> in librpm that rpm uses when doing version comparisons).

Nice, this is what I wanted.

Thanks again,
Enrique


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux