diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-05 22:21:34 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-05 22:26:33 +0100 |
commit | 35d095c282aa27bb2c5b90b9ebafeaa4a3de907e (patch) | |
tree | e4e5b4732ffa2e58f2e93fc51d3bd7e101e5eedf | |
parent | 2d93cb0a0d70e6219379363cd80d375e30abebae (diff) | |
download | poky-35d095c282aa27bb2c5b90b9ebafeaa4a3de907e.tar.gz |
bitbake/sstate: Implement a lookup function to speed up setscene processing
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r-- | bitbake/lib/bb/cache.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 26 | ||||
-rw-r--r-- | meta/classes/deploy.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/sstate.bbclass | 26 |
4 files changed, 55 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 646fdecbeb..c6f3794d5e 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -453,6 +453,8 @@ class Cache: | |||
453 | if not self.getVar('BROKEN', file_name, True) and not self.getVar('EXCLUDE_FROM_WORLD', file_name, True): | 453 | if not self.getVar('BROKEN', file_name, True) and not self.getVar('EXCLUDE_FROM_WORLD', file_name, True): |
454 | cacheData.possible_world.append(file_name) | 454 | cacheData.possible_world.append(file_name) |
455 | 455 | ||
456 | cacheData.hashfn[file_name] = self.getVar('BB_HASHFILENAME', file_name, True) | ||
457 | |||
456 | # Touch this to make sure its in the cache | 458 | # Touch this to make sure its in the cache |
457 | self.getVar('__BB_DONT_CACHE', file_name, True) | 459 | self.getVar('__BB_DONT_CACHE', file_name, True) |
458 | self.getVar('__VARIANTS', file_name, True) | 460 | self.getVar('__VARIANTS', file_name, True) |
@@ -545,6 +547,7 @@ class CacheData: | |||
545 | self.preferred = {} | 547 | self.preferred = {} |
546 | self.tasks = {} | 548 | self.tasks = {} |
547 | self.basetaskhash = {} | 549 | self.basetaskhash = {} |
550 | self.hashfn = {} | ||
548 | 551 | ||
549 | """ | 552 | """ |
550 | Indirect Cache variables | 553 | Indirect Cache variables |
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index dff4ff7f3e..b5167126ee 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -757,7 +757,8 @@ class RunQueue: | |||
757 | self.cfgData = cfgData | 757 | self.cfgData = cfgData |
758 | self.rqdata = RunQueueData(self, cooker, cfgData, dataCache, taskData, targets) | 758 | self.rqdata = RunQueueData(self, cooker, cfgData, dataCache, taskData, targets) |
759 | 759 | ||
760 | self.stamppolicy = bb.data.getVar("BB_STAMP_POLICY", cfgData, 1) or "perfile" | 760 | self.stamppolicy = bb.data.getVar("BB_STAMP_POLICY", cfgData, True) or "perfile" |
761 | self.hashvalidate = bb.data.getVar("BB_HASHCHECK_FUNCTION", cfgData, True) or None | ||
761 | 762 | ||
762 | self.state = runQueuePrepare | 763 | self.state = runQueuePrepare |
763 | 764 | ||
@@ -1326,6 +1327,29 @@ class RunQueueExecuteScenequeue(RunQueueExecute): | |||
1326 | if len(self.sq_revdeps[task]) == 0: | 1327 | if len(self.sq_revdeps[task]) == 0: |
1327 | self.runq_buildable[task] = 1 | 1328 | self.runq_buildable[task] = 1 |
1328 | 1329 | ||
1330 | if self.rq.hashvalidate: | ||
1331 | sq_hash = [] | ||
1332 | sq_hashfn = [] | ||
1333 | sq_fn = [] | ||
1334 | sq_task = [] | ||
1335 | for task in range(len(self.sq_revdeps)): | ||
1336 | realtask = self.rqdata.runq_setscene[task] | ||
1337 | fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[realtask]] | ||
1338 | sq_fn.append(fn) | ||
1339 | sq_hashfn.append(self.rqdata.dataCache.hashfn[fn]) | ||
1340 | sq_hash.append(self.rqdata.runq_hash[realtask]) | ||
1341 | sq_task.append(self.rqdata.runq_task[realtask]) | ||
1342 | |||
1343 | call = self.rq.hashvalidate + "(sq_fn, sq_task, sq_hash, sq_hashfn, d)" | ||
1344 | locs = { "sq_fn" : sq_fn, "sq_task" : sq_task, "sq_hash" : sq_hash, "sq_hashfn" : sq_hashfn, "d" : self.cooker.configuration.data } | ||
1345 | valid = bb.utils.better_eval(call, locs) | ||
1346 | for task in range(len(self.sq_revdeps)): | ||
1347 | if task not in valid: | ||
1348 | bb.msg.debug(2, bb.msg.domain.RunQueue, "No package found so skipping setscene task %s" % (self.rqdata.get_user_idstring(task))) | ||
1349 | self.task_failoutright(task) | ||
1350 | |||
1351 | #print(str(valid)) | ||
1352 | |||
1329 | bb.msg.note(1, bb.msg.domain.RunQueue, "Executing setscene Tasks") | 1353 | bb.msg.note(1, bb.msg.domain.RunQueue, "Executing setscene Tasks") |
1330 | 1354 | ||
1331 | self.rq.state = runQueueSceneRun | 1355 | self.rq.state = runQueueSceneRun |
diff --git a/meta/classes/deploy.bbclass b/meta/classes/deploy.bbclass index f697e70aa4..c3371421d8 100644 --- a/meta/classes/deploy.bbclass +++ b/meta/classes/deploy.bbclass | |||
@@ -1,6 +1,6 @@ | |||
1 | DEPLOYDIR = "${WORKDIR}/deploy-${PN}" | 1 | DEPLOYDIR = "${WORKDIR}/deploy-${PN}" |
2 | SSTATETASKS += "do_deploy" | 2 | SSTATETASKS += "do_deploy" |
3 | do_deploy[sstate-name] = "deploy-${PN}" | 3 | do_deploy[sstate-name] = "deploy" |
4 | do_deploy[sstate-inputdirs] = "${DEPLOYDIR}" | 4 | do_deploy[sstate-inputdirs] = "${DEPLOYDIR}" |
5 | do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" | 5 | do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" |
6 | 6 | ||
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 855f5a45a7..7f897ae54d 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -9,6 +9,8 @@ SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}" | |||
9 | 9 | ||
10 | SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f" | 10 | SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f" |
11 | 11 | ||
12 | BB_HASHFILENAME = "${SSTATE_PKGNAME}" | ||
13 | |||
12 | python () { | 14 | python () { |
13 | if bb.data.inherits_class('native', d): | 15 | if bb.data.inherits_class('native', d): |
14 | bb.data.setVar('SSTATE_PKGARCH', bb.data.getVar('BUILD_ARCH', d), d) | 16 | bb.data.setVar('SSTATE_PKGARCH', bb.data.getVar('BUILD_ARCH', d), d) |
@@ -313,3 +315,27 @@ sstate_unpack_package () { | |||
313 | cd ${SSTATE_INSTDIR} | 315 | cd ${SSTATE_INSTDIR} |
314 | tar -xvzf ${SSTATE_PKG} | 316 | tar -xvzf ${SSTATE_PKG} |
315 | } | 317 | } |
318 | |||
319 | BB_HASHCHECK_FUNCTION = "sstate_checkhashes" | ||
320 | |||
321 | def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d): | ||
322 | ret = [] | ||
323 | # This needs to go away, FIXME | ||
324 | mapping = { | ||
325 | "do_populate_sysroot" : "populate-sysroot", | ||
326 | "do_package_write_ipk" : "deploy-ipk", | ||
327 | "do_package_write_deb" : "deploy-deb", | ||
328 | "do_package_write_rpm" : "deploy-rpm", | ||
329 | "do_package" : "package", | ||
330 | "do_deploy" : "deploy", | ||
331 | } | ||
332 | |||
333 | for task in range(len(sq_fn)): | ||
334 | sstatefile = bb.data.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz", d) | ||
335 | sstatefile= sstatefile.replace("${BB_TASKHASH}", sq_hash[task]) | ||
336 | #print("Checking for %s" % sstatefile) | ||
337 | if os.path.exists(sstatefile): | ||
338 | ret.append(task) | ||
339 | |||
340 | return ret | ||
341 | |||