summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-27 15:48:09 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-28 15:12:42 +0100
commit347f9c6bc34b9fa881c8ea4503e5d9dd482e5df6 (patch)
tree0a57ad39cf990a1a80f83a5ae5ad926a17640b61
parentbbf1040f8c33c2eaca2fa15dda364d09d44c2b76 (diff)
downloadpoky-347f9c6bc34b9fa881c8ea4503e5d9dd482e5df6.tar.gz
sstate: Add extra intercept functions
In some cases we do either need to add extra sstate manipulation functions, or change the existing modification functions. This patch parametrises them to SSTATECREATEFUNCS and SSTATEPOSTUNPACKFUNCS and abstracts the "hardcoded path" functions into separate functions using these new variables. We may use this new functionality to improve binary relocating using patchelf for example, this at least lets us have the hooks to be able to experiment. (From OE-Core rev: 9d659c6f20fa4a141b491c62a3ef0dfb1f896d9c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sstate.bbclass54
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
33SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" 33SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
34 34
35SSTATEPREINSTFUNCS ?= "" 35SSTATECREATEFUNCS = "sstate_hardcode_path"
36SSTATEPOSTINSTFUNCS ?= "" 36SSTATEPREINSTFUNCS = ""
37SSTATEPOSTUNPACKFUNCS = "sstate_hardcode_path_unpack"
38SSTATEPOSTINSTFUNCS = ""
37EXTRA_STAGING_FIXMES ?= "" 39EXTRA_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
262python 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
295def sstate_clean_cachefile(ss, d): 299def 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
398def sstate_hardcode_path(d): 402python 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
453def sstate_package(ss, d): 458def 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