Gentoo Archives: gentoo-dev

From: Jason Zaman <perfinion@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 1/2] Document policy of not relying on implicit eclass inherits]
Date: Sat, 28 Feb 2015 03:09:03
Message-Id: 20150228030839.GA8074@meriadoc.perfinion.com
1 Ian was having problems sending to the list so I am forwarding this to
2 the list on his behalf.
3
4 ----- Forwarded message from Ian Delaney <idella4@g.o> -----
5
6 From: Ian Delaney <idella4@g.o>
7 To: perfinion@g.o
8 Date: Sat, 28 Feb 2015 11:05:36 +0800
9 Subject: Fw: [gentoo-dev] [PATCH 1/2] Document policy of not relying on implicit eclass inherits
10 X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.25; x86_64-pc-linux-gnu)
11
12
13
14 Begin forwarded message:
15
16 Date: Sat, 28 Feb 2015 10:43:52 +0800
17 From: Ian Delaney <idella4@g.o>
18 To: gentoo-dev@l.g.o
19 Subject: Re: [gentoo-dev] [PATCH 1/2] Document policy of not relying on
20 implicit eclass inherits
21
22
23 On Wed, 25 Feb 2015 16:34:35 +0100
24 Julian Ospald <hasufell@g.o> wrote:
25
26 > ---
27 > ebuild-writing/using-eclasses/text.xml | 10 +++++++++-
28 > 1 file changed, 9 insertions(+), 1 deletion(-)
29 >
30 > diff --git a/ebuild-writing/using-eclasses/text.xml
31 > b/ebuild-writing/using-eclasses/text.xml index de9ec7f..49ec23b 100644
32 > --- a/ebuild-writing/using-eclasses/text.xml
33 > +++ b/ebuild-writing/using-eclasses/text.xml
34 > @@ -26,7 +26,15 @@ link="::general-concepts/portage-cache"/>).
35 > </p>
36 >
37 > <p>
38 > -After inheriting an eclass, its provided functions can be used as
39 > normal. Here's an example ebuild, <c>foomatic-0.1-r2.ebuild</c>, which
40 > uses four eclasses: +After inheriting an eclass, its provided
41 > functions can be used as normal. +</p> +<warning>
42 > +You must not rely on provided functions of implicitly inherited
43 > eclasses. +As an example: if you use <c>epatch</c> in your ebuild,
44 > you <b>must</b> +inherit <c>eutils.eclass</c> directly, even if
45 > another eclass (like distutils-r1) +already inherits it. Exceptions
46 > to this policy must be discussed and documented. +</warning>
47 > +<p>Here'san example ebuild, <c>foomatic-0.1-r2.ebuild</c>, which
48 > uses four eclasses: </p>
49 >
50 > <codesample lang="ebuild">
51
52 This effectively illegalises the very action I have gone to pains to
53 attempt to declare sane. While the attempt to improve or standardise a
54 practice has merit, this text is objectionable. There are dozens of
55 ebuilds that inherit only distutils-r1 and utilise its functions and or
56 vars. This single change will make my commits of last 2 years a
57 violation of policy, in a retrograde manner ofcourse.
58
59 While the principle here has some merit (somewhere), this approach is
60 declaring it a generalised policy, and unconditionally. The approach
61 here is dogmatic and unyielding. I decided long ago the inheriting of
62 eutils explicitly to be unwarranted duplication and a waste of bytes on
63 the line of inherit in so many ebuilds. Now in the early stages of
64 attempting mass conversions and with a history of 2 years of an
65 established pattern of use, this change is now proposed which
66 illegitimises it all.
67
68 The flaw here is that it is using a black and white and reductionist
69 approach. It presumes the validity of reducing all scenarios to a single
70 broad sweeping rule. The impact of implicit inherits by any and all
71 eclasses are therefore presumed to apply under this one policy. The
72 art of programming is an art as much as it is a science, and it comes in
73 shades of grey, at least 50 of them, not to mention rooms of various
74 shades of pastel red. Surely by now we all grasp the variations and
75 subtleties that crop up in writing both ebuilds and eclasses. In
76 doing the conversions I am forced to take the old packages' ebuilds on
77 a case by case basis. While the scenarios don't wholly equate here
78 (those shades of grey again damn them), sweeping generalisations are
79 what frighten me. Do not back gentoo's ebuild writers into a corner
80 where they have to scrap their way out, under the accusing waving
81 finger of qa. We have enough of that already.
82
83 If the python eclasses or eutils were to be edited in the future, they
84 are duty bound to not break rev dependencies. Sure there are scenarios
85 or rationale that warrant explicit inheriting in the style you're
86 recommending. This change doesn't allow for those that don't. It
87 generalises.
88
89 There are options. You could make a policy instead that enforces the
90 duplication of the code of an eclass, whole or in part, and therefore
91 avoid the need of it being inherited at all; so much for write once use
92 many.
93
94 Enough said. Off to the blue room.
95
96
97
98 .--
99 kind regards
100
101 Ian Delaney
102
103
104 --
105 kind regards
106
107 Ian Delaney
108
109 ----- End forwarded message -----

Replies