diff options
| author | Richard Purdie <rpurdie@linux.intel.com> | 2009-06-11 14:45:52 +0100 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-06-11 14:46:17 +0100 |
| commit | 5a4c688958a7dc1258575c0f6c3bd1af165b2585 (patch) | |
| tree | 50be9f432541c51769cecba5361c758005fc6f23 | |
| parent | 4d503cfa062552046d9331a6dcfa724225cebc11 (diff) | |
| download | poky-5a4c688958a7dc1258575c0f6c3bd1af165b2585.tar.gz | |
packaged-staging.bbclass: Detect when we're using autotools_stage_all and don't hold the lock for as long when that is the case giving a significant performance boost with less lock contention and staging area file timestamp checking required
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
| -rw-r--r-- | meta/classes/autotools.bbclass | 7 | ||||
| -rw-r--r-- | meta/classes/autotools_stage.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/packaged-staging.bbclass | 40 |
3 files changed, 43 insertions, 6 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass index 365258f65f..82ed36816b 100644 --- a/meta/classes/autotools.bbclass +++ b/meta/classes/autotools.bbclass | |||
| @@ -151,7 +151,9 @@ autotools_do_install() { | |||
| 151 | done | 151 | done |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | # STAGE_TEMP_PREFIX is used for a speedup by packaged-staging | ||
| 154 | STAGE_TEMP="${WORKDIR}/temp-staging" | 155 | STAGE_TEMP="${WORKDIR}/temp-staging" |
| 156 | STAGE_TEMP_PREFIX = "" | ||
| 155 | 157 | ||
| 156 | autotools_stage_includes() { | 158 | autotools_stage_includes() { |
| 157 | if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ] | 159 | if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ] |
| @@ -167,11 +169,12 @@ autotools_stage_includes() { | |||
| 167 | autotools_stage_dir() { | 169 | autotools_stage_dir() { |
| 168 | from="$1" | 170 | from="$1" |
| 169 | to="$2" | 171 | to="$2" |
| 172 | prefix="${STAGE_TEMP_PREFIX}" | ||
| 170 | # This will remove empty directories so we can ignore them | 173 | # This will remove empty directories so we can ignore them |
| 171 | rmdir "$from" 2> /dev/null || true | 174 | rmdir "$from" 2> /dev/null || true |
| 172 | if [ -d "$from" ]; then | 175 | if [ -d "$from" ]; then |
| 173 | mkdir -p "$to" | 176 | mkdir -p "$prefix$to" |
| 174 | cp -fpPR "$from"/* "$to" | 177 | cp -fpPR "$from"/* "$prefix$to" |
| 175 | fi | 178 | fi |
| 176 | } | 179 | } |
| 177 | 180 | ||
diff --git a/meta/classes/autotools_stage.bbclass b/meta/classes/autotools_stage.bbclass index 010117c250..ff0f4cd880 100644 --- a/meta/classes/autotools_stage.bbclass +++ b/meta/classes/autotools_stage.bbclass | |||
| @@ -2,4 +2,4 @@ inherit autotools | |||
| 2 | 2 | ||
| 3 | do_stage () { | 3 | do_stage () { |
| 4 | autotools_stage_all | 4 | autotools_stage_all |
| 5 | } \ No newline at end of file | 5 | } |
diff --git a/meta/classes/packaged-staging.bbclass b/meta/classes/packaged-staging.bbclass index 9b9ba16bff..5d0ee9aa99 100644 --- a/meta/classes/packaged-staging.bbclass +++ b/meta/classes/packaged-staging.bbclass | |||
| @@ -63,6 +63,24 @@ python () { | |||
| 63 | bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d) | 63 | bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d) |
| 64 | 64 | ||
| 65 | bb.data.setVar("PSTAGING_ACTIVE", "1", d) | 65 | bb.data.setVar("PSTAGING_ACTIVE", "1", d) |
| 66 | |||
| 67 | # | ||
| 68 | # Here we notice if the staging function is one of our standard staging | ||
| 69 | # routines. If it is, we can remvoe the need to lock staging and take | ||
| 70 | # timestamps which gives a nice speedup | ||
| 71 | # | ||
| 72 | fastpath = False | ||
| 73 | stagefunc = bb.data.getVar('do_stage', d, 1).strip() | ||
| 74 | if stagefunc == "autotools_stage_all": | ||
| 75 | fastpath = True | ||
| 76 | if stagefunc == "do_stage_native" and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1": | ||
| 77 | fastpath = True | ||
| 78 | if fastpath: | ||
| 79 | bb.note("Can optimise " + bb.data.getVar('FILE', d, 1)) | ||
| 80 | bb.data.setVar("PSTAGING_NEEDSTAMP", "0", d) | ||
| 81 | bb.data.setVar("STAGE_TEMP_PREFIX", "${WORKDIR}/temp-staging-pstage", d) | ||
| 82 | else: | ||
| 83 | bb.data.setVar("PSTAGING_NEEDSTAMP", "1", d) | ||
| 66 | else: | 84 | else: |
| 67 | bb.data.setVar("PSTAGING_ACTIVE", "0", d) | 85 | bb.data.setVar("PSTAGING_ACTIVE", "0", d) |
| 68 | } | 86 | } |
| @@ -297,14 +315,30 @@ populate_staging_postamble () { | |||
| 297 | fi | 315 | fi |
| 298 | } | 316 | } |
| 299 | 317 | ||
| 300 | do_populate_staging[lockfiles] = "${STAGING_DIR}/staging.lock" | 318 | autotools_staging_pstage () { |
| 319 | mkdir -p ${PSTAGE_TMPDIR_STAGE}/staging/ | ||
| 320 | cp -fpPR ${WORKDIR}/temp-staging-pstage/${STAGING_DIR}/* ${PSTAGE_TMPDIR_STAGE}/staging/ | ||
| 321 | cp -fpPR ${WORKDIR}/temp-staging-pstage/${STAGING_DIR}/* ${STAGING_DIR}/ | ||
| 322 | } | ||
| 323 | |||
| 324 | #do_populate_staging[lockfiles] = "${STAGING_DIR}/staging.lock" | ||
| 301 | do_populate_staging[dirs] =+ "${DEPLOY_DIR_PSTAGE}" | 325 | do_populate_staging[dirs] =+ "${DEPLOY_DIR_PSTAGE}" |
| 302 | python do_populate_staging_prepend() { | 326 | python do_populate_staging_prepend() { |
| 303 | bb.build.exec_func("populate_staging_preamble", d) | 327 | needstamp = bb.data.getVar("PSTAGING_NEEDSTAMP", d, 1) |
| 328 | lock = bb.data.expand("${STAGING_DIR}/staging.lock", d) | ||
| 329 | if needstamp == "1": | ||
| 330 | stamplock = bb.utils.lockfile(lock) | ||
| 331 | bb.build.exec_func("populate_staging_preamble", d) | ||
| 304 | } | 332 | } |
| 305 | 333 | ||
| 306 | python do_populate_staging_append() { | 334 | python do_populate_staging_append() { |
| 307 | bb.build.exec_func("populate_staging_postamble", d) | 335 | if needstamp == "1": |
| 336 | bb.build.exec_func("populate_staging_postamble", d) | ||
| 337 | bb.utils.unlockfile(stamplock) | ||
| 338 | else: | ||
| 339 | stamplock = bb.utils.lockfile(lock) | ||
| 340 | bb.build.exec_func("autotools_staging_pstage", d) | ||
| 341 | bb.utils.unlockfile(stamplock) | ||
| 308 | } | 342 | } |
| 309 | 343 | ||
| 310 | 344 | ||
