bitbake: several fixes
cover bitbake: several fixes
The following changes since commit 3cf2d232529c4fd6b58f87ddbf3df9d805e4180f:
libsoup-2.4: add intltool-native to DEPENDS (2013-12-20 09:29:05 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/dora-next-bitbake
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/dora-next-bitbake
Richard Purdie (4):
bitbake: runqueue/bitbake-worker: Fix dry run fakeroot issues
bitbake: data: Fix output inconsistencies for emit_var
bitbake: parse/ConfHander/BBHandler/utils: Fix cache dependency bugs
bitbake: imagedetailspage: Fix crash with more than 15 layers
bitbake/bin/bitbake-worker | 3 ++- bitbake/lib/bb/data.py | 4 ++-- bitbake/lib/bb/parse/__init__.py | 19 +++++++++++++++---- bitbake/lib/bb/parse/parse_py/BBHandler.py | 5 ++++- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 9 ++++++++- bitbake/lib/bb/runqueue.py | 2 +- bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 2 +- bitbake/lib/bb/utils.py | 8 +++++++- 8 files changed, 40 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/4 bitbake: runqueue/bitbake-worker: Fix dry run fakeroot issues
From: Richard Purdie <[email protected]>
When using the dry run option (-n), bitbake would still try and fire a specific fakeroot worker. This is doomed to failure since it might well not have been built.
Add in some checks to prevent the failures.
[YOCTO #5367]
(Bitbake master rev: f34d0606f87ce9dacadeb78bac35879b74f10559)
--- bitbake/bin/bitbake-worker | 3 ++- bitbake/lib/bb/runqueue.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
bitbake/bin/bitbake-worker +2 -1
@@ -97,7 +97,8 @@ def fork_off_task(cfg, data, workerdata, fn, task, taskname, appends, quieterror except TypeError: umask = taskdep['umask'][taskname] - if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: + # We can't use the fakeroot environment in a dry run as it possibly hasn't been built + if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not cfg.dry_run: envvars = (workerdata["fakerootenv"][fn] or "").split() for key, value in (var.split('=') for var in envvars): envbackup[key] = os.environ.get(key)
bitbake/lib/bb/runqueue.py +1 -1
@@ -1408,7 +1408,7 @@ class RunQueueExecuteTasks(RunQueueExecute): bb.event.fire(startevent, self.cfgData) taskdep = self.rqdata.dataCache.task_deps[fn] - if 'fakeroot' in taskdep and taskname in taskdep['fakeroot']: + if 'fakeroot' in taskdep and taskname in taskdep['fakeroot'] and not self.cooker.configuration.dry_run: if not self.rq.fakeworker: self.rq.start_fakeworker(self) self.rq.fakeworker.stdin.write("<runtask>" + pickle.dumps((fn, task, taskname, False, self.cooker.collection.get_file_appends(fn))) + "</runtask>")
Signature · 1 line
1.7.10.4
PATCH 2/4 bitbake: data: Fix output inconsistencies for emit_var
In reply to Robert YangFrom: Richard Purdie <[email protected]>
VAL = "" (not shown) VAL = " " (shown as "") VAL = " x" (shown as "x")
would all show up rather differently to what would be expected in the bitbake -e output. This fixes things so they appear consistently.
The output for running some shell functions may also change slightly but shouldn't change in a way that is likely to cause problems.
[YOCTO #5507]
(Bitbake master rev: fcba5ef0053dc0ef5360e4912609e5d52f5046b0)
--- bitbake/lib/bb/data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/data.py +2 -2
@@ -214,7 +214,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): o.write('unset %s\n' % varExpanded) return 0 - if not val: + if val is None: return 0 val = str(val)
@@ -229,7 +229,7 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): # if we're going to output this within doublequotes, # to a shell, we need to escape the quotes in the var - alter = re.sub('"', '\\"', val.strip()) + alter = re.sub('"', '\\"', val) alter = re.sub('\n', ' \\\n', alter) o.write('%s="%s"\n' % (varExpanded, alter)) return 0
Signature · 1 line
1.7.10.4
PATCH 3/4 bitbake: parse/ConfHander/BBHandler/utils: Fix cache dependency bugs
In reply to Robert YangFrom: Richard Purdie <[email protected]>
Currently bitbake only adds files to its dependency list if they exist. If you add 'include foo.inc' to your recipe and the file doesn't exist, then later you add the file, the cache will not be invalidated.
This leads to another bug which is that if files don't exist and then you add them and they should be found first due to BBPATH, again the cache won't invalidate.
This patch adds in tracking of files we check for the existence of so that if they are added later, the cache correctly invalidates. This necessitated a new version of bb.utils.which which returns a list of files tested for.
The patch also adds in checks for duplicate file includes and for now prints a warning about this. That will likely become a fatal error at some point since its never usually desired to include a file twice.
The same issue is also fixed for class inheritance. Now when a class is added which would be found in the usual search path, it will cause the cache to be invalidated.
Unfortunately this is old code in bitbake and the patch isn't the neatest since we have to work within that framework.
[YOCTO #5611]
[YOCTO #4425]
(Bitbake master rev: 78d285871e4b8c54ccc4602d571e85f922e37ccd)
--- bitbake/lib/bb/parse/__init__.py | 19 +++++++++++++++---- bitbake/lib/bb/parse/parse_py/BBHandler.py | 5 ++++- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 9 ++++++++- bitbake/lib/bb/utils.py | 8 +++++++- 4 files changed, 34 insertions(+), 7 deletions(-)
bitbake/lib/bb/parse/__init__.py +15 -4
@@ -73,9 +73,17 @@ def update_mtime(f): def mark_dependency(d, f): if f.startswith('./'): f = "%s/%s" % (os.getcwd(), f[2:]) - deps = (d.getVar('__depends') or []) + [(f, cached_mtime(f))] - d.setVar('__depends', deps) - + deps = (d.getVar('__depends') or []) + s = (f, cached_mtime_noerror(f)) + if s not in deps: + deps.append(s) + d.setVar('__depends', deps) + +def check_dependency(d, f): + s = (f, cached_mtime_noerror(f)) + deps = (d.getVar('__depends') or []) + return s in deps + def supports(fn, data): """Returns true if we have a handler for this file, false otherwise""" for h in handlers:
@@ -102,11 +110,14 @@ def init_parser(d): def resolve_file(fn, d): if not os.path.isabs(fn): bbpath = d.getVar("BBPATH", True) - newfn = bb.utils.which(bbpath, fn) + newfn, attempts = bb.utils.which(bbpath, fn, history=True) + for af in attempts: + mark_dependency(d, af) if not newfn: raise IOError("file %s not found in %s" % (fn, bbpath)) fn = newfn + mark_dependency(d, fn) if not os.path.isfile(fn): raise IOError("file %s not found" % fn)
bitbake/lib/bb/parse/parse_py/BBHandler.py +4 -1
@@ -77,7 +77,10 @@ def inherit(files, fn, lineno, d): if not os.path.isabs(file): dname = os.path.dirname(fn) bbpath = "%s:%s" % (dname, d.getVar("BBPATH", True)) - abs_fn = bb.utils.which(bbpath, file) + abs_fn, attempts = bb.utils.which(bbpath, file, history=True) + for af in attempts: + if af != abs_fn: + bb.parse.mark_dependency(d, af) if abs_fn: file = abs_fn
bitbake/lib/bb/parse/parse_py/ConfHandler.py +8 -1
@@ -82,9 +82,15 @@ def include(oldfn, fn, lineno, data, error_out): if not os.path.isabs(fn): dname = os.path.dirname(oldfn) bbpath = "%s:%s" % (dname, data.getVar("BBPATH", True)) - abs_fn = bb.utils.which(bbpath, fn) + abs_fn, attempts = bb.utils.which(bbpath, fn, history=True) + if abs_fn and bb.parse.check_dependency(data, abs_fn): + bb.warn("Duplicate inclusion for %s in %s" % (abs_fn, data.getVar('FILE', True))) + for af in attempts: + bb.parse.mark_dependency(data, af) if abs_fn: fn = abs_fn + elif bb.parse.check_dependency(data, fn): + bb.warn("Duplicate inclusion for %s in %s" % (fn, data.getVar('FILE', True))) from bb.parse import handle try:
@@ -93,6 +99,7 @@ def include(oldfn, fn, lineno, data, error_out): if error_out: raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) logger.debug(2, "CONF file '%s' not found", fn) + bb.parse.mark_dependency(data, fn) # We have an issue where a UI might want to enforce particular settings such as # an empty DISTRO variable. If configuration files do something like assigning
bitbake/lib/bb/utils.py +7 -1
@@ -793,22 +793,28 @@ def copyfile(src, dest, newmtime = None, sstat = None): newmtime = sstat[stat.ST_MTIME] return newmtime -def which(path, item, direction = 0): +def which(path, item, direction = 0, history = False): """ Locate a file in a PATH """ + hist = [] paths = (path or "").split(':') if direction != 0: paths.reverse() for p in paths: next = os.path.join(p, item) + hist.append(next) if os.path.exists(next): if not os.path.isabs(next): next = os.path.abspath(next) + if history: + return next, hist return next + if history: + return "", hist return "" def to_boolean(string, default=None):
Signature · 1 line
1.7.10.4
PATCH 4/4 bitbake: imagedetailspage: Fix crash with more than 15 layers
In reply to Robert YangFrom: Richard Purdie <[email protected]>
If you had more than 15 layers the system would crash since one more value is added to one array than the other. This fixes the code so equal numbers of values are added to the arrays and hence doesn't crash when many layers are enabled.
(Bitbake master rev: 4e65463886a2ef245b2f8974e82e9cb942af224b)
--- bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/ui/crumbs/imagedetailspage.py +1 -1
@@ -355,9 +355,9 @@ class ImageDetailsPage (HobPage): vallist.append(base_image) i = 0 for layer in layers: - varlist.append(" - ") if i > layer_num_limit: break + varlist.append(" - ") i += 1 vallist.append("") i = 0
Signature · 1 line
1.7.10.4