Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] PATCH: initial EAPI awareness
Date: Wed, 31 Aug 2005 14:42:46
Message-Id: 4315C1FB.4090008@gmail.com
In Reply to: Re: [gentoo-portage-dev] PATCH: initial EAPI awareness by Brian Harring
1 Marius Mauch wrote:
2
3 > On 08/30/05 Paul de Vrieze wrote:
4 >
5 >> I don't think it is a wise path to interpret EAPI's as integers at
6 >> all. There should not be guarantees of forward or backward
7 >> compatibility between versions. Interpreting them as integers seems
8 >> to imply that. Basically I think that EAPI could be anything wanted,
9 >> similar to SLOTS. Of course using digits is easy for humans.
10 >
11 >
12 >
13 > I've to agree with Paul here, portage should hold a list of all EAPI
14 > values it understands, not a maximum value.
15 >
16
17 I also agree. It seems like a list of string identifiers will give us a high level of forward flexibility.
18
19 For the implementation we can have a chain of EAPI handlers that are capable of determining whether or not they support a given EAPI. The first handler in the chain to accept the package will be allowed to handle it. Internally, these handlers may be able to share libraries and/or inherit from eachother.
20
21 Brian Harring wrote:
22 >
23 > Either way, getting to the point of why strings suck badly in the
24 > point where it matters- as format version identifiers for the code
25 > that does the actual work.
26 >
27 > Example code for numeric, say we have eapi 0-5 at this point.
28 >
29 > def configure(self):
30 > if self.pkg.eapi > 0:
31 > ...call configure phase...
32 > return
33 >
34 >
35 > example code for strings
36 >
37 > def configure(self):
38 > if self.pkg.eapi in ("0", "1", "2", "3", "4", "5"):
39 > ...call configure phase...
40 > return
41 >
42 > This sucks.
43 >
44
45 Yes, the above seems bad. That is why I have suggested that a chain of handlers be used. Select the first handler in the chain that recognizes the ebuild's eapi. The selected handler would not need the above conditionals because it would be designed specifically for the eapi that it handles.
46
47 [snip]
48 >
49 > capabilities = {"0":["configure"],
50 > "1":["configure", "test_src_uri"],
51 > "2":["configure", "test_src_uri"],
52 > "3":["configure", "test_src_uri", "full_depriving"],
53 > "4":["configure", "test_src_uri", "full_depriving", "user_management"],
54 > "5":["configure", "test_src_uri", "full_depriving", "user_management"],}
55 >
56 > def configure(self):
57 > if "configure" in capabilities.get(eapi, []):
58 > ...call configure phase...
59 > return
60 >
61
62 Where appropriate, handlers could inherit from eachother or use shared libraries in order to provide the above capabilities.
63
64 [snip]
65 >
66 > That said, if you dig through my earlier patch, and comments about
67 > needing to handle int conversion better rather then flattening it to
68 > 0, the code *is* forwards compatible if someone decides to stick strings
69 > into EAPI. In other words, it's a moot debate due to the fact that
70 > the internal representation of eapi (is it a string, or is it an int?)
71 > is specific to that portage version; whatever version supports an eapi
72 > with strings tagged into has the fun of addressing the issues I've
73 > brought up above.
74 >
75
76 Okay, if it works and it's forward compatible with string lists, then I'm happy with it. :)
77
78 Zac
79 --
80 gentoo-portage-dev@g.o mailing list