bitbake: Introduce stamp-extra-info task flag into stamp filenames
For certain tasks, we need additional information in build stamp file other than the task name and file name. stamp-extra-info is introduced as a task flag which is appended to the stamp file name. [Code simplifcations/tweaks from Richard] Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
740ea68258
commit
80cf3e405c
|
@ -386,14 +386,16 @@ def stamp_internal(taskname, d, file_name):
|
||||||
"""
|
"""
|
||||||
if file_name:
|
if file_name:
|
||||||
stamp = d.stamp[file_name]
|
stamp = d.stamp[file_name]
|
||||||
|
extrainfo = d.stamp_extrainfo[file_name].get(taskname) or ""
|
||||||
else:
|
else:
|
||||||
stamp = d.getVar('STAMP', True)
|
stamp = d.getVar('STAMP', True)
|
||||||
file_name = d.getVar('BB_FILENAME', True)
|
file_name = d.getVar('BB_FILENAME', True)
|
||||||
|
extrainfo = d.getVarFlag(taskname, 'stamp-extra-info', True) or ""
|
||||||
|
|
||||||
if not stamp:
|
if not stamp:
|
||||||
return
|
return
|
||||||
|
|
||||||
stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname)
|
stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
|
||||||
|
|
||||||
bb.utils.mkdirhier(os.path.dirname(stamp))
|
bb.utils.mkdirhier(os.path.dirname(stamp))
|
||||||
|
|
||||||
|
@ -420,8 +422,12 @@ def del_stamp(task, d, file_name = None):
|
||||||
stamp = stamp_internal(task, d, file_name)
|
stamp = stamp_internal(task, d, file_name)
|
||||||
bb.utils.remove(stamp)
|
bb.utils.remove(stamp)
|
||||||
|
|
||||||
def stampfile(taskname, d):
|
def stampfile(taskname, d, file_name = None):
|
||||||
return stamp_internal(taskname, d, None)
|
"""
|
||||||
|
Return the stamp for a given task
|
||||||
|
(d can be a data dict or dataCache)
|
||||||
|
"""
|
||||||
|
return stamp_internal(taskname, d, file_name)
|
||||||
|
|
||||||
def add_tasks(tasklist, d):
|
def add_tasks(tasklist, d):
|
||||||
task_deps = data.getVar('_task_deps', d)
|
task_deps = data.getVar('_task_deps', d)
|
||||||
|
|
|
@ -43,7 +43,7 @@ except ImportError:
|
||||||
logger.info("Importing cPickle failed. "
|
logger.info("Importing cPickle failed. "
|
||||||
"Falling back to a very slow implementation.")
|
"Falling back to a very slow implementation.")
|
||||||
|
|
||||||
__cache_version__ = "134"
|
__cache_version__ = "135"
|
||||||
|
|
||||||
recipe_fields = (
|
recipe_fields = (
|
||||||
'pn',
|
'pn',
|
||||||
|
@ -55,6 +55,7 @@ recipe_fields = (
|
||||||
'provides',
|
'provides',
|
||||||
'task_deps',
|
'task_deps',
|
||||||
'stamp',
|
'stamp',
|
||||||
|
'stamp_extrainfo',
|
||||||
'broken',
|
'broken',
|
||||||
'not_world',
|
'not_world',
|
||||||
'skipped',
|
'skipped',
|
||||||
|
@ -101,6 +102,11 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
|
||||||
return dict((task, cls.getvar("%s_task-%s" % (var, task), metadata))
|
return dict((task, cls.getvar("%s_task-%s" % (var, task), metadata))
|
||||||
for task in tasks)
|
for task in tasks)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def flaglist(cls, flag, varlist, metadata):
|
||||||
|
return dict((var, metadata.getVarFlag(flag, var, True))
|
||||||
|
for var in varlist)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getvar(cls, var, metadata):
|
def getvar(cls, var, metadata):
|
||||||
return metadata.getVar(var, True) or ''
|
return metadata.getVar(var, True) or ''
|
||||||
|
@ -148,6 +154,7 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
|
||||||
broken = cls.getvar('BROKEN', metadata),
|
broken = cls.getvar('BROKEN', metadata),
|
||||||
not_world = cls.getvar('EXCLUDE_FROM_WORLD', metadata),
|
not_world = cls.getvar('EXCLUDE_FROM_WORLD', metadata),
|
||||||
stamp = cls.getvar('STAMP', metadata),
|
stamp = cls.getvar('STAMP', metadata),
|
||||||
|
stamp_extrainfo = cls.flaglist('stamp-extra-info', tasks, metadata),
|
||||||
packages_dynamic = cls.listvar('PACKAGES_DYNAMIC', metadata),
|
packages_dynamic = cls.listvar('PACKAGES_DYNAMIC', metadata),
|
||||||
depends = cls.depvar('DEPENDS', metadata),
|
depends = cls.depvar('DEPENDS', metadata),
|
||||||
provides = cls.depvar('PROVIDES', metadata),
|
provides = cls.depvar('PROVIDES', metadata),
|
||||||
|
@ -562,6 +569,7 @@ class CacheData(object):
|
||||||
self.task_queues = {}
|
self.task_queues = {}
|
||||||
self.task_deps = {}
|
self.task_deps = {}
|
||||||
self.stamp = {}
|
self.stamp = {}
|
||||||
|
self.stamp_extrainfo = {}
|
||||||
self.preferred = {}
|
self.preferred = {}
|
||||||
self.tasks = {}
|
self.tasks = {}
|
||||||
self.basetaskhash = {}
|
self.basetaskhash = {}
|
||||||
|
@ -583,6 +591,7 @@ class CacheData(object):
|
||||||
self.pkg_pepvpr[fn] = (info.pe, info.pv, info.pr)
|
self.pkg_pepvpr[fn] = (info.pe, info.pv, info.pr)
|
||||||
self.pkg_dp[fn] = info.defaultpref
|
self.pkg_dp[fn] = info.defaultpref
|
||||||
self.stamp[fn] = info.stamp
|
self.stamp[fn] = info.stamp
|
||||||
|
self.stamp_extrainfo[fn] = info.stamp_extrainfo
|
||||||
|
|
||||||
provides = [info.pn]
|
provides = [info.pn]
|
||||||
for provide in info.provides:
|
for provide in info.provides:
|
||||||
|
|
|
@ -794,7 +794,7 @@ class RunQueue:
|
||||||
continue
|
continue
|
||||||
fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
|
fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
|
||||||
taskname = self.rqdata.runq_task[task]
|
taskname = self.rqdata.runq_task[task]
|
||||||
stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname)
|
stampfile = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
|
||||||
# If the stamp is missing its not current
|
# If the stamp is missing its not current
|
||||||
if not os.access(stampfile, os.F_OK):
|
if not os.access(stampfile, os.F_OK):
|
||||||
del unchecked[task]
|
del unchecked[task]
|
||||||
|
@ -815,7 +815,7 @@ class RunQueue:
|
||||||
if task in unchecked:
|
if task in unchecked:
|
||||||
fn = self.taskData.fn_index[self.rqdata.runq_fnid[task]]
|
fn = self.taskData.fn_index[self.rqdata.runq_fnid[task]]
|
||||||
taskname = self.rqdata.runq_task[task]
|
taskname = self.rqdata.runq_task[task]
|
||||||
stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname)
|
stampfile = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
|
||||||
iscurrent = True
|
iscurrent = True
|
||||||
|
|
||||||
t1 = os.stat(stampfile)[stat.ST_MTIME]
|
t1 = os.stat(stampfile)[stat.ST_MTIME]
|
||||||
|
@ -823,7 +823,7 @@ class RunQueue:
|
||||||
if iscurrent:
|
if iscurrent:
|
||||||
fn2 = self.taskData.fn_index[self.rqdata.runq_fnid[dep]]
|
fn2 = self.taskData.fn_index[self.rqdata.runq_fnid[dep]]
|
||||||
taskname2 = self.rqdata.runq_task[dep]
|
taskname2 = self.rqdata.runq_task[dep]
|
||||||
stampfile2 = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn2], fn2, taskname2)
|
stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCache, fn2)
|
||||||
if fn == fn2 or (fulldeptree and fn2 not in stampwhitelist):
|
if fn == fn2 or (fulldeptree and fn2 not in stampwhitelist):
|
||||||
if dep in notcurrent:
|
if dep in notcurrent:
|
||||||
iscurrent = False
|
iscurrent = False
|
||||||
|
@ -875,7 +875,7 @@ class RunQueue:
|
||||||
if taskname is None:
|
if taskname is None:
|
||||||
taskname = self.rqdata.runq_task[task]
|
taskname = self.rqdata.runq_task[task]
|
||||||
|
|
||||||
stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname)
|
stampfile = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
|
||||||
|
|
||||||
# If the stamp is missing its not current
|
# If the stamp is missing its not current
|
||||||
if not os.access(stampfile, os.F_OK):
|
if not os.access(stampfile, os.F_OK):
|
||||||
|
@ -896,8 +896,8 @@ class RunQueue:
|
||||||
if iscurrent:
|
if iscurrent:
|
||||||
fn2 = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[dep]]
|
fn2 = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[dep]]
|
||||||
taskname2 = self.rqdata.runq_task[dep]
|
taskname2 = self.rqdata.runq_task[dep]
|
||||||
stampfile2 = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn2], fn2, taskname2)
|
stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCache, fn2)
|
||||||
stampfile3 = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn2], fn2, taskname2 + "_setscene")
|
stampfile3 = bb.build.stampfile(taskname2 + "_setscene", self.rqdata.dataCache, fn2)
|
||||||
t2 = get_timestamp(stampfile2)
|
t2 = get_timestamp(stampfile2)
|
||||||
t3 = get_timestamp(stampfile3)
|
t3 = get_timestamp(stampfile3)
|
||||||
if t3 and t3 > t2:
|
if t3 and t3 > t2:
|
||||||
|
|
|
@ -42,8 +42,8 @@ class SignatureGenerator(object):
|
||||||
def set_taskdata(self, hashes, deps):
|
def set_taskdata(self, hashes, deps):
|
||||||
return
|
return
|
||||||
|
|
||||||
def stampfile(self, stampbase, file_name, taskname):
|
def stampfile(self, stampbase, file_name, taskname, extrainfo):
|
||||||
return "%s.%s" % (stampbase, taskname)
|
return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.')
|
||||||
|
|
||||||
class SignatureGeneratorBasic(SignatureGenerator):
|
class SignatureGeneratorBasic(SignatureGenerator):
|
||||||
"""
|
"""
|
||||||
|
@ -196,13 +196,13 @@ class SignatureGeneratorBasic(SignatureGenerator):
|
||||||
class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
|
class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
|
||||||
name = "basichash"
|
name = "basichash"
|
||||||
|
|
||||||
def stampfile(self, stampbase, fn, taskname):
|
def stampfile(self, stampbase, fn, taskname, extrainfo):
|
||||||
if taskname != "do_setscene" and taskname.endswith("_setscene"):
|
if taskname != "do_setscene" and taskname.endswith("_setscene"):
|
||||||
k = fn + "." + taskname[:-9]
|
k = fn + "." + taskname[:-9]
|
||||||
else:
|
else:
|
||||||
k = fn + "." + taskname
|
k = fn + "." + taskname
|
||||||
h = self.taskhash[k]
|
h = self.taskhash[k]
|
||||||
return "%s.%s.%s" % (stampbase, taskname, h)
|
return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.')
|
||||||
|
|
||||||
def dump_this_task(outfile, d):
|
def dump_this_task(outfile, d):
|
||||||
fn = d.getVar("BB_FILENAME", True)
|
fn = d.getVar("BB_FILENAME", True)
|
||||||
|
|
Loading…
Reference in New Issue