Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 87157 - versionator.eclass -> version_is_at_least() patch
Summary: versionator.eclass -> version_is_at_least() patch
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Ciaran McCreesh
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-29 12:06 UTC by Francesco R. (RETIRED)
Modified: 2005-05-20 21:56 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
versionator.eclass.patch (versionator.eclass.patch,5.60 KB, patch)
2005-03-29 12:07 UTC, Francesco R. (RETIRED)
Details | Diff
versionator.eclass.patch (versionator.eclass.patch,5.52 KB, patch)
2005-03-29 12:16 UTC, Francesco R. (RETIRED)
Details | Diff
versionator.eclass (versionator.eclass,12.99 KB, text/plain)
2005-05-10 17:33 UTC, Ciaran McCreesh
Details
versionator.eclass (versionator.eclass,13.65 KB, text/plain)
2005-05-10 18:22 UTC, Ciaran McCreesh
Details
versionator.eclass (versionator.eclass,13.72 KB, text/plain)
2005-05-10 20:57 UTC, Ciaran McCreesh
Details
versionator-testcase.tar.bz2 (versionator-bug87157.tbz,185.48 KB, application/octet-stream)
2005-05-15 03:40 UTC, Francesco R. (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco R. (RETIRED) gentoo-dev 2005-03-29 12:06:12 UTC
The attached patch fix some inconsistancies versionator -> version_is_at_least() function.
Added two extra functions (needed for version_is_at_least):
- versionator_sub_level_to_num()
- versionator_sub_num_to_level()

a small addition to __versionator__test_version_is_at_least(), the following two rows:
version_is_at_least "1.0.0"           "1.0.0_alpha" && echo "test 24 failed"
version_is_at_least "1.0.0"   "1.0.1_alpha20050101" || echo "test 25 failed"
Comment 1 Francesco R. (RETIRED) gentoo-dev 2005-03-29 12:07:25 UTC
Created attachment 54785 [details, diff]
versionator.eclass.patch
Comment 2 Francesco R. (RETIRED) gentoo-dev 2005-03-29 12:16:56 UTC
Created attachment 54786 [details, diff]
versionator.eclass.patch

braindead, the previous patch was done on a versionator.eclass.old already
modified ( __versionator__test_version_is_at_least() )
this should be the right one.
Comment 3 Francesco R. (RETIRED) gentoo-dev 2005-03-29 12:51:40 UTC
mmmh still one thing:
in versionator_sub_level_to_num()

"p" "Patch level" has lower priority than "r" "revision number", probably this should be inverted. 

At you the choiche
Comment 4 Ciaran McCreesh 2005-03-29 20:24:48 UTC
Might be a few days before I can get to this one, I'll need to go over it very carefully. Does it need committing in a hurry for anything in particular?
Comment 5 Francesco R. (RETIRED) gentoo-dev 2005-03-29 23:54:40 UTC
I agree with you that you need to threat it carefully.

Now I use it for overlay of nightly build of MySQL 4.x,5.0, because it's an overlay I'll simply add a "my_versionator.eclass" for the time you need to check and accept/reject this patch.

Short answer: keep the time you need, no Hurry here
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-10 11:00:32 UTC
ciaranm: bump, could you see about getting this into the tree? I'd like to put the new MySQL versions in this week, without having to hack around versionator.
Comment 7 Ciaran McCreesh 2005-05-10 13:00:18 UTC
Hrm, looking at this some more, I'm really not liking the way it handles things. I'll have a go at doing it the other way and see if it comes out any cleaner.
Comment 8 Ciaran McCreesh 2005-05-10 17:33:05 UTC
Created attachment 58630 [details]
versionator.eclass

Give this one a go. It may well be buggy...
Comment 9 Ciaran McCreesh 2005-05-10 18:22:22 UTC
Created attachment 58631 [details]
versionator.eclass

This one has a version_sort too just for the hell of it.
Comment 10 Ciaran McCreesh 2005-05-10 20:57:31 UTC
Created attachment 58642 [details]
versionator.eclass

Bugfix in sort...
Comment 11 Francesco R. (RETIRED) gentoo-dev 2005-05-15 03:40:38 UTC
Created attachment 58942 [details]
versionator-testcase.tar.bz2

the attachment contain the following files:
-ebuild_list.txt list of gentoo ebuilds (~18000 entries)
-test_version_compare.txt result of the ~18000 comparison
-test_versionator.php php implementation of the functions. 
-test_version_compare.sh wrapper to call the function from test_versionator.php

-test_version_sort.sh wrapper to call the function from test_versionator.php
-versionator.eclass you know

The result of the test is correct here (x86 gnu/linux) .

Some interesting examples are:
0j-r1 (cmp) 0.4 = 1 (less than)
1.0 (cmp) 1.0.0 = 2 (equal)
1.0-r1 (cmp) 1.0.0-r1 = 2 (equal)

version_sort() has been only superficially tested, has you commented it's
dangerous try to use it with more than few dozen of elements.
Comment 12 Ciaran McCreesh 2005-05-15 03:56:55 UTC
The 1.0 == 1.0.0 thing is intentional. I'm pretty sure 0j-r1 (cmp) 0.4 is correct too -- letters have lower precedence than the number part, so 0.0* comes before 0.4*.
Comment 13 Francesco R. (RETIRED) gentoo-dev 2005-05-15 04:25:18 UTC
I was sure it was, its needed also to compare a "real" version number versus a developer created one right?
It's not so inituitive anyway, maybe a pair of line can be added to the docs or simply to the eclass comments?
Comment 14 Ciaran McCreesh 2005-05-15 04:33:20 UTC
I'd say that it's 'intuitive'. Consider the alternative... version_is_at_least 1.0.0 1.0 returning false would be kinda weird...
Comment 15 Ciaran McCreesh 2005-05-20 21:56:29 UTC
Ok, it's in the tree.