| Submitter | Zhenhua Luo |
|---|---|
| Date | Dec. 30, 2011, 2:59 a.m. |
| Message ID | <1325213976-17890-1-git-send-email-b19537@freescale.com> |
| Download | mbox | patch |
| Permalink | /patch/17817/ |
| State | Rejected |
| Headers | show |
Comments
On Fri, Dec 30, 2011 at 10:59:36AM +0800, b19537@freescale.com wrote: > From: Zhenhua Luo <b19537@freescale.com> > > Signed-off-by: Zhenhua Luo <b19537@freescale.com> Are you sure? I don't see them in http://git.openembedded.org/openembedded-core/tree/meta/classes or patch with them here http://patchwork.openembedded.org/project/oe-core/list/ but last time I've used srctree it failed like this: ERROR: Command execution failed: Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/bb/command.py", line 87, in runAsyncCommand commandmethod(self.cmds_async, self, options) File "/usr/lib64/python2.7/site-packages/bb/command.py", line 182, in buildFile command.cooker.buildFile(bfile, task) File "/usr/lib64/python2.7/site-packages/bb/cooker.py", line 989, in buildFile self.caches_array) File "/usr/lib64/python2.7/site-packages/bb/cache.py", line 410, in parse datastores = cls.load_bbfile(filename, appends, configdata) File "/usr/lib64/python2.7/site-packages/bb/cache.py", line 669, in load_bbfile bb_data = parse.handle(bbfile, bb_data) File "/usr/lib64/python2.7/site-packages/bb/parse/__init__.py", line 80, in handle return h['handle'](fn, data, include) File "/usr/lib64/python2.7/site-packages/bb/parse/parse_py/BBHandler.py", line 159, in handle return ast.multi_finalize(fn, d) File "/usr/lib64/python2.7/site-packages/bb/parse/ast.py", line 379, in multi_finalize finalize(fn, d) File "/usr/lib64/python2.7/site-packages/bb/parse/ast.py", line 323, in finalize bb.utils.simple_exec("\n".join(code), {"d": d}) File "/usr/lib64/python2.7/site-packages/bb/utils.py", line 387, in simple_exec exec(code, _context, context) File "<string>", line 9, in <module> File "__anon_98__OE_shr_core_meta_openembedded_meta_oe_classes_srctree_bbclass", line 5, in __anon_98__OE_shr_core_meta_openembedded_meta_oe_classes_srctree_bbclass File "srctree.bbclass", line 28, in merge_tasks File "srctree.bbclass", line 24, in gather_taskdeps File "srctree.bbclass", line 18, in __gather_taskdeps File "srctree.bbclass", line 18, in __gather_taskdeps File "srctree.bbclass", line 18, in __gather_taskdeps File "srctree.bbclass", line 18, in __gather_taskdeps File "srctree.bbclass", line 18, in __gather_taskdeps File "srctree.bbclass", line 16, in __gather_taskdeps TypeError: 'NoneType' object is not iterable And unfortunately syntax like this INHERIT_append_pn-libphone-ui-shr = "srctree gitpkgv" doesn't work too anymore (that's why I didn't notice sooner), so instead of small .inc file for "local" builds you have to add .bbappend Regards, > meta-oe/classes/gitver.bbclass | 80 ------------------------- > meta-oe/classes/srctree.bbclass | 123 --------------------------------------- > 2 files changed, 0 insertions(+), 203 deletions(-) > delete mode 100644 meta-oe/classes/gitver.bbclass > delete mode 100644 meta-oe/classes/srctree.bbclass > > diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass > deleted file mode 100644 > index ee8323d..0000000 > --- a/meta-oe/classes/gitver.bbclass > +++ /dev/null > @@ -1,80 +0,0 @@ > -# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> > -# Released under the MIT license (see COPYING.MIT for the terms) > -# > -# gitver.bbclass provides a GITVER variable which is a (fairly) sane version, > -# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one. > -# This is most useful in concert with srctree.bbclass. > - > -def git_drop_tag_prefix(version): > - import re > - if re.match("v\d", version): > - return version[1:] > - else: > - return version > - > -GIT_TAGADJUST = "git_drop_tag_prefix(version)" > -GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" > -GITSHA = "${@get_git_hash('${S}', d)}" > - > -def get_git_hash(path, d): > - return oe_run(d, ["git", "rev-parse", "--short", "HEAD"], cwd=path).rstrip() > - > -def get_git_pv(path, d, tagadjust=None): > - import os > - import oe.process > - > - gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) > - def git(cmd): > - try: > - return oe_run(d, ["git"] + cmd, cwd=gitdir).rstrip() > - except oe.process.CmdError, exc: > - bb.fatal(str(exc)) > - > - try: > - ver = oe_run(d, ["git", "describe", "--tags"], cwd=gitdir).rstrip() > - except Exception, exc: > - bb.fatal(str(exc)) > - > - if not ver: > - try: > - ver = get_git_hash(gitdir, d) > - except Exception, exc: > - bb.fatal(str(exc)) > - > - if ver: > - return "0.0+%s" % ver > - else: > - return "0.0" > - else: > - if tagadjust: > - ver = tagadjust(ver) > - return ver > - > -def mark_recipe_dependencies(path, d): > - from bb.parse import mark_dependency > - > - gitdir = os.path.join(path, ".git") > - > - # Force the recipe to be reparsed so the version gets bumped > - # if the active branch is switched, or if the branch changes. > - mark_dependency(d, os.path.join(gitdir, "HEAD")) > - > - # Force a reparse if anything in the index changes. > - mark_dependency(d, os.path.join(gitdir, "index")) > - > - try: > - ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], cwd=gitdir).rstrip() > - except oe.process.CmdError: > - pass > - else: > - if ref: > - mark_dependency(d, os.path.join(gitdir, ref)) > - > - # Catch new tags. > - tagdir = os.path.join(gitdir, "refs", "tags") > - if os.path.exists(tagdir): > - mark_dependency(d, tagdir) > - > -python () { > - mark_recipe_dependencies(d.getVar("S", True), d) > -} > diff --git a/meta-oe/classes/srctree.bbclass b/meta-oe/classes/srctree.bbclass > deleted file mode 100644 > index 1457e56..0000000 > --- a/meta-oe/classes/srctree.bbclass > +++ /dev/null > @@ -1,123 +0,0 @@ > -# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> > -# Released under the MIT license (see COPYING.MIT for the terms) > -# > -# srctree.bbclass enables operation inside of an existing source tree for a > -# project, rather than using the fetch/unpack/patch idiom. > -# > -# By default, it expects that you're keeping the recipe(s) inside the > -# aforementioned source tree, but you could override S to point at an external > -# directory and place the recipes in a normal collection/overlay, if you so > -# chose. > -# > -# It also provides some convenience python functions for assembling your > -# do_clean, if you want to leverage things like 'git clean' to simplify the > -# operation. > - > - > -# Grab convenience methods & sane default for do_clean > -inherit clean > - > -# Build here > -S = "${FILE_DIRNAME}" > -SRC_URI = "" > - > -def remove_tasks(deltasks, d): > - for task in filter(lambda k: d.getVarFlag(k, "task"), d.keys()): > - deps = d.getVarFlag(task, "deps") > - for preptask in deltasks: > - if preptask in deps: > - deps.remove(preptask) > - d.setVarFlag(task, "deps", deps) > - > -addtask configure after do_setscene > - > -def merge_tasks(d): > - """ > - Merges all of the operations that occur prior to do_populate_sysroot > - into do_populate_sysroot. > - > - This is necessary because of recipe variants (normal, native, cross, > - sdk). If a bitbake run happens to want to build more than one of > - these variants in a single run, it's possible for them to step on one > - another's toes, due to the shared ${S}. Interleaved > - configure/compile/install amongst variants will break things badly. > - """ > - from itertools import chain > - from bb import note > - > - def __gather_taskdeps(task, seen): > - for dep in d.getVarFlag(task, "deps"): > - if not dep in seen: > - __gather_taskdeps(dep, seen) > - if not task in seen: > - seen.append(task) > - > - def gather_taskdeps(task): > - items = [] > - __gather_taskdeps(task, items) > - return items > - > - newtask = "do_populate_sysroot_post" > - mergedtasks = gather_taskdeps(newtask) > - mergedtasks.pop() > - > - for task in (key for key in d.keys() > - if d.getVarFlag(key, "task") and > - not key in mergedtasks): > - deps = d.getVarFlag(task, "deps") > - for mergetask in mergedtasks: > - if mergetask in (d.getVarFlag(task, "recrdeptask"), > - d.getVarFlag(task, "recdeptask"), > - d.getVarFlag(task, "deptask")): > - continue > - > - if mergetask in deps: > - deps.remove(mergetask) > - #note("removing dep on %s from %s" % (mergetask, task)) > - > - if not newtask in deps: > - #note("adding dep on %s to %s" % (newtask, task)) > - deps.append(newtask) > - d.setVarFlag(task, "deps", deps) > - > - # Pull cross recipe task deps over > - depends = [] > - deptask = [] > - for task in mergedtasks[:-1]: > - depends.append(d.getVarFlag(task, "depends") or "") > - deptask.append(d.getVarFlag(task, "deptask") or "") > - > - d.setVarFlag("do_populate_sysroot_post", "depends", " ".join(depends)) > - d.setVarFlag("do_populate_sysroot_post", "deptask", " ".join(deptask)) > - > -python () { > - remove_tasks(["do_patch", "do_unpack", "do_fetch"], d) > - b = d.getVar("B", True) > - if not b or b == d.getVar("S", True): > - merge_tasks(d) > -} > - > -# Manually run do_install & all of its deps > -python do_populate_sysroot_post () { > - from os.path import exists > - from bb.build import exec_func, make_stamp > - from bb import note > - > - stamp = d.getVar("STAMP", True) > - > - def rec_exec_task(task, seen): > - for dep in d.getVarFlag(task, "deps"): > - if not dep in seen: > - rec_exec_task(dep, seen) > - seen.add(task) > - if not exists("%s.%s" % (stamp, task)): > - note("%s: executing task %s" % (d.getVar("PF", True), task)) > - exec_func(task, d) > - flags = d.getVarFlags(task) > - if not flags.get('nostamp') and not flags.get('selfstamp'): > - make_stamp(task, d) > - > - rec_exec_task("do_populate_sysroot", set()) > -} > -addtask populate_sysroot_post after do_populate_sysroot > -do_populate_sysroot_post[lockfiles] += "${S}/.lock" > -- > 1.7.0.4 > > > > _______________________________________________ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Sorry for the mistake, please ignore the patch. Best Regards, Zhenhua > -----Original Message----- > From: openembedded-devel-bounces@lists.openembedded.org [mailto:openembedded- > devel-bounces@lists.openembedded.org] On Behalf Of Martin Jansa > Sent: Friday, December 30, 2011 4:58 PM > To: openembedded-devel@lists.openembedded.org > Subject: Re: [oe] [PATCH mete-oe] bbclass: drop gitver.bbclass amd > srctree.bbclass which are already in oe-core > > On Fri, Dec 30, 2011 at 10:59:36AM +0800, b19537@freescale.com wrote: > > From: Zhenhua Luo <b19537@freescale.com> > > > > Signed-off-by: Zhenhua Luo <b19537@freescale.com> > > Are you sure? > > I don't see them in > http://git.openembedded.org/openembedded-core/tree/meta/classes > or patch with them here > http://patchwork.openembedded.org/project/oe-core/list/ > but last time I've used srctree it failed like this: > > ERROR: Command execution failed: Traceback (most recent call last): > File "/usr/lib64/python2.7/site-packages/bb/command.py", line 87, in > runAsyncCommand > commandmethod(self.cmds_async, self, options) > File "/usr/lib64/python2.7/site-packages/bb/command.py", line 182, in > buildFile > command.cooker.buildFile(bfile, task) > File "/usr/lib64/python2.7/site-packages/bb/cooker.py", line 989, in buildFile > self.caches_array) > File "/usr/lib64/python2.7/site-packages/bb/cache.py", line 410, in parse > datastores = cls.load_bbfile(filename, appends, configdata) > File "/usr/lib64/python2.7/site-packages/bb/cache.py", line 669, in > load_bbfile > bb_data = parse.handle(bbfile, bb_data) > File "/usr/lib64/python2.7/site-packages/bb/parse/__init__.py", line 80, in > handle > return h['handle'](fn, data, include) > File "/usr/lib64/python2.7/site-packages/bb/parse/parse_py/BBHandler.py", line > 159, in handle > return ast.multi_finalize(fn, d) > File "/usr/lib64/python2.7/site-packages/bb/parse/ast.py", line 379, in > multi_finalize > finalize(fn, d) > File "/usr/lib64/python2.7/site-packages/bb/parse/ast.py", line 323, in > finalize > bb.utils.simple_exec("\n".join(code), {"d": d}) > File "/usr/lib64/python2.7/site-packages/bb/utils.py", line 387, in > simple_exec > exec(code, _context, context) > File "<string>", line 9, in <module> > File > "__anon_98__OE_shr_core_meta_openembedded_meta_oe_classes_srctree_bbclass", line > 5, in __anon_98__OE_shr_core_meta_openembedded_meta_oe_classes_srctree_bbclass > File "srctree.bbclass", line 28, in merge_tasks > File "srctree.bbclass", line 24, in gather_taskdeps > File "srctree.bbclass", line 18, in __gather_taskdeps > File "srctree.bbclass", line 18, in __gather_taskdeps > File "srctree.bbclass", line 18, in __gather_taskdeps > File "srctree.bbclass", line 18, in __gather_taskdeps > File "srctree.bbclass", line 18, in __gather_taskdeps > File "srctree.bbclass", line 16, in __gather_taskdeps > TypeError: 'NoneType' object is not iterable > > And unfortunately syntax like this > INHERIT_append_pn-libphone-ui-shr = "srctree gitpkgv" > doesn't work too anymore (that's why I didn't notice sooner), so instead of > small .inc file for "local" builds you have to add .bbappend > > Regards, > > > meta-oe/classes/gitver.bbclass | 80 ------------------------- > > meta-oe/classes/srctree.bbclass | 123 > > --------------------------------------- > > 2 files changed, 0 insertions(+), 203 deletions(-) delete mode > > 100644 meta-oe/classes/gitver.bbclass delete mode 100644 > > meta-oe/classes/srctree.bbclass > > > > diff --git a/meta-oe/classes/gitver.bbclass > > b/meta-oe/classes/gitver.bbclass deleted file mode 100644 index > > ee8323d..0000000 > > --- a/meta-oe/classes/gitver.bbclass > > +++ /dev/null > > @@ -1,80 +0,0 @@ > > -# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> -# Released > > under the MIT license (see COPYING.MIT for the terms) -# -# > > gitver.bbclass provides a GITVER variable which is a (fairly) sane > > version, -# for use in ${PV}, extracted from the ${S} git checkout, assuming > it is one. > > -# This is most useful in concert with srctree.bbclass. > > - > > -def git_drop_tag_prefix(version): > > - import re > > - if re.match("v\d", version): > > - return version[1:] > > - else: > > - return version > > - > > -GIT_TAGADJUST = "git_drop_tag_prefix(version)" > > -GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda > version:${GIT_TAGADJUST})}" > > -GITSHA = "${@get_git_hash('${S}', d)}" > > - > > -def get_git_hash(path, d): > > - return oe_run(d, ["git", "rev-parse", "--short", "HEAD"], > cwd=path).rstrip() > > - > > -def get_git_pv(path, d, tagadjust=None): > > - import os > > - import oe.process > > - > > - gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) > > - def git(cmd): > > - try: > > - return oe_run(d, ["git"] + cmd, cwd=gitdir).rstrip() > > - except oe.process.CmdError, exc: > > - bb.fatal(str(exc)) > > - > > - try: > > - ver = oe_run(d, ["git", "describe", "--tags"], cwd=gitdir).rstrip() > > - except Exception, exc: > > - bb.fatal(str(exc)) > > - > > - if not ver: > > - try: > > - ver = get_git_hash(gitdir, d) > > - except Exception, exc: > > - bb.fatal(str(exc)) > > - > > - if ver: > > - return "0.0+%s" % ver > > - else: > > - return "0.0" > > - else: > > - if tagadjust: > > - ver = tagadjust(ver) > > - return ver > > - > > -def mark_recipe_dependencies(path, d): > > - from bb.parse import mark_dependency > > - > > - gitdir = os.path.join(path, ".git") > > - > > - # Force the recipe to be reparsed so the version gets bumped > > - # if the active branch is switched, or if the branch changes. > > - mark_dependency(d, os.path.join(gitdir, "HEAD")) > > - > > - # Force a reparse if anything in the index changes. > > - mark_dependency(d, os.path.join(gitdir, "index")) > > - > > - try: > > - ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], > cwd=gitdir).rstrip() > > - except oe.process.CmdError: > > - pass > > - else: > > - if ref: > > - mark_dependency(d, os.path.join(gitdir, ref)) > > - > > - # Catch new tags. > > - tagdir = os.path.join(gitdir, "refs", "tags") > > - if os.path.exists(tagdir): > > - mark_dependency(d, tagdir) > > - > > -python () { > > - mark_recipe_dependencies(d.getVar("S", True), d) > > -} > > diff --git a/meta-oe/classes/srctree.bbclass > > b/meta-oe/classes/srctree.bbclass deleted file mode 100644 index > > 1457e56..0000000 > > --- a/meta-oe/classes/srctree.bbclass > > +++ /dev/null > > @@ -1,123 +0,0 @@ > > -# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> -# Released > > under the MIT license (see COPYING.MIT for the terms) -# -# > > srctree.bbclass enables operation inside of an existing source tree > > for a -# project, rather than using the fetch/unpack/patch idiom. > > -# > > -# By default, it expects that you're keeping the recipe(s) inside the > > -# aforementioned source tree, but you could override S to point at an > > external -# directory and place the recipes in a normal > > collection/overlay, if you so -# chose. > > -# > > -# It also provides some convenience python functions for assembling > > your -# do_clean, if you want to leverage things like 'git clean' to > > simplify the -# operation. > > - > > - > > -# Grab convenience methods & sane default for do_clean -inherit clean > > - > > -# Build here > > -S = "${FILE_DIRNAME}" > > -SRC_URI = "" > > - > > -def remove_tasks(deltasks, d): > > - for task in filter(lambda k: d.getVarFlag(k, "task"), d.keys()): > > - deps = d.getVarFlag(task, "deps") > > - for preptask in deltasks: > > - if preptask in deps: > > - deps.remove(preptask) > > - d.setVarFlag(task, "deps", deps) > > - > > -addtask configure after do_setscene > > - > > -def merge_tasks(d): > > - """ > > - Merges all of the operations that occur prior to do_populate_sysroot > > - into do_populate_sysroot. > > - > > - This is necessary because of recipe variants (normal, native, cross, > > - sdk). If a bitbake run happens to want to build more than one of > > - these variants in a single run, it's possible for them to step on one > > - another's toes, due to the shared ${S}. Interleaved > > - configure/compile/install amongst variants will break things badly. > > - """ > > - from itertools import chain > > - from bb import note > > - > > - def __gather_taskdeps(task, seen): > > - for dep in d.getVarFlag(task, "deps"): > > - if not dep in seen: > > - __gather_taskdeps(dep, seen) > > - if not task in seen: > > - seen.append(task) > > - > > - def gather_taskdeps(task): > > - items = [] > > - __gather_taskdeps(task, items) > > - return items > > - > > - newtask = "do_populate_sysroot_post" > > - mergedtasks = gather_taskdeps(newtask) > > - mergedtasks.pop() > > - > > - for task in (key for key in d.keys() > > - if d.getVarFlag(key, "task") and > > - not key in mergedtasks): > > - deps = d.getVarFlag(task, "deps") > > - for mergetask in mergedtasks: > > - if mergetask in (d.getVarFlag(task, "recrdeptask"), > > - d.getVarFlag(task, "recdeptask"), > > - d.getVarFlag(task, "deptask")): > > - continue > > - > > - if mergetask in deps: > > - deps.remove(mergetask) > > - #note("removing dep on %s from %s" % (mergetask, task)) > > - > > - if not newtask in deps: > > - #note("adding dep on %s to %s" % (newtask, task)) > > - deps.append(newtask) > > - d.setVarFlag(task, "deps", deps) > > - > > - # Pull cross recipe task deps over > > - depends = [] > > - deptask = [] > > - for task in mergedtasks[:-1]: > > - depends.append(d.getVarFlag(task, "depends") or "") > > - deptask.append(d.getVarFlag(task, "deptask") or "") > > - > > - d.setVarFlag("do_populate_sysroot_post", "depends", " ".join(depends)) > > - d.setVarFlag("do_populate_sysroot_post", "deptask", " ".join(deptask)) > > - > > -python () { > > - remove_tasks(["do_patch", "do_unpack", "do_fetch"], d) > > - b = d.getVar("B", True) > > - if not b or b == d.getVar("S", True): > > - merge_tasks(d) > > -} > > - > > -# Manually run do_install & all of its deps -python > > do_populate_sysroot_post () { > > - from os.path import exists > > - from bb.build import exec_func, make_stamp > > - from bb import note > > - > > - stamp = d.getVar("STAMP", True) > > - > > - def rec_exec_task(task, seen): > > - for dep in d.getVarFlag(task, "deps"): > > - if not dep in seen: > > - rec_exec_task(dep, seen) > > - seen.add(task) > > - if not exists("%s.%s" % (stamp, task)): > > - note("%s: executing task %s" % (d.getVar("PF", True), task)) > > - exec_func(task, d) > > - flags = d.getVarFlags(task) > > - if not flags.get('nostamp') and not flags.get('selfstamp'): > > - make_stamp(task, d) > > - > > - rec_exec_task("do_populate_sysroot", set()) > > -} > > -addtask populate_sysroot_post after do_populate_sysroot > > -do_populate_sysroot_post[lockfiles] += "${S}/.lock" > > -- > > 1.7.0.4 > > > > > > > > _______________________________________________ > > Openembedded-devel mailing list > > Openembedded-devel@lists.openembedded.org > > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel > > -- > Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
Patch
diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass deleted file mode 100644 index ee8323d..0000000 --- a/meta-oe/classes/gitver.bbclass +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> -# Released under the MIT license (see COPYING.MIT for the terms) -# -# gitver.bbclass provides a GITVER variable which is a (fairly) sane version, -# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one. -# This is most useful in concert with srctree.bbclass. - -def git_drop_tag_prefix(version): - import re - if re.match("v\d", version): - return version[1:] - else: - return version - -GIT_TAGADJUST = "git_drop_tag_prefix(version)" -GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" -GITSHA = "${@get_git_hash('${S}', d)}" - -def get_git_hash(path, d): - return oe_run(d, ["git", "rev-parse", "--short", "HEAD"], cwd=path).rstrip() - -def get_git_pv(path, d, tagadjust=None): - import os - import oe.process - - gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) - def git(cmd): - try: - return oe_run(d, ["git"] + cmd, cwd=gitdir).rstrip() - except oe.process.CmdError, exc: - bb.fatal(str(exc)) - - try: - ver = oe_run(d, ["git", "describe", "--tags"], cwd=gitdir).rstrip() - except Exception, exc: - bb.fatal(str(exc)) - - if not ver: - try: - ver = get_git_hash(gitdir, d) - except Exception, exc: - bb.fatal(str(exc)) - - if ver: - return "0.0+%s" % ver - else: - return "0.0" - else: - if tagadjust: - ver = tagadjust(ver) - return ver - -def mark_recipe_dependencies(path, d): - from bb.parse import mark_dependency - - gitdir = os.path.join(path, ".git") - - # Force the recipe to be reparsed so the version gets bumped - # if the active branch is switched, or if the branch changes. - mark_dependency(d, os.path.join(gitdir, "HEAD")) - - # Force a reparse if anything in the index changes. - mark_dependency(d, os.path.join(gitdir, "index")) - - try: - ref = oe_run(d, ["git", "symbolic-ref", "-q", "HEAD"], cwd=gitdir).rstrip() - except oe.process.CmdError: - pass - else: - if ref: - mark_dependency(d, os.path.join(gitdir, ref)) - - # Catch new tags. - tagdir = os.path.join(gitdir, "refs", "tags") - if os.path.exists(tagdir): - mark_dependency(d, tagdir) - -python () { - mark_recipe_dependencies(d.getVar("S", True), d) -} diff --git a/meta-oe/classes/srctree.bbclass b/meta-oe/classes/srctree.bbclass deleted file mode 100644 index 1457e56..0000000 --- a/meta-oe/classes/srctree.bbclass +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (C) 2009 Chris Larson <clarson@kergoth.com> -# Released under the MIT license (see COPYING.MIT for the terms) -# -# srctree.bbclass enables operation inside of an existing source tree for a -# project, rather than using the fetch/unpack/patch idiom. -# -# By default, it expects that you're keeping the recipe(s) inside the -# aforementioned source tree, but you could override S to point at an external -# directory and place the recipes in a normal collection/overlay, if you so -# chose. -# -# It also provides some convenience python functions for assembling your -# do_clean, if you want to leverage things like 'git clean' to simplify the -# operation. - - -# Grab convenience methods & sane default for do_clean -inherit clean - -# Build here -S = "${FILE_DIRNAME}" -SRC_URI = "" - -def remove_tasks(deltasks, d): - for task in filter(lambda k: d.getVarFlag(k, "task"), d.keys()): - deps = d.getVarFlag(task, "deps") - for preptask in deltasks: - if preptask in deps: - deps.remove(preptask) - d.setVarFlag(task, "deps", deps) - -addtask configure after do_setscene - -def merge_tasks(d): - """ - Merges all of the operations that occur prior to do_populate_sysroot - into do_populate_sysroot. - - This is necessary because of recipe variants (normal, native, cross, - sdk). If a bitbake run happens to want to build more than one of - these variants in a single run, it's possible for them to step on one - another's toes, due to the shared ${S}. Interleaved - configure/compile/install amongst variants will break things badly. - """ - from itertools import chain - from bb import note - - def __gather_taskdeps(task, seen): - for dep in d.getVarFlag(task, "deps"): - if not dep in seen: - __gather_taskdeps(dep, seen) - if not task in seen: - seen.append(task) - - def gather_taskdeps(task): - items = [] - __gather_taskdeps(task, items) - return items - - newtask = "do_populate_sysroot_post" - mergedtasks = gather_taskdeps(newtask) - mergedtasks.pop() - - for task in (key for key in d.keys() - if d.getVarFlag(key, "task") and - not key in mergedtasks): - deps = d.getVarFlag(task, "deps") - for mergetask in mergedtasks: - if mergetask in (d.getVarFlag(task, "recrdeptask"), - d.getVarFlag(task, "recdeptask"), - d.getVarFlag(task, "deptask")): - continue - - if mergetask in deps: - deps.remove(mergetask) - #note("removing dep on %s from %s" % (mergetask, task)) - - if not newtask in deps: - #note("adding dep on %s to %s" % (newtask, task)) - deps.append(newtask) - d.setVarFlag(task, "deps", deps) - - # Pull cross recipe task deps over - depends = [] - deptask = [] - for task in mergedtasks[:-1]: - depends.append(d.getVarFlag(task, "depends") or "") - deptask.append(d.getVarFlag(task, "deptask") or "") - - d.setVarFlag("do_populate_sysroot_post", "depends", " ".join(depends)) - d.setVarFlag("do_populate_sysroot_post", "deptask", " ".join(deptask)) - -python () { - remove_tasks(["do_patch", "do_unpack", "do_fetch"], d) - b = d.getVar("B", True) - if not b or b == d.getVar("S", True): - merge_tasks(d) -} - -# Manually run do_install & all of its deps -python do_populate_sysroot_post () { - from os.path import exists - from bb.build import exec_func, make_stamp - from bb import note - - stamp = d.getVar("STAMP", True) - - def rec_exec_task(task, seen): - for dep in d.getVarFlag(task, "deps"): - if not dep in seen: - rec_exec_task(dep, seen) - seen.add(task) - if not exists("%s.%s" % (stamp, task)): - note("%s: executing task %s" % (d.getVar("PF", True), task)) - exec_func(task, d) - flags = d.getVarFlags(task) - if not flags.get('nostamp') and not flags.get('selfstamp'): - make_stamp(task, d) - - rec_exec_task("do_populate_sysroot", set()) -} -addtask populate_sysroot_post after do_populate_sysroot -do_populate_sysroot_post[lockfiles] += "${S}/.lock"