Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 207827

Summary: Comparisons vs. missing revisions are not clearly specified. Implementations differ.
Product: Gentoo Hosted Projects Reporter: Björn Michaelsen <bjoern.michaelsen>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: RESOLVED WORKSFORME    
Severity: minor    
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Björn Michaelsen 2008-01-28 02:11:45 UTC
PMS r174 says:
"If at this point the two versions are still equal, the revision number is compared. The revision number has an optional integer suffix as per the previous part. If the revision numbers are equal, so are the two versions."
Earlier it says:
"Note in particular that \t{1.0} is less than \t{1.0.0}."

However it is not clear, if 1.0-r0 == 1.0 or not. Portage implements 1.0-r0 == 1.0

Reproducible: Always

Steps to Reproduce:
>>> import portage_versions
>>> portage_versions.vercmp("1.0","1.0-r0")
0
>>> import pkgcore.ebuild.cpv as cpv
>>> cpv.cpy_CPV("foo", "bar", "1.0") == cpv.cpy_CPV("foo", "bar", "1.0-r0")
False

Actual Results:  
results differ.

Expected Results:  
same result.
Comment 1 Ciaran McCreesh 2008-01-28 05:52:11 UTC
"This may optionally be followed by the suffix -r followed immediately by an integer (the 'revision number'). If this suffix is not present, it is assumed to be -r0."

It's entirely clearly specified.
Comment 2 Björn Michaelsen 2008-01-28 09:05:27 UTC
"If this suffix is not present, it is assumed to be \t{-r0}." is in \section{Version Specifications}. Please remove it there and add after "If at this point the two versions are still equal, the revision number is compared. The revision number has an optional integer suffix as per the previous part." in \section{Version Comparison} the following:
"If the revision number is not specified it is 0. The versions \t{1.0-r0} and \t{1.0} are equal."

This about version comparison, not how one can specify versions. It would also be more consistent with the way it is described for version components. Although \section{Version Specifications} might say that version specifications might end with -r0, but this is not encouraged.
Comment 3 Ciaran McCreesh 2008-01-28 09:14:53 UTC
No. Implicit -r0 has meaning everywhere, not just for comparisons. Think PVR and the like.
Comment 4 Björn Michaelsen 2008-01-28 17:46:57 UTC
I am not questioning that it is implied somewhere in the spec. Im just asking you to make it explicit. Its something thats easily overlooked when you implement it. I overlooked that and only found it via unittests. Pkgcore-devs overlooked it.

So perhaps it might be helpful to add it to the spec, as it wont grow out of proportion by one helpful sentence.

Anyway, Im closing this bug as WORKSFORME because _I_ know how its intended now.