Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 689494 - PMS and Portage disagree on ver_cut & ver_rs implementation
Summary: PMS and Portage disagree on ver_cut & ver_rs implementation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PMS/EAPI
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 563798
  Show dependency tree
 
Reported: 2019-07-08 15:30 UTC by Michał Górny
Modified: 2022-04-14 05:21 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-07-08 15:30:57 UTC
1. Wrt PMS and pkgcore, ver_cut and ver_rs use ${PVR} by default,

2. Wrt Portage and eapi7-ver.eclass, they use ${PV} by default.

I'm not really sure where this discrepancy came from, and therefore which one was correct.  Looking at the bug, ${PVR} is only mentioned for ver_test.  Personally I think ${PV} makes more sense for ver_cut and ver_rs since it's frequently used in SRC_URI, etc.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-07-08 15:31:26 UTC
(CC-ing council@ in case someone remembers more about the related discussion)
Comment 2 Ulrich Müller gentoo-dev 2019-07-08 16:17:38 UTC
The question is what was intended, so let's look at the history:

2015-11-22
   In bug 482170 comment #15 the following functions are suggested:
   - replace_version_sep (later renamed -> ver_rs): "VERSION is optional
     and defaults to ${PV} (I don't think we want ${PVR} here)."
   - get_version_comp (-> ver_cut): Default not explicitly specified.
   - version_test (-> ver_test): "V1 is optional and defaults to ${PVR}."

2017-09-08
   First version of eapi-ver.eclass committed:
   https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59a1a0dda7300177a263eb1de347da493f09fdee
   It defaults to:
   - ${PV} for ver_cut and ver_rs
   - ${PVR} for ver_test

2017-09-27 (author date) / 2017-10-04 (posted to gentoo-pms list)
   First draft for EAPI 7:
   https://archives.gentoo.org/gentoo-pms/message/c2b9ebed94fa4ad69ba02028744b927a
   This says ${PVR} for all three functions.

Since there was neither a discussion nor a note in the commit message about the change from PV to PVR, I think that the intention always was to have ${PV} for ver_cut and ver_rs, and ${PVR} in PMS seems to be a mistake.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-07-08 16:43:49 UTC
One more fact: EAPI 7 cheatsheet also lists PV for ver_cut and ver_rs.  So it's rather definitely a typo.
Comment 4 Larry the Git Cow gentoo-dev 2019-07-09 13:30:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/pms.git/commit/?id=248f1eaefec15b7c9537ad68a818e34065036b0d

commit 248f1eaefec15b7c9537ad68a818e34065036b0d
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-07-08 16:44:07 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-07-08 19:14:56 +0000

    pkg-mgr-commands: Correct ver_cut and ver_rs to use ${PV} by default
    
    Correct the description of ver_cut and ver_rs commands to indicate
    that they process ${PV} when no version argument is specified, rather
    than wrongly ${PVR}.
    
    It seems that the latter was introduced as a typo, as it neither agrees
    with initial Bugzilla proposal of the function [1], pre-EAPI
    implementation in eapi7-ver.eclass [2] or EAPI 7 cheatsheet in PMS.
    Furthermore, it simply makes little sense as the common usage of those
    functions is to manipulate URLs and filenames, and those do not use
    ebuild revisions..
    
    It is also how it was implemented in Portage, and initially in PkgCore
    (afterwards the PkgCore implementation changed to conform to PMS, with
    expectably breaking results).
    
    [1] https://bugs.gentoo.org/482170#c15
    [2] https://gitweb.gentoo.org/repo/gentoo.git/commit/eclass/eapi7-ver.eclass?id=59a1a0dda7300177a263eb1de347da493f09fdee
    
    Bug: https://bugs.gentoo.org/689494
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 pkg-mgr-commands.tex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)