From e2e6f6fe07049f33cb6348780fa975162752e421 Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 12 Dec 2013 13:38:32 +0100 Subject: initial commit of Enea Linux 3.1 Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau --- meta/classes/externalsrc.bbclass | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 meta/classes/externalsrc.bbclass (limited to 'meta/classes/externalsrc.bbclass') diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass new file mode 100644 index 0000000000..c759289701 --- /dev/null +++ b/meta/classes/externalsrc.bbclass @@ -0,0 +1,68 @@ +# Copyright (C) 2012 Linux Foundation +# Author: Richard Purdie +# Some code and influence taken from srctree.bbclass: +# Copyright (C) 2009 Chris Larson +# Released under the MIT license (see COPYING.MIT for the terms) +# +# externalsrc.bbclass enables use of an existing source tree, usually external to +# the build system to build a piece of software rather than the usual fetch/unpack/patch +# process. +# +# To use, add externalsrc to the global inherit and set EXTERNALSRC to point at the +# directory you want to use containing the sources e.g. from local.conf for a recipe +# called "myrecipe" you would do: +# +# INHERIT += "externalsrc" +# EXTERNALSRC_pn-myrecipe = "/path/to/my/source/tree" +# +# In order to make this class work for both target and native versions (or with +# multilibs/cross or other BBCLASSEXTEND variants), B is set to point to a separate +# directory under the work directory (split source and build directories). This is +# the default, but the build directory can be set to the source directory if +# circumstances dictate by setting EXTERNALSRC_BUILD to the same value, e.g.: +# +# EXTERNALSRC_BUILD_pn-myrecipe = "/path/to/my/source/tree" +# + +SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" + +def remove_tasks(tasks, deltasks, d): + for task in tasks: + deps = d.getVarFlag(task, "deps") + for preptask in deltasks: + if preptask in deps: + deps.remove(preptask) + d.setVarFlag(task, "deps", deps) + # Poking around bitbake internal variables is evil but there appears to be no better way :( + tasklist = d.getVar('__BBTASKS') or [] + for task in deltasks: + d.delVarFlag(task, "task") + if task in tasklist: + tasklist.remove(task) + d.setVar('__BBTASKS', tasklist) + +python () { + externalsrc = d.getVar('EXTERNALSRC', True) + if externalsrc: + d.setVar('S', externalsrc) + externalsrcbuild = d.getVar('EXTERNALSRC_BUILD', True) + if externalsrcbuild: + d.setVar('B', externalsrcbuild) + else: + d.setVar('B', '${WORKDIR}/${BPN}-${PV}/') + d.setVar('SRC_URI', '') + + tasks = filter(lambda k: d.getVarFlag(k, "task"), d.keys()) + covered = d.getVar("SRCTREECOVEREDTASKS", True).split() + + for task in tasks: + if task.endswith("_setscene"): + # sstate is never going to work for external source trees, disable it + covered.append(task) + else: + # Since configure will likely touch ${S}, ensure only we lock so one task has access at a time + d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock") + + remove_tasks(tasks, covered, d) +} + -- cgit v1.2.3-54-g00ecf