diff options
| -rw-r--r-- | meta/classes/sstate.bbclass | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 4eec6bd0f7..ead829efa0 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
| @@ -32,8 +32,10 @@ BB_HASHFILENAME = "${SSTATE_EXTRAPATH} ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}" | |||
| 32 | 32 | ||
| 33 | SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" | 33 | SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" |
| 34 | 34 | ||
| 35 | SSTATEPREINSTFUNCS ?= "" | 35 | SSTATECREATEFUNCS = "sstate_hardcode_path" |
| 36 | SSTATEPOSTINSTFUNCS ?= "" | 36 | SSTATEPREINSTFUNCS = "" |
| 37 | SSTATEPOSTUNPACKFUNCS = "sstate_hardcode_path_unpack" | ||
| 38 | SSTATEPOSTINSTFUNCS = "" | ||
| 37 | EXTRA_STAGING_FIXMES ?= "" | 39 | EXTRA_STAGING_FIXMES ?= "" |
| 38 | 40 | ||
| 39 | # Specify dirs in which the shell function is executed and don't use ${B} | 41 | # Specify dirs in which the shell function is executed and don't use ${B} |
| @@ -239,16 +241,32 @@ def sstate_installpkg(ss, d): | |||
| 239 | d.setVar('SSTATE_INSTDIR', sstateinst) | 241 | d.setVar('SSTATE_INSTDIR', sstateinst) |
| 240 | d.setVar('SSTATE_PKG', sstatepkg) | 242 | d.setVar('SSTATE_PKG', sstatepkg) |
| 241 | 243 | ||
| 242 | for preinst in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split(): | 244 | for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split(): |
| 243 | bb.build.exec_func(preinst, d) | 245 | bb.build.exec_func(f, d) |
| 244 | 246 | ||
| 245 | bb.build.exec_func('sstate_unpack_package', d) | 247 | for state in ss['dirs']: |
| 248 | prepdir(state[1]) | ||
| 249 | os.rename(sstateinst + state[0], state[1]) | ||
| 250 | sstate_install(ss, d) | ||
| 246 | 251 | ||
| 252 | for plain in ss['plaindirs']: | ||
| 253 | workdir = d.getVar('WORKDIR', True) | ||
| 254 | src = sstateinst + "/" + plain.replace(workdir, '') | ||
| 255 | dest = plain | ||
| 256 | bb.utils.mkdirhier(src) | ||
| 257 | prepdir(dest) | ||
| 258 | os.rename(src, dest) | ||
| 259 | |||
| 260 | return True | ||
| 261 | |||
| 262 | python sstate_hardcode_path_unpack () { | ||
| 247 | # Fixup hardcoded paths | 263 | # Fixup hardcoded paths |
| 248 | # | 264 | # |
| 249 | # Note: The logic below must match the reverse logic in | 265 | # Note: The logic below must match the reverse logic in |
| 250 | # sstate_hardcode_path(d) | 266 | # sstate_hardcode_path(d) |
| 267 | import subprocess | ||
| 251 | 268 | ||
| 269 | sstateinst = d.getVar('SSTATE_INSTDIR', True) | ||
| 252 | fixmefn = sstateinst + "fixmepath" | 270 | fixmefn = sstateinst + "fixmepath" |
| 253 | if os.path.isfile(fixmefn): | 271 | if os.path.isfile(fixmefn): |
| 254 | staging = d.getVar('STAGING_DIR', True) | 272 | staging = d.getVar('STAGING_DIR', True) |
| @@ -276,21 +294,7 @@ def sstate_installpkg(ss, d): | |||
| 276 | # Need to remove this or we'd copy it into the target directory and may | 294 | # Need to remove this or we'd copy it into the target directory and may |
| 277 | # conflict with another writer | 295 | # conflict with another writer |
| 278 | os.remove(fixmefn) | 296 | os.remove(fixmefn) |
| 279 | 297 | } | |
| 280 | for state in ss['dirs']: | ||
| 281 | prepdir(state[1]) | ||
| 282 | os.rename(sstateinst + state[0], state[1]) | ||
| 283 | sstate_install(ss, d) | ||
| 284 | |||
| 285 | for plain in ss['plaindirs']: | ||
| 286 | workdir = d.getVar('WORKDIR', True) | ||
| 287 | src = sstateinst + "/" + plain.replace(workdir, '') | ||
| 288 | dest = plain | ||
| 289 | bb.utils.mkdirhier(src) | ||
| 290 | prepdir(dest) | ||
| 291 | os.rename(src, dest) | ||
| 292 | |||
| 293 | return True | ||
| 294 | 298 | ||
| 295 | def sstate_clean_cachefile(ss, d): | 299 | def sstate_clean_cachefile(ss, d): |
| 296 | import oe.path | 300 | import oe.path |
| @@ -395,7 +399,7 @@ python sstate_cleanall() { | |||
| 395 | sstate_clean(shared_state, ld) | 399 | sstate_clean(shared_state, ld) |
| 396 | } | 400 | } |
| 397 | 401 | ||
| 398 | def sstate_hardcode_path(d): | 402 | python sstate_hardcode_path () { |
| 399 | import subprocess, platform | 403 | import subprocess, platform |
| 400 | 404 | ||
| 401 | # Need to remove hardcoded paths and fix these when we install the | 405 | # Need to remove hardcoded paths and fix these when we install the |
| @@ -449,6 +453,7 @@ def sstate_hardcode_path(d): | |||
| 449 | else: | 453 | else: |
| 450 | bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) | 454 | bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) |
| 451 | subprocess.call(sstate_filelist_relative_cmd, shell=True) | 455 | subprocess.call(sstate_filelist_relative_cmd, shell=True) |
| 456 | } | ||
| 452 | 457 | ||
| 453 | def sstate_package(ss, d): | 458 | def sstate_package(ss, d): |
| 454 | import oe.path | 459 | import oe.path |
| @@ -506,9 +511,10 @@ def sstate_package(ss, d): | |||
| 506 | 511 | ||
| 507 | d.setVar('SSTATE_BUILDDIR', sstatebuild) | 512 | d.setVar('SSTATE_BUILDDIR', sstatebuild) |
| 508 | d.setVar('SSTATE_PKG', sstatepkg) | 513 | d.setVar('SSTATE_PKG', sstatepkg) |
| 509 | sstate_hardcode_path(d) | 514 | |
| 510 | bb.build.exec_func('sstate_create_package', d) | 515 | for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package']: |
| 511 | 516 | bb.build.exec_func(f, d) | |
| 517 | |||
| 512 | bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) | 518 | bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) |
| 513 | 519 | ||
| 514 | return | 520 | return |
