Re: perl module version ordering differing from RPM

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

 




You can't really do this.  Basically the only real solution is epochs;
there simply is no one-to-one mapping of floats to RPM's vercmp.  I
suspect you're trying to come up with a way to automatically generate
RPMs from CPAN modules?  If so, I'd suggest looking at the
RPM::Specfile module on CPAN.  It contains a script called cpanflute2
that will do that.

The biggest problem is that, with RPM, 1.06 is the same as 1.6.  So
you can have two different strings that are equal in RPM's version
comparison.  This doesn't happen with floating point numbers (except
trailing zeros, which doesn't usually happen with cpan modules), so
there isn't a very effective mapping.

Chip

Ganesh Sittampalam <ganesh@earth.li> writes:

> Does anyone know of a nice fix for this problem? The issue is that perl
> orders version numbers based on a floating point comparison, whereas RPM
> compares version numbers on an essentially integer basis (precisely, it
> splits the version number into the pieces separated by '.', then compares
> each chunk, but without removing leading zeroes: so 1.06 < 1.10 but 1.061 >
> 1.10).
> 
> My best idea so far is to turn Perl's 1.061 into 1.0.6.1 (etc) when
> generating version numbers for RPM. But this is a bit messy, and would also
> require rebuilding all Redhat's packages to do the same thing. 
> 
> I could make it slightly less messy by just inserting an extra '.' after the
> first two digits after the first '.'  - so 1.061 would become 1.06.1, which
> would be slightly less correct but still work for all the cases I've run
> into so far. It should also minimise the need to rebuild the Redhat
> packages.
> 
> Cheers,
> 
> Ganesh
> 
> 
> 
> _______________________________________________
> Redhat-devel-list mailing list
> Redhat-devel-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list
> 

-- 
Chip Turner                   cturner@redhat.com
                              Red Hat, Inc.



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@redhat.com
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux