All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: "Virtual" native and sdk recipes
@ 2009-01-01 16:25 Richard Purdie
  2009-01-01 18:11 ` Koen Kooi
                   ` (5 more replies)
  0 siblings, 6 replies; 35+ messages in thread
From: Richard Purdie @ 2009-01-01 16:25 UTC (permalink / raw)
  To: openembedded-devel

Its nice to try something a bit different occasionally. For a long time
the mechanical repetitive nature of -native and -sdk recipes has
bothered me and people have talked about getting rid of them since
forever. I've had ideas floating around on how to address this for a
while and I now have a proper proposal and better still a proof of
concept.

Some -native recipes are already very simple, others are quite complex.
My hypothetical foo package files contain some common constructs and
look like:

foo/foo.inc:

SRC_URI = "http://somwehere/foo-${PV}.tar.bz2 \
           file://some.patch;patch=1"
S = "${WORKDIR}/foo-${PV}
inherit autotools

foo/foo_1.0.bb:

require foo.inc

foo/foo-native_1.0.bb:
require foo_${PV}.bb
FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/foo-${PV}"
inherit native

and foo/foo-1.0/some.patch exists.


Proposal Step A:

Having to set:

FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/foo-${PV}"

and

S = "${WORKDIR}/foo-${PV}

is fairly pointless and it would be nice the the defaults just did the
right thing. 

http://git.pokylinux.org/cgit.cgi/poky/commit/?h=experimental-virtualnative&id=b8f0510a5567f6d1b90934fe513fd40423f11086

is a patch introducing BASEPN which is PN with a range of specified
suffixes removed (-native, -cross-sdk, -cross, -sdk as specified by
SPECIAL_PKGSUFFIX).

FILESPATH and S can then be constructed with BASEPN instead of PN
removing the need to need to hardcode them:

http://git.pokylinux.org/cgit.cgi/poky/commit/?h=experimental-virtualnative&id=ed829661d51b8f23628e97404ed507c2e56d8495

This reduces my hypothetical example to:

foo/foo.inc:

SRC_URI = "http://somwehere/${BASEPN}-${PV}.tar.bz2 \
           file://some.patch;patch=1"
inherit autotools

foo/foo-native_1.0.bb:
require foo_${PV}.bb
inherit native

The above proposal is worthwhile in itself alone.


Proposal Step B:

To add a new variable which is a list of classes to additionally parse
after parsing the 'base' recipe. In the above example, foo-native-1.0.bb
would be removed and we'd instead have:

foo/foo.inc:

SRC_URI = "http://somwehere/${BASEPN}-${PV}.tar.bz2 \
           file://some.patch;patch=1"
inherit autotools
BBCLASSEXTEND = "native"

Internally bitbake would see BBCLASSEXTEND and do something like:

"""
cls = value in BBCLASSEXTEND
data.setVar('PN', pn + '-' + cls, based)
inherit cls
"""

The big change here is that one .bb file can now provide multiple
targets. This causes a few issues but as a hacked up proof of concept:

http://git.pokylinux.org/cgit.cgi/poky/commit/?h=experimental-virtualnative&id=f614d1e2ff10938167ba6c29c49677a03b4a19ef

where we append magic values to the "filename" and inherit the
appropriate class when we notice the special names.


The advantages of doing this are:

* We can convert to the system incrementally
* Simple syntax, the complexity is hidden in bitbake
* Removes needless duplication but allows custom -native and -sdk 
  packages to be used where automation isn't possible/desirable
* Parsing speed should increase since the number of full recipes we 
  parse drops and only the end stage of parsing is done for the 
  BBCLASSEXTEND packages.
* Even just step A simplifies recipes.

The disadvantages:

* More complexity in bitbake (but localised mainly to cache.py)
* The .bb file is no longer one recipe but can run in different 
  flavours which will be confusing to people 
* Would require a new bitbake release and adoption of that release 
  before OE.dev can use step B functionality. Step A functionality 
  could be added without a new bitbake by putting the special function 
  in base.bbclass instead of bitbake.
* Certain recipe name extensions become "special". The values are not 
  hardcoded in bitbake though and its already a common convention so 
  I'm not sure this is a problem.


I've shared my changes in a branch of Poky:

http://git.pokylinux.org/cgit.cgi/poky/log/?h=experimental-virtualnative

Obviously there are some heavy cleanups needed to the last bitbake
changes but it works as a proof of concept so its time to discuss it.

The main problem I currently have before being able to deploy this more
widely is auto adjustment of DEPENDS. In most cases this consists of
adding "-native" or "-sdk" to the values already in DEPENDS so we could
probably add a function to native.bbclass for that. Alternatively or
additionally, I'm considering having native.bbclass append to OVERRIDES
so we can override DEPENDS that way instead.

Comments welcome.

Cheers,

Richard

-- 
Richard Purdie
Intel Open Source Technology Centre




^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2009-01-28 19:57 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-01 16:25 RFC: "Virtual" native and sdk recipes Richard Purdie
2009-01-01 18:11 ` Koen Kooi
2009-01-01 20:07   ` Richard Purdie
2009-01-01 18:25 ` Tom Rini
2009-01-01 20:11   ` Richard Purdie
2009-01-01 22:02     ` Tom Rini
2009-01-02  1:11       ` Richard Purdie
2009-01-02  4:37         ` Native/Cross/SDK rethink (Was: Re: RFC: "Virtual" native and sdk recipes) Tom Rini
2009-01-05 14:31           ` Esben Haabendal
2009-01-05 15:42             ` Tom Rini
2009-01-05 17:29             ` Koen Kooi
2009-01-05 19:53               ` Tom Rini
2009-01-06 20:51               ` Esben Haabendal
2009-01-07  0:14                 ` Richard Purdie
2009-01-07  0:45                   ` Tom Rini
2009-01-08 22:59                   ` Leon Woestenberg
2009-01-09  0:54         ` RFC: "Virtual" native and sdk recipes Richard Purdie
2009-01-09  1:16           ` Tom Rini
2009-01-12 19:09             ` Tom Rini
2009-01-12 20:30             ` Esben Haabendal
2009-01-09 17:04           ` Tom Rini
2009-01-12 20:47             ` Tom Rini
2009-01-10 15:33           ` Tom Rini
2009-01-10 19:06             ` Tom Rini
2009-01-14  1:15           ` Tom Rini
2009-01-14 23:17             ` Tom Rini
2009-01-17  2:54               ` Tom Rini
2009-01-17  4:47           ` Tom Rini
2009-01-22 18:10             ` Tom Rini
2009-01-28 19:49               ` Tom Rini
2009-01-01 22:15 ` Tom Rini
2009-01-01 23:19 ` Richard Purdie
2009-01-03 11:17   ` Richard Purdie
2009-01-02 12:58 ` Koen Kooi
2009-01-14  0:03 ` Robert Schuster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.