-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ebuild-writing/using-eclasses: mention sorting inherit arguments #202
Conversation
0c9a14a
to
8eacc39
Compare
Signed-off-by: Sam James <sam@gentoo.org>
8eacc39
to
edf21d8
Compare
alphabetically. An exception is where the phases exported by an eclass are | ||
affected by subsequent arguments. For example, <c>multilib-minimal.eclass</c> | ||
mentions in its | ||
<uri link="::eclass-reference/multilib-minimal.eclass/">documentation</uri> | ||
that it should be inherited last because it overrides most phases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it, an ebuild shouldn't rely on inherit order.
Instead, in the (relatively rare?) case that there's more than one eclass exporting a phase function, the ebuild should define that phase function and call the eclass functions in a well-defined order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you going to rewrite all the multilib-minimal
using ebuilds? I doubt it. Having the last eclass be the canonical one has been standard practice for a long time
<p> | ||
When using <c>inherit</c>, it is best practice to sort the arguments (eclasses) | ||
alphabetically. An exception is where the phases exported by an eclass are | ||
affected by subsequent arguments. For example, <c>multilib-minimal.eclass</c> | ||
mentions in its | ||
<uri link="::eclass-reference/multilib-minimal.eclass/">documentation</uri> | ||
that it should be inherited last because it overrides most phases. | ||
</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something similar to the following instead?
<p> | |
When using <c>inherit</c>, it is best practice to sort the arguments (eclasses) | |
alphabetically. An exception is where the phases exported by an eclass are | |
affected by subsequent arguments. For example, <c>multilib-minimal.eclass</c> | |
mentions in its | |
<uri link="::eclass-reference/multilib-minimal.eclass/">documentation</uri> | |
that it should be inherited last because it overrides most phases. | |
</p> | |
<p> | |
When using <c>inherit</c>, it is best practice to sort the arguments (eclasses) | |
alphabetically. | |
</p> | |
<important> | |
Don't rely on inherit order. It can be different from what it appears to be | |
because eclasses can indirectly inherit each other. If several eclasses export | |
the same phase functions, the ebuild should therefore define that function | |
and explicitly call the eclass functions in a well defined order. | |
</important> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, disagree, noone is going to clutter multilib ebuilds like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This eclass must always go last" is strange advice. What if more than one eclass says that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The eclass won't say it, it's the use that implies where it does (even though anything overriding multilib-minimal
would seem strange)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it does:
# multilib-minimal should _always_ go last in inherit order!
For reference, the old Devrel Handbook had some wisdom about this:
This is still up to date, so maybe some of it could be reused? (I also think that the last sentence from above is what I remembered as a policy, but looks like it was never an absolute requirement.) |
Signed-off-by: Sam James sam@gentoo.org