Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 875362 - sys-apps/portage: incorrect ${PVR} value for -r0 ebuilds
Summary: sys-apps/portage: incorrect ${PVR} value for -r0 ebuilds
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 903973
Blocks: 563798
  Show dependency tree
 
Reported: 2022-10-05 09:40 UTC by Michał Górny
Modified: 2023-04-30 04:14 UTC (History)
2 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 2022-10-05 09:40:19 UTC
If I create foo-1-r0.ebuild:

  PF="foo-1-r0" (correct)

but:

  PVR="1" (i.e. it's missing -r0)

PMS doesn't specify any normalization, so these should copy the ebuild verbatim.
Comment 1 Ulrich Müller gentoo-dev 2023-04-28 14:39:32 UTC
You should rename your ebuild to foo-1-r00.ebuils, then you'll get a correct PVR="1-r00". :)

Obviously this behaviour makes no sense. The relevant code in doebuild.py looks trivial, so why hasn't this been fixed yet?

    if mysplit[2] == "r0":
        mysettings["PVR"] = mysplit[1]
    else:
        mysettings["PVR"] = mysplit[1] + "-" + mysplit[2]
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-28 17:11:45 UTC
(In reply to Ulrich Müller from comment #1)
> Obviously this behaviour makes no sense. The relevant code in doebuild.py
> looks trivial, so why hasn't this been fixed yet?
> 

I don't think comments like the last part are helpful.
Comment 3 Ulrich Müller gentoo-dev 2023-04-28 17:27:59 UTC
A simple fix would be to check for explicit -r0:

-    if mysplit[2] == "r0":
+    if mysplit[2] == "r0" and not mypv.endswith("-r0"):

Alternatively one could rewrite _pkgsplit, but presumably such a fix would be quite intrusive.
Comment 4 Ulrich Müller gentoo-dev 2023-04-28 17:32:18 UTC
BTW, the logic that checks for the explicit string "0" was added in 2001:
https://gitweb.gentoo.org/archive/repo/gentoo-2.git/commit/?id=9aa2cf18b4de3c81fd5bc98718b2614bd2e73d23
Comment 5 Larry the Git Cow gentoo-dev 2023-04-29 04:44:30 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=e788ace298fbbe5d656b64ce75b9376b0ecb407a

commit e788ace298fbbe5d656b64ce75b9376b0ecb407a
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2023-04-28 15:04:30 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-04-29 04:41:37 +0000

    doebuild.py: PVR includes -r0 if explicitly specified
    
    PMS says that PVR is "Package version and revision (if any)".
    https://projects.gentoo.org/pms/8/pms.html#x1-109001r1
    
    Pkgcore and Paludis follow PMS, i.e. PVR includes an explicit -r0
    (in other words, ${PF} is always equal to ${PN}-${PVR} for them).
    
    The previous logic for PVR had been added in 2001:
    https://gitweb.gentoo.org/archive/repo/gentoo-2.git/commit/?id=9aa2cf18b4de3c81fd5bc98718b2614bd2e73d23
    
    Bug: https://bugs.gentoo.org/875362
    Closes: https://github.com/gentoo/portage/pull/1028
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 NEWS                                   | 2 ++
 lib/portage/package/ebuild/doebuild.py | 8 ++------
 man/ebuild.5                           | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)
Comment 6 Larry the Git Cow gentoo-dev 2023-04-30 04:14:21 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b3c80502e96406b4b175e2ee79eb65f3f3cd9f6

commit 5b3c80502e96406b4b175e2ee79eb65f3f3cd9f6
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-04-30 04:13:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-04-30 04:13:36 +0000

    sys-apps/portage: add 3.0.47
    
    Bug: https://bugs.gentoo.org/597800
    Closes: https://bugs.gentoo.org/903973
    Closes: https://bugs.gentoo.org/875362
    Closes: https://bugs.gentoo.org/904895
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.47.ebuild | 285 +++++++++++++++++++++++++++++++++
 2 files changed, 286 insertions(+)