Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Michael Orlitzky <michael@...>
Subject: Re: RFD: EAPI specification in ebuilds
Date: Fri, 09 Mar 2012 00:35:14 -0500
On 03/09/2012 12:04 AM, Michał Górny wrote:
>>
>> This is of course isomorphic to requiring a specific EAPI=4 format,
>> but does allow you to do stupid things like x=`seq 4 4`; eapi $x; if
>> you want.
>
> What advantage does it give us? We still can't change ebuild syntax in
> global scope because bash will barf.
>

Not in EAPI=5, no, but once all PMs are using the eapi function we could.

The function can do any crazy thing you want. Right now, we need to 
source the entire ebuild to get at its environment. Before we source it 
for real, we just want to know the value of $EAPI. Since eapi() will be 
the first function called, it can be our interface to this variable. 
Here's a stupid but hopefully clear example:

   $ cat test.ebuild
   eapi 4
   HOMEPAGE="http://www.example.com/"
   echo "test.ebuild, current EAPI=${EAPI}"


   $ cat test-sourcer.sh
   #!/bin/bash

   function eapi() {
       if [ "$TELL_ME_YOUR_EAPI" == 1 ]; then
           exit $1
       fi
       export EAPI=$1
   }

   export TELL_ME_YOUR_EAPI=1
   `eval 'source test.ebuild'`
   echo "Found EAPI: $?"

   export TELL_ME_YOUR_EAPI=0
   source test.ebuild


This sources it once, which short-circuits at the eapi() call returning 
'4'. Then we source it a second time with EAPI=4, and see that it makes 
it past the call to eapi() where any incompatible features would be.

   $ ./test-sourcer.sh
   Found EAPI: 4
   test.ebuild, current EAPI=4



Replies:
Re: RFD: EAPI specification in ebuilds
-- Michał Górny
Re: RFD: EAPI specification in ebuilds
-- Zac Medico
References:
RFD: EAPI specification in ebuilds
-- Ulrich Mueller
Re: RFD: EAPI specification in ebuilds
-- Michael Orlitzky
Re: RFD: EAPI specification in ebuilds
-- Michał Górny
Re: RFD: EAPI specification in ebuilds
-- Michael Orlitzky
Re: RFD: EAPI specification in ebuilds
-- Michał Górny
Re: RFD: EAPI specification in ebuilds
-- Michael Orlitzky
Re: RFD: EAPI specification in ebuilds
-- Ciaran McCreesh
Re: RFD: EAPI specification in ebuilds
-- Michael Orlitzky
Re: RFD: EAPI specification in ebuilds
-- Ciaran McCreesh
Re: RFD: EAPI specification in ebuilds
-- Michael Orlitzky
Re: RFD: EAPI specification in ebuilds
-- Michał Górny
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: RFD: EAPI specification in ebuilds
Next by thread:
Re: RFD: EAPI specification in ebuilds
Previous by date:
Re: RFD: EAPI specification in ebuilds
Next by date:
Re: RFD: EAPI specification in ebuilds


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.