public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ralph Sennhauser <sera@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] RFD: EAPI specification in ebuilds
Date: Sun, 18 Mar 2012 08:23:43 +0100	[thread overview]
Message-ID: <20120318082343.4d74340b@sera-17.lan> (raw)
In-Reply-To: <20311.51166.725757.212932@a1i15.kph.uni-mainz.de>

[-- Attachment #1: Type: text/plain, Size: 7157 bytes --]

On Wed, 7 Mar 2012 21:41:02 +0100
Ulrich Mueller <ulm@gentoo.org> wrote:

> Hi all,
> 
> The way how we currently specify the EAPI in ebuilds has some
> problems. For example, there is no sane way to allow usage of features
> of a new bash version in a new EAPI. So we are currently stuck with
> bash 3.2. Also changes of global scope behaviour, like addition of new
> global scope functions (similar to "inherit") are not possible.
> 
> These flaws are outlined in GLEP 55 [1]:
> | In order to get the EAPI the package manager needs to source the
> | ebuild, which itself needs the EAPI in the first place. Otherwise it
> | imposes a serious limitation, namely every ebuild, using any of the
> | future EAPIs, will have to be source'able by old package managers
> | [...]
> 
> The council has voted down GLEP 55 more than a year ago, but at the
> same time requested that a solution for the mentioned issues should be
> found. [2] However, there was no progress since then.
> 
> The issue arose again in bug 402167 [3] where several solutions have
> been discussed. Below, I try to summarise the possible options
> resulting from that discussion.
> 
> 
> *** Proposal 1: "Parse the EAPI assignment statement" ***
> 
> This first proposal would require that the syntax of the EAPI
> assignment statement in ebuilds matches a well defined regular
> expression. A scan of the Portage tree shows that the statement only
> occurs in the following variations (using EAPI 4 as example):
> 
>    EAPI=4
>    EAPI="4"
>    EAPI='4'
> 
> Sometimes this is followed by whitespace or a comment (starting with
> a # sign). Also, with very few exceptions the EAPI assignment occurs
> within the first few lines of the ebuild. For the vast majority of
> ebuilds it is in line 5.
> 
> Written in a more formal way, appropriate for a specification:
> - Ebuilds must contain at most one EAPI assignment statement.
> - It must occur within the first N lines of the ebuild (N=10 and N=30
>   have been suggested).
> - The statement must match the following regular expression (extended
>   regexp syntax):
>   ^[ \t]*EAPI=(['"]?)([A-Za-z0-9._+-]*)\1[ \t]*(#.*)?$
> 
> Note: The first and the third point are already fulfilled by all
> ebuilds in the Portage tree. The second point will require very few
> ebuilds to be changed (9 packages for N=10, or 2 packages for N=30).
> 
> The package manager would determine the EAPI by parsing the assignment
> with above regular expression. A sanity check would be added. Citing
> Zac Medico in [3]: "The fact that we can compare the probed EAPI to
> the actual EAPI variable after the ebuild is sourced seems like a
> perfect sanity check. We could easily detect inconsistencies and flag
> such ebuilds as invalid, providing a reliable feedback mechanism to
> ebuild developers."
> 
> This proposal comes in two variants:
> 1a) The change is applied retroactively for all EAPIs.
> 1b) It is only applied for EAPI 5 and later (which means that the
>     result of the EAPI parsing would be discarded for earlier EAPIs).
> 
> 
> *** Proposal 2: "EAPI in header comment" ***
> 
> A different approach would be to specify the EAPI in a specially
> formatted comment in the ebuild's header. No syntax has been suggested
> yet, but I believe that the following would work as a specification:
> - The EAPI must be declared in a special comment in the first line of
>   the ebuild's header, as follows:
> - The first line of the ebuild must contain the word "ebuild",
>   followed by whitespace, followed by the EAPI, followed by
>   end-of-line or whitespace.
> 
> Again, the proposal comes in two variants:
> 2a) It is combined with a one time change of the file extension, like
>     .ebuild -> .eb.
> 2b) The usual EAPI assignment statement in the ebuild is still
>     required, at least for a transition period.
> 
> In the 2a case, the EAPI variable could be made read-only in bash
> before sourcing the ebuild. In the 2b case, a sanity check similar to
> the one mentioned above would be added.
> 
> 
> What do you think?
> 
> (I really hope for a constructive discussion here. So, if you want
> to comment that all of the above proposals suck and GLEP 55 is much
> superior, then please open a new thread for it.)
> 
> Ulrich
> 

Currently 5 proposals are listed on the wiki. [4]

While all of them have some temptations the actual goal is to make
obtaining the EAPI the very first step so everything else can be
defined in terms of EAPI and so immediately deployable in future. This
are changes in atom syntax like needed for GLEP 54 or those bash
feature often mentioned besides many other things one can think of. 

GLEP 55 requires changing ebuild extensions on a regular basis but
doesn't impose any limit on the ebuild format or atom syntax, only the
file extensions would be imposed. The ebuild extensions for GLEP 55
would likely always be ebuild-<integer> as integers are reserved for
future use by Gentoo. While for example .ebuild-5 is still recognised
as an ebuild; .eb .ebld .ebd .bld .dliube .dlbe .be are not. This
brings me to the point if not GLEP 55 then only if we can keep .ebuild.
That one-time extension change thingy smells like being stubborn.

If we aren't going to to change the extension the most sensible thing
is to pack the eapi into the ebuild as done now but get rid of as many
limitations as possible. Looking at the proposals for eapi specification
in ebuilds the header comment is the clear winner here. The eapi can
also instruct the package manager to remove the first line for further
use of the ebuild if required for obscure formats / languages.

I already ruled out proposal "3 EAPI in header comment and one-time
change of file extension" for me as an option, see above. And "2 EAPI
in header comment" comes with compatibility issues for an undefined
amount of time.
If we want to keep .ebuild but avoid the compat issue another variant
would be "EAPI in header comment and one-time change of ebuild
location" or more formal:

6 EAPI in header comment and one-time change of ebuild location:

- add a directory $CATEGORY/$PN/ebuilds to ebuild repositories.
- all files in $CATEGORY/$PN/ebuilds are ebuilds and are using a well
  defined first line to denote the EAPI.
- For practical reasons the header should be a bash comment. PMs
  shouldn't have to remove or skip first line from file for further
  processing of ebuilds supporting bash comments.
- the .ebuild extension can be kept but could be changed if ever
  desired. This due to the filename only having meaning if the
  EAPI of the file is known.

Comparing this with GLEP 55 then this allows us to keep .ebuild in
return of some overhead with roughly the same pros and cons otherwise,
right?

Ralph


> 
> [1] <http://www.gentoo.org/proj/en/glep/glep-0055.html#problem>
> [2]
> <http://www.gentoo.org/proj/en/council/meeting-logs/20100823-summary.txt>
> [3] <https://bugs.gentoo.org/show_bug.cgi?id=402167>
> 
[4] <http://wiki.gentoo.org/wiki/Alternate_EAPI_mechanisms>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  parent reply	other threads:[~2012-03-18  7:24 UTC|newest]

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 20:41 [gentoo-dev] RFD: EAPI specification in ebuilds Ulrich Mueller
2012-03-07 20:44 ` Ciaran McCreesh
2012-03-07 21:07 ` Alexis Ballier
2012-03-07 22:04   ` David Leverton
2012-03-07 22:14 ` Michael Orlitzky
2012-03-08  0:17   ` Ulrich Mueller
2012-03-08 12:03   ` Michał Górny
2012-03-08 15:56     ` Michael Orlitzky
2012-03-08 17:28       ` Michał Górny
2012-03-08 17:48         ` Michael Orlitzky
2012-03-08 17:53           ` Ciaran McCreesh
2012-03-08 18:37             ` Michael Orlitzky
2012-03-08 18:48               ` Ciaran McCreesh
2012-03-08 21:35                 ` Michael Orlitzky
2012-03-08 23:31                   ` Alec Warner
2012-03-09  3:05                     ` Michael Orlitzky
2012-03-09  5:04                   ` Michał Górny
2012-03-09  5:35                     ` Michael Orlitzky
2012-03-09  5:51                       ` Zac Medico
2012-03-09 14:42                         ` Michael Orlitzky
2012-03-09 15:05                           ` Zac Medico
2012-03-09 15:21                             ` Michael Orlitzky
2012-03-09 15:41                               ` Zac Medico
2012-03-09 15:51                                 ` Alexis Ballier
2012-03-09 15:58                                   ` Zac Medico
2012-03-09 16:49                                     ` Michael Orlitzky
2012-03-09 16:57                                       ` Zac Medico
2012-03-09 19:20                                       ` Ciaran McCreesh
2012-03-10 16:06                                         ` Zac Medico
2012-03-12  1:55                                           ` Brian Harring
2012-03-12  4:08                                             ` Zac Medico
2012-03-12  8:36                                               ` Brian Harring
2012-03-12 15:35                                                 ` Ciaran McCreesh
2012-03-12 16:05                                                 ` Zac Medico
2012-03-12 16:12                                                   ` Ciaran McCreesh
2012-03-12 16:28                                                     ` Zac Medico
2012-03-14  2:01                                                   ` Brian Harring
2012-03-14  2:16                                                     ` Zac Medico
2012-03-09 15:52                                 ` Ian Stakenvicius
2012-03-09 16:15                                   ` Zac Medico
2012-03-09 16:33                                     ` Eray Aslan
2012-03-09 16:43                                       ` Zac Medico
2012-03-09 16:29                       ` Michał Górny
2012-03-09 16:57                         ` Michael Orlitzky
2012-03-09 17:11                           ` Ulrich Mueller
2012-03-09 17:31                             ` Michael Orlitzky
2012-03-09 17:47                               ` Zac Medico
2012-03-09 18:03                                 ` Michael Orlitzky
2012-03-09 19:08                                 ` Rich Freeman
2012-03-12  2:03                                 ` Brian Harring
2012-03-12  2:20                                   ` Rich Freeman
2012-03-12  2:24                                     ` Alec Warner
2012-03-12  6:57                                       ` Kent Fredric
2012-03-12  6:50                                     ` Kent Fredric
2012-03-12  7:08                                       ` Zac Medico
2012-03-12  7:39                                         ` Kent Fredric
2012-03-12  8:27                                         ` Michał Górny
2012-03-12  8:30                                           ` Ciaran McCreesh
2012-03-12  9:09                                             ` Michał Górny
2012-03-12  9:16                                               ` Kent Fredric
2012-03-12  9:48                                                 ` Ulrich Mueller
2012-03-12 10:12                                                   ` Kent Fredric
2012-03-12 15:20                                                     ` Rich Freeman
2012-03-12 17:01                                                 ` Zac Medico
2012-03-12 17:30                                                   ` Rich Freeman
2012-03-12 17:46                                                     ` Zac Medico
2012-03-12 19:20                                                       ` Rich Freeman
2012-03-12  8:39                                           ` Kent Fredric
2012-03-12  9:10                                             ` Michał Górny
2012-03-12  3:55                                   ` Zac Medico
2012-03-09 17:52                               ` Michał Górny
2012-03-12  1:00                                 ` Brian Harring
2012-03-09 18:02                               ` James Broadhead
2012-03-09 18:24                                 ` Alexis Ballier
2012-03-09 18:29                                   ` Zac Medico
2012-03-09 18:33                                 ` Michael Orlitzky
2012-03-09 18:56                                   ` Zac Medico
2012-03-09 19:23                                     ` Ciaran McCreesh
2012-03-09 20:09                                     ` Michael Orlitzky
2012-03-19  1:12                 ` [gentoo-dev] " Steven J Long
2012-03-19  1:36                   ` Kent Fredric
2012-03-19  3:21                     ` Brian Harring
2012-03-24 13:24                     ` [gentoo-dev] " Steven J Long
2012-03-07 22:36 ` [gentoo-dev] " Alexandre Rostovtsev
2012-03-08  2:22   ` Jeroen Roovers
2012-03-08 16:14     ` [gentoo-dev] Ebb (eb) was: " Todd Goodman
2012-03-08  4:12 ` [gentoo-dev] " Alec Warner
2012-03-08  7:27   ` Ulrich Mueller
2012-03-08  8:13     ` Alec Warner
2012-03-08 15:27       ` Zac Medico
2012-03-08 16:11         ` David Leverton
2012-03-08 16:21           ` Zac Medico
2012-03-08 16:29             ` Ciaran McCreesh
2012-03-08 16:50               ` Zac Medico
2012-03-08 16:59               ` Alexandre Rostovtsev
2012-03-08 17:03                 ` Ciaran McCreesh
2012-03-08 19:17                   ` Ulrich Mueller
2012-03-08 19:31                     ` Ciaran McCreesh
2012-03-08 19:48                       ` Alexis Ballier
2012-03-08  9:42     ` Marc Schiffbauer
2012-03-08 16:30       ` Zac Medico
2012-03-08 16:35         ` Ciaran McCreesh
2012-03-08 17:07           ` Zac Medico
2012-03-08 17:14             ` Ciaran McCreesh
2012-03-08 17:30               ` Jeroen Roovers
2012-03-08 17:37                 ` Ciaran McCreesh
2012-03-10  1:06                 ` Kent Fredric
2012-03-10 13:53                   ` Ciaran McCreesh
2012-03-09 11:28         ` Marc Schiffbauer
2012-03-08 12:06   ` Michał Górny
2012-03-08 15:58 ` Michael Orlitzky
2012-03-08 16:51   ` Ulrich Mueller
2012-03-08 17:03     ` Rich Freeman
2012-03-08 16:47 ` Mike Gilbert
2012-03-08 17:52 ` Michał Górny
2012-03-08 17:56   ` Ciaran McCreesh
2012-03-08 18:22   ` Zac Medico
2012-03-08 19:04   ` Ulrich Mueller
2012-03-08 19:38     ` Alexis Ballier
2012-03-09  0:50 ` Walter Dnes
2012-03-18  7:23 ` Ralph Sennhauser [this message]
2012-03-18 11:18   ` Rich Freeman
2012-03-18 11:27   ` Ulrich Mueller
2012-04-12 19:53 ` [gentoo-dev] " Ulrich Mueller
2012-04-12 20:19   ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120318082343.4d74340b@sera-17.lan \
    --to=sera@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox