Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 775686 - New QA policy suggestion: mandate sorting eclass inherits
Summary: New QA policy suggestion: mandate sorting eclass inherits
Status: RESOLVED WONTFIX
Alias: None
Product: Quality Assurance
Classification: Unclassified
Component: Policies (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-12 21:39 UTC by Sam James
Modified: 2022-07-29 11:16 UTC (History)
1 user (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 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-03-12 21:39:45 UTC
Proposal: require sorting inherit arguments (eclasses) lexicographically except for where we need to consider phase export order.

The exception is intended for where phase export order is important, e.g. multilib-minimal.eclass which exposes almost all common phase functions.

Rationale:
* Principle of least surprise. It's non-trivial to parse the effective exported phases if the inherit line is not lexicographically sorted.

* Encourages authors to think carefully about inherit order at time of writing.

* Arbitrary order may mean the ebuild works "accidentally". The order should be minimally deviant from lexicographical sorting in order to best understand the flow
of execution and effective phase order.

* Future-proofing. By clearly defining this as our expectation, eclasses which need to be placed last must *clearly* state this. This should be done anyway though.

* This is already a de facto rule enforced during proxy-maint reviews and, for me at least, during recruitment and mentoring. We do exactly the same thing with KEYWORDS, which as far as I know, isn't actually explicitly stated.
Comment 1 Ulrich Müller gentoo-dev 2021-03-12 22:39:31 UTC
Not sure if making that a policy is a good idea. If we require a specific ordering, then people will inevitably rely on that ordering, even if they shouldn't.

I'd even go so far and say that an ebuild should work regardless of inherit order, i.e., resolve any phase export conflicts by explicitly defining that function. I'm also pretty sure that this has been discussed before (but fail to find it).
Comment 2 Alessandro Barbieri 2021-03-13 02:56:32 UTC
I've already tried
https://bugs.gentoo.org/show_bug.cgi?id=710922
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-29 11:16:01 UTC
Better as a style suggestion I guess.