diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2011-06-28 17:05:19 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-28 13:44:38 +0100 |
commit | 671e580111c3f37f3c7835956db17e0425f9f937 (patch) | |
tree | 042cdc41190ccbe14e5be5e616bb57d375283f23 /bitbake/lib | |
parent | a1f79a7896b6411669b3ccada6204d2695e80fc5 (diff) | |
download | poky-671e580111c3f37f3c7835956db17e0425f9f937.tar.gz |
bitbake: Add task specific stamp file support
This patch, based on proof of concept code from Richard adds code to
bitbake to allow individual tasks to optionally specify their stamp
file using the stamp-base flag. This takes the same form as the STAMP
variable but can be specified on a per task basis.
Code is also added to runqueue to ensure that if two tasks share the
same stamp file, only one will be executed at once.
A significant usecase for this code is to share source code (${S})
between recipes where separate build directories (${B}) are used.
(Bitbake rev: 41bef02bef8379590ba012319aebe05068a8081e)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/build.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/cache.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 10 |
3 files changed, 15 insertions, 2 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index f69464c60b..5c703095b7 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -383,10 +383,10 @@ def stamp_internal(taskname, d, file_name): | |||
383 | taskflagname = taskname.replace("_setscene", "") | 383 | taskflagname = taskname.replace("_setscene", "") |
384 | 384 | ||
385 | if file_name: | 385 | if file_name: |
386 | stamp = d.stamp[file_name] | 386 | stamp = d.stamp_base[file_name].get(taskflagname) or d.stamp[file_name] |
387 | extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or "" | 387 | extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or "" |
388 | else: | 388 | else: |
389 | stamp = d.getVar('STAMP', True) | 389 | stamp = d.getVarFlag(taskflagname, 'stamp-base', True) or d.getVar('STAMP', True) |
390 | file_name = d.getVar('BB_FILENAME', True) | 390 | file_name = d.getVar('BB_FILENAME', True) |
391 | extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info', True) or "" | 391 | extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info', True) or "" |
392 | 392 | ||
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 6c92a9363a..99d7395f86 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -124,6 +124,7 @@ class CoreRecipeInfo(RecipeInfoCommon): | |||
124 | self.broken = self.getvar('BROKEN', metadata) | 124 | self.broken = self.getvar('BROKEN', metadata) |
125 | self.not_world = self.getvar('EXCLUDE_FROM_WORLD', metadata) | 125 | self.not_world = self.getvar('EXCLUDE_FROM_WORLD', metadata) |
126 | self.stamp = self.getvar('STAMP', metadata) | 126 | self.stamp = self.getvar('STAMP', metadata) |
127 | self.stamp_base = self.flaglist('stamp-base', self.tasks, metadata) | ||
127 | self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata) | 128 | self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata) |
128 | self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata) | 129 | self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata) |
129 | self.depends = self.depvar('DEPENDS', metadata) | 130 | self.depends = self.depvar('DEPENDS', metadata) |
@@ -151,6 +152,7 @@ class CoreRecipeInfo(RecipeInfoCommon): | |||
151 | cachedata.pkg_dp = {} | 152 | cachedata.pkg_dp = {} |
152 | 153 | ||
153 | cachedata.stamp = {} | 154 | cachedata.stamp = {} |
155 | cachedata.stamp_base = {} | ||
154 | cachedata.stamp_extrainfo = {} | 156 | cachedata.stamp_extrainfo = {} |
155 | cachedata.fn_provides = {} | 157 | cachedata.fn_provides = {} |
156 | cachedata.pn_provides = defaultdict(list) | 158 | cachedata.pn_provides = defaultdict(list) |
@@ -183,6 +185,7 @@ class CoreRecipeInfo(RecipeInfoCommon): | |||
183 | cachedata.pkg_pepvpr[fn] = (self.pe, self.pv, self.pr) | 185 | cachedata.pkg_pepvpr[fn] = (self.pe, self.pv, self.pr) |
184 | cachedata.pkg_dp[fn] = self.defaultpref | 186 | cachedata.pkg_dp[fn] = self.defaultpref |
185 | cachedata.stamp[fn] = self.stamp | 187 | cachedata.stamp[fn] = self.stamp |
188 | cachedata.stamp_base[fn] = self.stamp_base | ||
186 | cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo | 189 | cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo |
187 | 190 | ||
188 | provides = [self.pn] | 191 | provides = [self.pn] |
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index b801877e16..e1d32b7661 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -105,6 +105,11 @@ class RunQueueScheduler(object): | |||
105 | if self.rq.runq_running[taskid] == 1: | 105 | if self.rq.runq_running[taskid] == 1: |
106 | continue | 106 | continue |
107 | if self.rq.runq_buildable[taskid] == 1: | 107 | if self.rq.runq_buildable[taskid] == 1: |
108 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[taskid]] | ||
109 | taskname = self.rqdata.runq_task[taskid] | ||
110 | stamp = bb.build.stampfile(taskname, self.rqdata.dataCache, fn) | ||
111 | if stamp in self.rq.build_stamps.values(): | ||
112 | continue | ||
108 | return taskid | 113 | return taskid |
109 | 114 | ||
110 | def next(self): | 115 | def next(self): |
@@ -1009,6 +1014,7 @@ class RunQueueExecute: | |||
1009 | self.runq_complete = [] | 1014 | self.runq_complete = [] |
1010 | self.build_pids = {} | 1015 | self.build_pids = {} |
1011 | self.build_pipes = {} | 1016 | self.build_pipes = {} |
1017 | self.build_stamps = {} | ||
1012 | self.failed_fnids = [] | 1018 | self.failed_fnids = [] |
1013 | 1019 | ||
1014 | def runqueue_process_waitpid(self): | 1020 | def runqueue_process_waitpid(self): |
@@ -1023,6 +1029,9 @@ class RunQueueExecute: | |||
1023 | del self.build_pids[result[0]] | 1029 | del self.build_pids[result[0]] |
1024 | self.build_pipes[result[0]].close() | 1030 | self.build_pipes[result[0]].close() |
1025 | del self.build_pipes[result[0]] | 1031 | del self.build_pipes[result[0]] |
1032 | # self.build_stamps[result[0]] may not exist when use shared work directory. | ||
1033 | if result[0] in self.build_stamps.keys(): | ||
1034 | del self.build_stamps[result[0]] | ||
1026 | if result[1] != 0: | 1035 | if result[1] != 0: |
1027 | self.task_fail(task, result[1]>>8) | 1036 | self.task_fail(task, result[1]>>8) |
1028 | else: | 1037 | else: |
@@ -1330,6 +1339,7 @@ class RunQueueExecuteTasks(RunQueueExecute): | |||
1330 | 1339 | ||
1331 | self.build_pids[pid] = task | 1340 | self.build_pids[pid] = task |
1332 | self.build_pipes[pid] = runQueuePipe(pipein, pipeout, self.cfgData) | 1341 | self.build_pipes[pid] = runQueuePipe(pipein, pipeout, self.cfgData) |
1342 | self.build_stamps[pid] = bb.build.stampfile(taskname, self.rqdata.dataCache, fn) | ||
1333 | self.runq_running[task] = 1 | 1343 | self.runq_running[task] = 1 |
1334 | self.stats.taskActive() | 1344 | self.stats.taskActive() |
1335 | if self.stats.active < self.number_tasks: | 1345 | if self.stats.active < self.number_tasks: |