Gentoo Archives: gentoo-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] eclass error-handling post-EAPI4
Date: Sat, 20 Oct 2012 21:56:33
Message-Id: 50831DE2.1030504@gentoo.org
In Reply to: Re: [gentoo-dev] eclass error-handling post-EAPI4 by "Gregory M. Turner"
1 On 10/20/2012 02:24 PM, Gregory M. Turner wrote:
2 > On 10/20/2012 4:05 AM, Ciaran McCreesh wrote:
3 >> On Sat, 20 Oct 2012 03:52:49 -0700
4 >> "Gregory M. Turner" <gmt@×××××.us> wrote:
5 >>> Took me a while, but I think I see why this is correct, now (mostly
6 >>> -- see below). The source of my confusion was a mistaken assumption
7 >>> that die() would not respect PORTAGE_NONFATAL.
8 >>
9 >> The source of your confusion is more the impression that there is such
10 >> a thing as PORTAGE_NONFATAL. You should be reading the spec, not code.
11 >
12 > Seriously? OK, let's try:
13 >
14 > http://dev.gentoo.org/~ulm/pms/4/pms.html#x1-13000012.3.3.1
15 >
16 > and
17 >
18 > http://dev.gentoo.org/~ulm/pms/4/pms.html#x1-13500012.3.3.6
19 >
20 > do not comport with the actual behavior of portage.
21 >
22 > Specifically, they very strongly suggest that nonfatal does not
23 > influence the behavior of die(). So depending on one's reading of the
24 > situation, either the PMS is misspecified or portage is broken.
25
26 I think portage's die should be fixed so that it dies regardless of the
27 nonfatal helper.
28
29 > Meanwhile,
30 >
31 >
32 > http://dev.gentoo.org/~zmedico/portage/doc/ch05s03s05.html#package-ebuild-eapi-4-helpers-die-nonfatal
33 >
34 >
35 > is dusting so much under the carpet that I can't possibly do my job as
36 > an eclass author without reverse-engineering, dry-run code analysis, or
37 > asking the SME's here on the mailing list how this is supposed to work
38 > in practice.
39 >
40 > I've already asked the mailing list and so far the closest thing I have
41 > to an answer is Zac's response. Although I appreciate his help, I've
42 > explained why his response doesn't fully address my concerns. If you
43 > don't trust my dry-run analysis then we can try the reverse-engineering
44 > approach. Give this ebuild a try:
45 >
46 > ---->8----
47 > # Copyright 1999-2012 Gentoo Foundation
48 > # Distributed under the terms of the GNU General Public License v2
49 > # $Header: $
50 >
51 > EAPI=4
52 > DESCRIPTION="Foo"
53 > SLOT="0"
54 > KEYWORDS="~x86 ~amd64 ~x86-linux ~amd64-linux"
55 > IUSE=""
56 > DEPEND=""
57 > RDEPEND="${DEPEND}"
58 > utility_fn() { die "uhoh"; }
59 > src_unpack() { mkdir -p "${S}"; }
60 > src_prepare() { nonfatal utility_fn; }
61 > src_compile() { echo "yaaay" > foo.txt; }
62 > src_install() { dodoc foo.txt; }
63 > ----8<----
64 >
65 > As you can see, my dry-run analysis appears to have been correct.
66 >
67 > There is no documentation concerning best practices for eclass authors
68 > post-EAPI4, so I can't just RTFM -- there is no FM. Furthermore, it
69 > appears that EAPI4 has broken a great many eclasses when invoked with
70 > the new nonfatal operator. I guess I can just file a bug for that since
71 > so far nobody seems too concerned by it, but that still doesn't help me
72 > to write my eclass.
73
74 As far as I can tell, nonfatal was only intend ed to work with package
75 manager built-in helpers. I don't think it's a good idea to try and
76 extend it to eclass functions.
77 --
78 Thanks,
79 Zac