On 03/12/2012 02:16 AM, Kent Fredric wrote: > I just find a top-down regexp solution dangerously naive, as its > infering that the first line that matches the regexp *is* the EAPI > requirement field, when depending on the actual format used, that may > not be the case. > > If for example, a format is machine generated, and the EAPI > declaration accidentally comes after something that *isnt* an EAPI > declaration but by the regexp, LOOKS like one, then the probing > mechanism will resolve the WRONG value. > > And that doesn't strike me as being very resilient.
It would be very fragile without the sanity check / feedback mechanism that's already been suggested [1]. The idea is to compare the probed EAPI with the result that's obtained from bash, and treat the ebuild as invalid if they are not identical. This would allow ebuilds that don't fit our EAPI probing mechanism to be immediately detected so that the ebuild developer could fix them. In practice, this will not be much of an issue, since the EAPI assignment will be required to be very close to the top of the file, and the package manager will stop searching as soon as it finds the first match. [1] https://bugs.gentoo.org/show_bug.cgi?id=402167#c18 -- Thanks, Zac