Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 399039 - EXPORT_FUNCTIONS behaviour when called before inherit
Summary: EXPORT_FUNCTIONS behaviour when called before inherit
Status: IN_PROGRESS
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:
 
Reported: 2012-01-16 00:28 UTC by David Leverton
Modified: 2021-09-03 11:34 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 David Leverton 2012-01-16 00:28:56 UTC
A few years ago in [1], a change was suggested so that EXPORT_FUNCTIONS would take effect at the end of the eclass (say A.eclass) that uses it rather than at the point where it's used, so calling EXPORT_FUNCTIONS and then inheriting another eclass (say B.eclass) that exports the same phases would end up using the ones from A, rather than B as before.  I was just reminded of this and found that the change was indeed applied to Portage at the time, including the warning mentioned in the email that gets triggered when the change would result in different behaviour.  Although the email suggests that the warning could be removed at some point, this hasn't happened yet and it's still present in current git Portage.  Paludis doesn't have the change at all, and neither does Pkgcore as far as I can tell.

I suggest that we decide what to do about this change, rather than leaving it in limbo:
1) revert it
2) make it official - document it in PMS, implement it in Paludis and Pkgcore and remove the warning from Portage
3) revert it for current EAPIs but consider it for 5 and later (although eclasses that target earlier EAPIs won't be able to use the feature anyway, as mentioned in the mail; there are also the usual caveats about changing inherit behaviour between EAPIs, although I think it's manageable in this case)
4) something else?

Due to the warning there probably aren't currently any eclasses that would be affected by this (also I'm not aware of any Paludis or Pkgcore users complaining about the breakage that would have been caused), so changing Portage back should be safe if that's what we want.  Since at the time of the change it was mentioned that PMS wasn't clear on what the behaviour should be, it might be worth clarifying that as well.

[1] http://thread.gmane.org/gmane.linux.gentoo.devel/60118/focus=60178
Comment 1 Zac Medico gentoo-dev 2012-01-16 21:25:07 UTC
(In reply to comment #0)
> so calling EXPORT_FUNCTIONS and then inheriting
> another eclass (say B.eclass) that exports the same phases would end up using
> the ones from A, rather than B as before.

I can't imagine that anyone would intend to have the ordering of EXPORT_FUNCTIONS and inherit calls to make a difference.

> 2) make it official - document it in PMS, implement it in Paludis and Pkgcore
> and remove the warning from Portage

Well, you probably want to have the warning in all three of them for at least a year or two.
Comment 2 Larry the Git Cow gentoo-dev 2021-09-01 17:35:00 UTC
The bug has been referenced in the following commit(s):

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

commit f5f8e42eeb8ea1e8c2ac182f30214ef0c559dd88
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-08-29 08:10:29 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2021-08-31 16:02:50 +0000

    eclasses.tex: Clarify precedence of EXPORT_FUNCTIONS calls
    
    Clarify that the last call to EXPORT_FUNCTIONS takes precedence over
    earlier calls.
    
    Unfortunately, we need an exception when inherit is called after
    EXPORT_FUNCTIONS because Portage changed its behaviour in 2009:
    https://gitweb.gentoo.org/proj/portage.git/commit/?id=06d4433e8b8be60d606733b9e23f57f8a5869d8f
    
    Pkgcore and Paludis apply precedence consistently based on call order
    of EXPORT_FUNCTIONS.
    
    Bug: https://bugs.gentoo.org/399039
    Bug: https://bugs.gentoo.org/422513
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eclasses.tex | 4 ++++
 1 file changed, 4 insertions(+)
Comment 3 Ulrich Müller gentoo-dev 2021-09-01 17:37:33 UTC
Leaving this bug open for a possible revert in the next EAPI.
Comment 4 Larry the Git Cow gentoo-dev 2021-09-03 11:34:15 UTC
The bug has been referenced in the following commit(s):

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

commit 5ec443ed7dab583f3c654ee81fff563cbda5a9d4
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-08-30 06:22:12 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2021-09-03 11:32:12 +0000

    ebuild.sh: Update QA notice in inherit()
    
    Bug: https://bugs.gentoo.org/399039
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 bin/ebuild.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

commit c401d1781c5cc2945e8a7234716ad1c4f1b03ed3
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2021-08-30 06:22:10 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2021-09-03 11:32:10 +0000

    Revert "Revert "Generate a QA Notice when EXPORT_FUNCTIONS is called before inherit""
    
    Reinstate the QA notice, because Portage behavior deviates from PMS,
    and breakage of eclasses with Pkgcore has been observed recently.
    
    This reverts commit f44d32550861cb25c209ef61dcd7ae1aa230da1f.
    
    Bug: https://bugs.gentoo.org/399039
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 bin/ebuild.sh | 8 ++++++++
 1 file changed, 8 insertions(+)