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

Bug 338002

Summary: portage.VERSION syntax inconsistent between releases and live tree
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: trivial Keywords: InVCS
Priority: High    
Version: 2.2   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=912209
https://bugs.gentoo.org/show_bug.cgi?id=895908
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: make valid version and append _p with unix time if modified relative to HEAD

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-09-19 08:46:34 UTC
For portage-2.2:
* live git tree generates 'vX.Y_rcZ-N-...'
* ebuilds use 'X.Y_rcZ_pN'

This means that to parse portage.VERSION, I need to use regular expression as complex as:
^v?((?:\d+\.)*\d+)(?:_rc(\d+))?(?:(?:_p|-)(\d+))?

I guess a little unification may be a good idea. Not sure how to embed the hash but the first part could be really ebuild-like, in order to be parsable by the standard PV splitting functions.
Comment 1 Zac Medico gentoo-dev 2010-09-19 10:51:59 UTC
Created attachment 247979 [details, diff]
make valid version and append _p with unix time if modified relative to HEAD

Examples:

python -c 'import portage ; print portage.VERSION'
2.2_rc84_p1

# modify some source files

python -c 'import portage ; print portage.VERSION'
2.2_rc84_p1_p1284893343
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-09-19 15:54:01 UTC
(In reply to comment #1)
> python -c 'import portage ; print portage.VERSION'
> 2.2_rc84_p1_p1284893343

Hm, seems a little long. Maybe you could subtract the HEAD timestamp from it?
Comment 3 Zac Medico gentoo-dev 2010-09-19 23:34:19 UTC
(In reply to comment #2)
> Hm, seems a little long. Maybe you could subtract the HEAD timestamp from it?

Ok, it's in git now:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=213dce575a3302ea3b24a81382a587533fd665e1
Comment 4 Zac Medico gentoo-dev 2010-09-20 04:13:07 UTC
Marking as fixed since this only matters for checkouts.