summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2011-01-18 16:18:18 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-18 12:50:04 +0000
commit80cf3e405c923ed95dd09936739e816dbdd92299 (patch)
tree62082943bf06a2df18722b911bf93dea05e43bfe /bitbake
parent740ea68258282c459b66bbed550e6347fb8e83a3 (diff)
downloadpoky-80cf3e405c923ed95dd09936739e816dbdd92299.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/build.py12
-rw-r--r--bitbake/lib/bb/cache.py11
-rw-r--r--bitbake/lib/bb/runqueue.py12
-rw-r--r--bitbake/lib/bb/siggen.py8
4 files changed, 29 insertions, 14 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 722639f3bb..e723c7ea85 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -386,14 +386,16 @@ def stamp_internal(taskname, d, file_name):
386 """ 386 """
387 if file_name: 387 if file_name:
388 stamp = d.stamp[file_name] 388 stamp = d.stamp[file_name]
389 extrainfo = d.stamp_extrainfo[file_name].get(taskname) or ""
389 else: 390 else:
390 stamp = d.getVar('STAMP', True) 391 stamp = d.getVar('STAMP', True)
391 file_name = d.getVar('BB_FILENAME', True) 392 file_name = d.getVar('BB_FILENAME', True)
393 extrainfo = d.getVarFlag(taskname, 'stamp-extra-info', True) or ""
392 394
393 if not stamp: 395 if not stamp:
394 return 396 return
395 397
396 stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname) 398 stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
397 399
398 bb.utils.mkdirhier(os.path.dirname(stamp)) 400 bb.utils.mkdirhier(os.path.dirname(stamp))
399 401
@@ -420,8 +422,12 @@ def del_stamp(task, d, file_name = None):
420 stamp = stamp_internal(task, d, file_name) 422 stamp = stamp_internal(task, d, file_name)
421 bb.utils.remove(stamp) 423 bb.utils.remove(stamp)
422 424
423def stampfile(taskname, d): 425def stampfile(taskname, d, file_name = None):
424 return stamp_internal(taskname, d, None) 426 """
427 Return the stamp for a given task
428 (d can be a data dict or dataCache)
429 """
430 return stamp_internal(taskname, d, file_name)
425 431
426def add_tasks(tasklist, d): 432def add_tasks(tasklist, d):
427 task_deps = data.getVar('_task_deps', d) 433 task_deps = data.getVar('_task_deps', d)
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 9a2e2d5298..262f574f51 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -43,7 +43,7 @@ except ImportError:
43 logger.info("Importing cPickle failed. " 43 logger.info("Importing cPickle failed. "
44 "Falling back to a very slow implementation.") 44 "Falling back to a very slow implementation.")
45 45
46__cache_version__ = "134" 46__cache_version__ = "135"
47 47
48recipe_fields = ( 48recipe_fields = (
49 'pn', 49 'pn',
@@ -55,6 +55,7 @@ recipe_fields = (
55 'provides', 55 'provides',
56 'task_deps', 56 'task_deps',
57 'stamp', 57 'stamp',
58 'stamp_extrainfo',
58 'broken', 59 'broken',
59 'not_world', 60 'not_world',
60 'skipped', 61 'skipped',
@@ -102,6 +103,11 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
102 for task in tasks) 103 for task in tasks)
103 104
104 @classmethod 105 @classmethod
106 def flaglist(cls, flag, varlist, metadata):
107 return dict((var, metadata.getVarFlag(flag, var, True))
108 for var in varlist)
109
110 @classmethod
105 def getvar(cls, var, metadata): 111 def getvar(cls, var, metadata):
106 return metadata.getVar(var, True) or '' 112 return metadata.getVar(var, True) or ''
107 113
@@ -148,6 +154,7 @@ class RecipeInfo(namedtuple('RecipeInfo', recipe_fields)):
148 broken = cls.getvar('BROKEN', metadata), 154 broken = cls.getvar('BROKEN', metadata),
149 not_world = cls.getvar('EXCLUDE_FROM_WORLD', metadata), 155 not_world = cls.getvar('EXCLUDE_FROM_WORLD', metadata),
150 stamp = cls.getvar('STAMP', metadata), 156 stamp = cls.getvar('STAMP', metadata),
157 stamp_extrainfo = cls.flaglist('stamp-extra-info', tasks, metadata),
151 packages_dynamic = cls.listvar('PACKAGES_DYNAMIC', metadata), 158 packages_dynamic = cls.listvar('PACKAGES_DYNAMIC', metadata),
152 depends = cls.depvar('DEPENDS', metadata), 159 depends = cls.depvar('DEPENDS', metadata),
153 provides = cls.depvar('PROVIDES', metadata), 160 provides = cls.depvar('PROVIDES', metadata),
@@ -562,6 +569,7 @@ class CacheData(object):
562 self.task_queues = {} 569 self.task_queues = {}
563 self.task_deps = {} 570 self.task_deps = {}
564 self.stamp = {} 571 self.stamp = {}
572 self.stamp_extrainfo = {}
565 self.preferred = {} 573 self.preferred = {}
566 self.tasks = {} 574 self.tasks = {}
567 self.basetaskhash = {} 575 self.basetaskhash = {}
@@ -583,6 +591,7 @@ class CacheData(object):
583 self.pkg_pepvpr[fn] = (info.pe, info.pv, info.pr) 591 self.pkg_pepvpr[fn] = (info.pe, info.pv, info.pr)
584 self.pkg_dp[fn] = info.defaultpref 592 self.pkg_dp[fn] = info.defaultpref
585 self.stamp[fn] = info.stamp 593 self.stamp[fn] = info.stamp
594 self.stamp_extrainfo[fn] = info.stamp_extrainfo
586 595
587 provides = [info.pn] 596 provides = [info.pn]
588 for provide in info.provides: 597 for provide in info.provides:
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index a46527505f..b9d89ec082 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -794,7 +794,7 @@ class RunQueue:
794 continue 794 continue
795 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]] 795 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
796 taskname = self.rqdata.runq_task[task] 796 taskname = self.rqdata.runq_task[task]
797 stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname) 797 stampfile = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
798 # If the stamp is missing its not current 798 # If the stamp is missing its not current
799 if not os.access(stampfile, os.F_OK): 799 if not os.access(stampfile, os.F_OK):
800 del unchecked[task] 800 del unchecked[task]
@@ -815,7 +815,7 @@ class RunQueue:
815 if task in unchecked: 815 if task in unchecked:
816 fn = self.taskData.fn_index[self.rqdata.runq_fnid[task]] 816 fn = self.taskData.fn_index[self.rqdata.runq_fnid[task]]
817 taskname = self.rqdata.runq_task[task] 817 taskname = self.rqdata.runq_task[task]
818 stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname) 818 stampfile = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
819 iscurrent = True 819 iscurrent = True
820 820
821 t1 = os.stat(stampfile)[stat.ST_MTIME] 821 t1 = os.stat(stampfile)[stat.ST_MTIME]
@@ -823,7 +823,7 @@ class RunQueue:
823 if iscurrent: 823 if iscurrent:
824 fn2 = self.taskData.fn_index[self.rqdata.runq_fnid[dep]] 824 fn2 = self.taskData.fn_index[self.rqdata.runq_fnid[dep]]
825 taskname2 = self.rqdata.runq_task[dep] 825 taskname2 = self.rqdata.runq_task[dep]
826 stampfile2 = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn2], fn2, taskname2) 826 stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCache, fn2)
827 if fn == fn2 or (fulldeptree and fn2 not in stampwhitelist): 827 if fn == fn2 or (fulldeptree and fn2 not in stampwhitelist):
828 if dep in notcurrent: 828 if dep in notcurrent:
829 iscurrent = False 829 iscurrent = False
@@ -875,7 +875,7 @@ class RunQueue:
875 if taskname is None: 875 if taskname is None:
876 taskname = self.rqdata.runq_task[task] 876 taskname = self.rqdata.runq_task[task]
877 877
878 stampfile = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn], fn, taskname) 878 stampfile = bb.build.stampfile(taskname, self.rqdata.dataCache, fn)
879 879
880 # If the stamp is missing its not current 880 # If the stamp is missing its not current
881 if not os.access(stampfile, os.F_OK): 881 if not os.access(stampfile, os.F_OK):
@@ -896,8 +896,8 @@ class RunQueue:
896 if iscurrent: 896 if iscurrent:
897 fn2 = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[dep]] 897 fn2 = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[dep]]
898 taskname2 = self.rqdata.runq_task[dep] 898 taskname2 = self.rqdata.runq_task[dep]
899 stampfile2 = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn2], fn2, taskname2) 899 stampfile2 = bb.build.stampfile(taskname2, self.rqdata.dataCache, fn2)
900 stampfile3 = bb.parse.siggen.stampfile(self.rqdata.dataCache.stamp[fn2], fn2, taskname2 + "_setscene") 900 stampfile3 = bb.build.stampfile(taskname2 + "_setscene", self.rqdata.dataCache, fn2)
901 t2 = get_timestamp(stampfile2) 901 t2 = get_timestamp(stampfile2)
902 t3 = get_timestamp(stampfile3) 902 t3 = get_timestamp(stampfile3)
903 if t3 and t3 > t2: 903 if t3 and t3 > t2:
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 010c2cab26..2d28ecfc2d 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -42,8 +42,8 @@ class SignatureGenerator(object):
42 def set_taskdata(self, hashes, deps): 42 def set_taskdata(self, hashes, deps):
43 return 43 return
44 44
45 def stampfile(self, stampbase, file_name, taskname): 45 def stampfile(self, stampbase, file_name, taskname, extrainfo):
46 return "%s.%s" % (stampbase, taskname) 46 return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.')
47 47
48class SignatureGeneratorBasic(SignatureGenerator): 48class SignatureGeneratorBasic(SignatureGenerator):
49 """ 49 """
@@ -196,13 +196,13 @@ class SignatureGeneratorBasic(SignatureGenerator):
196class SignatureGeneratorBasicHash(SignatureGeneratorBasic): 196class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
197 name = "basichash" 197 name = "basichash"
198 198
199 def stampfile(self, stampbase, fn, taskname): 199 def stampfile(self, stampbase, fn, taskname, extrainfo):
200 if taskname != "do_setscene" and taskname.endswith("_setscene"): 200 if taskname != "do_setscene" and taskname.endswith("_setscene"):
201 k = fn + "." + taskname[:-9] 201 k = fn + "." + taskname[:-9]
202 else: 202 else:
203 k = fn + "." + taskname 203 k = fn + "." + taskname
204 h = self.taskhash[k] 204 h = self.taskhash[k]
205 return "%s.%s.%s" % (stampbase, taskname, h) 205 return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.')
206 206
207def dump_this_task(outfile, d): 207def dump_this_task(outfile, d):
208 fn = d.getVar("BB_FILENAME", True) 208 fn = d.getVar("BB_FILENAME", True)