| 1 | GLEP: 55 |
1 | GLEP: 55 |
| 2 | Title: Use EAPI-suffixed ebuilds (.ebuild-EAPI) |
2 | Title: Use EAPI-suffixed ebuilds (.ebuild-EAPI) |
| 3 | Version: $Revision: 1.3 $ |
3 | Version: $Revision: 1.5 $ |
| 4 | Last-Modified: $Date: 2009/05/17 15:50:27 $ |
4 | Last-Modified: $Date: 2009/05/17 20:56:53 $ |
| 5 | Author: Piotr Jaroszyński <peper@gentoo.org> |
5 | Author: Piotr Jaroszyński <peper@gentoo.org> |
| 6 | Status: Draft |
6 | Status: Draft |
| 7 | Type: Standards Track |
7 | Type: Standards Track |
| 8 | Content-Type: text/x-rst |
8 | Content-Type: text/x-rst |
| 9 | Created: 17-Dec-2007 |
9 | Created: 17-Dec-2007 |
| … | |
… | |
| 36 | * Add new global scope functions in any sane way. |
36 | * Add new global scope functions in any sane way. |
| 37 | |
37 | |
| 38 | * Extend versioning rules in an EAPI - for example, addition of the scm |
38 | * Extend versioning rules in an EAPI - for example, addition of the scm |
| 39 | suffix - GLEP54 [#GLEP54]_ or allowing more sensible version formats like |
39 | suffix - GLEP54 [#GLEP54]_ or allowing more sensible version formats like |
| 40 | ``1-rc1``, ``1-alpha`` etc. to match upstream more closely. |
40 | ``1-rc1``, ``1-alpha`` etc. to match upstream more closely. |
|
|
41 | |
|
|
42 | * Use newer bash features. |
| 41 | |
43 | |
| 42 | |
44 | |
| 43 | Current behaviour |
45 | Current behaviour |
| 44 | ================= |
46 | ================= |
| 45 | |
47 | |
| … | |
… | |
| 120 | |
122 | |
| 121 | emerge: there are no ebuilds to satisfy "sys-apps/foo" |
123 | emerge: there are no ebuilds to satisfy "sys-apps/foo" |
| 122 | |
124 | |
| 123 | Not the best error message, especially if there are lots of them. |
125 | Not the best error message, especially if there are lots of them. |
| 124 | |
126 | |
|
|
127 | Use newer bash features |
|
|
128 | ----------------------- |
|
|
129 | |
|
|
130 | ``|&`` is a new type of redirection added in bash-4. It cannot be used even in |
|
|
131 | local scope as bash still parses the whole ebuild. |
|
|
132 | |
|
|
133 | ``sys-apps/foo-1.ebuild``:: |
|
|
134 | |
|
|
135 | EAPI="5" |
|
|
136 | |
|
|
137 | foo() { |
|
|
138 | echo "foo" |& cat |
|
|
139 | } |
|
|
140 | |
|
|
141 | Result:: |
|
|
142 | |
|
|
143 | /var/lib/gentoo/repositories/peper/sys-apps/foo/foo-1.ebuild: line 8: syntax error near unexpected token `&' |
|
|
144 | /var/lib/gentoo/repositories/peper/sys-apps/foo/foo-1.ebuild: line 8: ` echo "foo" |& cat' |
|
|
145 | * |
|
|
146 | * ERROR: sys-apps/foo-1 failed. |
|
|
147 | * Call stack: |
|
|
148 | * ebuild.sh, line 1879: Called _source_ebuild |
|
|
149 | * ebuild.sh, line 1818: Called die |
|
|
150 | * The specific snippet of code: |
|
|
151 | * source "${EBUILD}" || die "error sourcing ebuild" |
|
|
152 | * The die message: |
|
|
153 | * error sourcing ebuild |
|
|
154 | * |
|
|
155 | * If you need support, post the topmost build error, and the call stack if relevant. |
|
|
156 | * This ebuild is from an overlay: '/var/lib/gentoo/repositories/peper/' |
|
|
157 | * ... done! |
|
|
158 | |
|
|
159 | !!! All ebuilds that could satisfy "sys-apps/foo" have been masked. |
|
|
160 | !!! One of the following masked packages is required to complete your request: |
|
|
161 | - sys-apps/foo-1 (masked by: corruption) |
|
|
162 | |
|
|
163 | Again, not the best error. |
|
|
164 | |
| 125 | Abstract solution |
165 | Abstract solution |
| 126 | ================= |
166 | ================= |
| 127 | |
167 | |
| 128 | A solution to this problem has to lift those limitations and the only way to do |
168 | A solution to this problem has to lift those limitations and the only way to do |
| 129 | it is to make the EAPI of an ebuild available to the package managers in a way |
169 | it is to make the EAPI of an ebuild available to the package managers in a way |
| … | |
… | |
| 175 | problems too. The first is the requirement to have strict EAPI ordering, the |
215 | problems too. The first is the requirement to have strict EAPI ordering, the |
| 176 | second is ensuring that all the ebuilds for a single category/package-version |
216 | second is ensuring that all the ebuilds for a single category/package-version |
| 177 | are equivalent, i.e. installing any of them has exactly the same effect on a |
217 | are equivalent, i.e. installing any of them has exactly the same effect on a |
| 178 | given system. |
218 | given system. |
| 179 | |
219 | |
|
|
220 | Also note that it is not a new restriction. It is already possible to illegally |
|
|
221 | have multiple versions with different EAPIs as e.g. ``1.0 == 1.00 == 1.00-r0`` |
|
|
222 | and hence you could have ``foo-1.0.ebuild`` with EAPI X and ``foo-1.00.ebuild`` |
|
|
223 | with EAPI Y. |
|
|
224 | |
| 180 | Summary of ideas |
225 | Summary of ideas |
| 181 | ================ |
226 | ================ |
| 182 | |
227 | |
| 183 | EAPI-suffixed ebuilds (proposed solution) |
228 | EAPI-suffixed ebuilds (proposed solution) |
| 184 | ----------------------------------------- |
229 | ----------------------------------------- |
| … | |
… | |
| 216 | Performance decrease comes from the fact that with version format changes in the |
261 | Performance decrease comes from the fact that with version format changes in the |
| 217 | picture package managers need EAPI to parse the ebuild's version. That means that merely |
262 | picture package managers need EAPI to parse the ebuild's version. That means that merely |
| 218 | picking the best version of a package requires loading EAPI (from cache or the |
263 | picking the best version of a package requires loading EAPI (from cache or the |
| 219 | ebuild) for each available ebuild. |
264 | ebuild) for each available ebuild. |
| 220 | |
265 | |
|
|
266 | Here is more or less how the package manager figures out the best available |
|
|
267 | version for a package with N versions available. |
|
|
268 | |
|
|
269 | * EAPI in the filename |
|
|
270 | |
|
|
271 | * Read the directory containing the package - readdir() |
|
|
272 | * For each ebuild, read its EAPI and using that parse its version - no I/O |
|
|
273 | * Sort the versions - no I/O |
|
|
274 | * Going down from the highest to the lowest version |
|
|
275 | |
|
|
276 | * Get the metadata from cache - 2 x stat() + read() |
|
|
277 | * break if the version is visible |
|
|
278 | |
|
|
279 | * EAPI in the ebuild |
|
|
280 | |
|
|
281 | * Read the directory containing the package - readdir() |
|
|
282 | * For each ebuild load its metadata from cache to get its EAPI - N x (2 x stat() + read()) |
|
|
283 | * Sort the versions - no I/O |
|
|
284 | * Going down from the highest to the lowest version |
|
|
285 | |
|
|
286 | * (metadata is already loaded) - no I/O |
|
|
287 | * break if the version is visible - no I/O |
|
|
288 | |
|
|
289 | The difference is in for how many versions the package manager needs to hit |
|
|
290 | cache. With EAPI in the ebuild it needs to do that for all versions, with EAPI |
|
|
291 | in the filename it depends on versions visibility. |
|
|
292 | For example, package foo has versions 1, 2, 3, 4, 5 and 6. 6 is masked, 5 is |
|
|
293 | ~arch and 1,2,3 and 4 are arch. Say, the user accepts only arch for this |
|
|
294 | package. With EAPI in the filename it will read metadata only for versions |
|
|
295 | 6, 5 and 4. With EAPI in the ebuild it needs to load metadata for all versions. |
|
|
296 | |
|
|
297 | It's hard to say what's the avarage case, but surely the worst case scenario |
|
|
298 | (when only the lowest version is visible) is uncommon. |
| 221 | |
299 | |
| 222 | Easily fetchable EAPI inside the ebuild and one-time extension change |
300 | Easily fetchable EAPI inside the ebuild and one-time extension change |
| 223 | --------------------------------------------------------------------- |
301 | --------------------------------------------------------------------- |
| 224 | |
302 | |
| 225 | Properties: |
303 | Properties: |