summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 13:54:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:17 +0000
commit9107d6ca144ac1f6169830dee25dae2dad775333 (patch)
treeec2f5662f8cea5a380ce1a86e249d08e1d0ca14f /meta/classes/sstate.bbclass
parent45df694a9f472ac2f684aadac4d864c3dfdc48a7 (diff)
downloadpoky-9107d6ca144ac1f6169830dee25dae2dad775333.tar.gz
Switch to Recipe Specific Sysroots
This patch is comparatively large and invasive. It does only do one thing, switching the system to build using recipe specific sysroots and where changes could be isolated from it, that has been done. With the current single sysroot approach, its possible for software to find things which aren't in their dependencies. This leads to a determinism problem and is a growing issue in several of the market segments where OE makes sense. The way to solve this problem for OE is to have seperate sysroots for each recipe and these will only contain the dependencies for that recipe. Its worth noting that this is not task specific sysroots and that OE's dependencies do vary enormously by task. This did result in some implementation challenges. There is nothing stopping the implementation of task specific sysroots at some later point based on this work but that as deemed a bridge too far right now. Implementation details: * Rather than installing the sysroot artefacts into a combined sysroots, they are now placed in TMPDIR/sysroot-components/PACKAGE_ARCH/PN. * WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by hardlinking in files from the sysroot-component trees. These new directories are known as RECIPE_SYSROOT and RECIPE_SYSROOT_NATIVE. * This construction is primarily done by a new do_prepare_recipe_sysroot task which runs before do_configure and consists of a call to the extend_recipe_sysroot function. * Other tasks need things in the sysroot before/after this, e.g. do_patch needs quilt-native and do_package_write_deb needs dpkg-native. The code therefore inspects the dependencies for each task and adds extend_recipe_sysroot as a prefunc if it has populate_sysroot dependencies. * We have to do a search/replace 'fixme' operation on the files installed into the sysroot to change hardcoded paths into the correct ones. We create a fixmepath file in the component directory which lists the files which need this operation. * Some files have "postinstall" commands which need to run against them, e.g. gdk-pixbuf each time a new loader is added. These are handled by adding files in bindir with the name prefixed by "postinst-" and are run in each sysroot as its created if they're present. This did mean most sstate postinstalls have to be rewritten but there shouldn't be many of them. * Since a recipe can have multiple tasks and these tasks can run against each other at the same time we have to have a lock when we perform write operations against the sysroot. We also have to maintain manifests of what we install against a task checksum of the dependency. If the checksum changes, we remove its files and then add the new ones. * The autotools logic for filtering the view of m4 files is no longer needed (and was the model for the way extend_recipe_sysroot works). * For autotools, we used to build a combined m4 macros directory which had both the native and target m4 files. We can no longer do this so we use the target sysroot as the default and add the native sysroot as an extra backup include path. If we don't do this, we'd have to build target pkg-config before we could built anything using pkg-config for example (ditto gettext). Such dependencies would be painful so we haven't required that. * PKDDATA_DIR was moved out the sysroot and works as before using sstate to build a hybrid copy for each machine. The paths therefore changed, the behaviour did not. * The ccache class had to be reworked to function with rss. * The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the -initial data does have to be filtered out from the main recipe sysroots. Putting "-initial" in a normal recipe name therefore remains a bad idea. * The logic in insane needed tweaks to deal with the new path layout, as did the debug source file extraction code in package.bbclass. * The logic in sstate.bbclass had to be rewritten since it previously only performed search and replace on extracted sstate and we now need this to happen even if the compiled path was "correct". This in theory could cause a mild performance issue but since the sysroot data was the main data that needed this and we'd have to do it there regardless with rss, I've opted just to change the way the class for everything. The built output used to build the sstate output is now retained and installed rather than deleted. * The search and replace logic used in sstate objects also seemed weak/incorrect and didn't hold up against testing. This has been rewritten too. There are some assumptions made about paths, we save the 'proper' search and replace operations to fixmepath.cmd but then ignore this. What is here works but is a little hardcoded and an area for future improvement. * In order to work with eSDK we need a way to build something that looks like the old style sysroot. "bitbake build-sysroots" will construct such a sysroot based on everything in the components directory that matches the current MACHINE. It will allow transition of external tools and can built target or native variants or both. It also supports a clean task. I'd suggest not relying on this for anything other than transitional purposes though. To see XXX in that sysroot, you'd have to have built that in a previous bitbake invocation. * pseudo is run out of its components directory. This is fine as its statically linked. * The hacks for wayland to see allarch dependencies in the multilib case are no longer needed and can be dropped. * wic needed more extensive changes to work with rss and the fixes are in a separate commit series * Various oe-selftest tweaks were needed since tests did assume the location to binaries and the combined sysroot in several cases. * Most missing dependencies this work found have been sent out as separate patches as they were found but a few tweaks are still included here. * A late addition is that extend_recipe_sysroot became multilib aware and able to populate multilib sysroots. I had hoped not to have to add that complexity but the meta-environment recipe forced my hand. That implementation can probably be neater but this is on the list of things to cleanup later at this point. In summary, the impact people will likely see after this change: * Recipes may fail with missing dependencies, particularly native tools like gettext-native, glib-2.0-native and libxml2.0-native. Some hosts have these installed and will mask these errors * Any recipe/class using SSTATEPOSTINSTFUNCS will need that code rewriting into a postinst * There was a separate patch series dealing with roots postinst native dependency issues. Any postinst which expects native tools at rootfs time will need to mark that dependency with PACKAGE_WRITE_DEPS. There could well be other issues. This has been tested repeatedly against our autobuilders and oe-selftest and issues found have been fixed. We believe at least OE-Core is in good shape but that doesn't mean we've found all the issues. Also, the logging is a bit chatty at the moment. It does help if something goes wrong and goes to the task logfiles, not the console so I've intentionally left this like that for now. We can turn it down easily enough in due course. (From OE-Core rev: 809746f56df4b91af014bf6a3f28997d6698ac78) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass126
1 files changed, 85 insertions, 41 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index f1faf4848e..a767a0203b 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -97,7 +97,7 @@ python () {
97 # These classes encode staging paths into their scripts data so can only be 97 # These classes encode staging paths into their scripts data so can only be
98 # reused if we manipulate the paths 98 # reused if we manipulate the paths
99 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d): 99 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):
100 scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}" 100 scan_cmd = "grep -Irl -e ${RECIPE_SYSROOT} -e ${RECIPE_SYSROOT_NATIVE} ${SSTATE_BUILDDIR}"
101 d.setVar('SSTATE_SCAN_CMD', scan_cmd) 101 d.setVar('SSTATE_SCAN_CMD', scan_cmd)
102 102
103 unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split())) 103 unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split()))
@@ -131,6 +131,7 @@ def sstate_state_fromvars(d, task = None):
131 lockfiles = (d.getVarFlag("do_" + task, 'sstate-lockfile') or "").split() 131 lockfiles = (d.getVarFlag("do_" + task, 'sstate-lockfile') or "").split()
132 lockfilesshared = (d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "").split() 132 lockfilesshared = (d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "").split()
133 interceptfuncs = (d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "").split() 133 interceptfuncs = (d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "").split()
134 fixmedir = d.getVarFlag("do_" + task, 'sstate-fixmedir') or ""
134 if not task or len(inputs) != len(outputs): 135 if not task or len(inputs) != len(outputs):
135 bb.fatal("sstate variables not setup correctly?!") 136 bb.fatal("sstate variables not setup correctly?!")
136 137
@@ -146,6 +147,7 @@ def sstate_state_fromvars(d, task = None):
146 ss['lockfiles-shared'] = lockfilesshared 147 ss['lockfiles-shared'] = lockfilesshared
147 ss['plaindirs'] = plaindirs 148 ss['plaindirs'] = plaindirs
148 ss['interceptfuncs'] = interceptfuncs 149 ss['interceptfuncs'] = interceptfuncs
150 ss['fixmedir'] = fixmedir
149 return ss 151 return ss
150 152
151def sstate_add(ss, source, dest, d): 153def sstate_add(ss, source, dest, d):
@@ -195,6 +197,9 @@ def sstate_install(ss, d):
195 srcdir = os.path.join(walkroot, dir) 197 srcdir = os.path.join(walkroot, dir)
196 dstdir = srcdir.replace(state[1], state[2]) 198 dstdir = srcdir.replace(state[1], state[2])
197 #bb.debug(2, "Staging %s to %s" % (srcdir, dstdir)) 199 #bb.debug(2, "Staging %s to %s" % (srcdir, dstdir))
200 if os.path.islink(srcdir):
201 sharedfiles.append(dstdir)
202 continue
198 if not dstdir.endswith("/"): 203 if not dstdir.endswith("/"):
199 dstdir = dstdir + "/" 204 dstdir = dstdir + "/"
200 shareddirs.append(dstdir) 205 shareddirs.append(dstdir)
@@ -203,7 +208,7 @@ def sstate_install(ss, d):
203 whitelist = (d.getVar("SSTATE_DUPWHITELIST") or "").split() 208 whitelist = (d.getVar("SSTATE_DUPWHITELIST") or "").split()
204 match = [] 209 match = []
205 for f in sharedfiles: 210 for f in sharedfiles:
206 if os.path.exists(f): 211 if os.path.exists(f) and not os.path.islink(f):
207 f = os.path.normpath(f) 212 f = os.path.normpath(f)
208 realmatch = True 213 realmatch = True
209 for w in whitelist: 214 for w in whitelist:
@@ -244,6 +249,10 @@ def sstate_install(ss, d):
244 (d.getVar('PN'), "\n ".join(match))) 249 (d.getVar('PN'), "\n ".join(match)))
245 bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.") 250 bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.")
246 251
252 if ss['fixmedir'] and os.path.exists(ss['fixmedir'] + "/fixmepath.cmd"):
253 sharedfiles.append(ss['fixmedir'] + "/fixmepath.cmd")
254 sharedfiles.append(ss['fixmedir'] + "/fixmepath")
255
247 # Write out the manifest 256 # Write out the manifest
248 f = open(manifest, "w") 257 f = open(manifest, "w")
249 for file in sharedfiles: 258 for file in sharedfiles:
@@ -288,17 +297,8 @@ sstate_install[vardepsexclude] += "SSTATE_DUPWHITELIST STATE_MANMACH SSTATE_MANF
288sstate_install[vardeps] += "${SSTATEPOSTINSTFUNCS}" 297sstate_install[vardeps] += "${SSTATEPOSTINSTFUNCS}"
289 298
290def sstate_installpkg(ss, d): 299def sstate_installpkg(ss, d):
291 import oe.path
292 import subprocess
293 from oe.gpg_sign import get_signer 300 from oe.gpg_sign import get_signer
294 301
295 def prepdir(dir):
296 # remove dir if it exists, ensure any parent directories do exist
297 if os.path.exists(dir):
298 oe.path.remove(dir)
299 bb.utils.mkdirhier(dir)
300 oe.path.remove(dir)
301
302 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task']) 302 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
303 sstatefetch = d.getVar('SSTATE_PKGNAME') + '_' + ss['task'] + ".tgz" 303 sstatefetch = d.getVar('SSTATE_PKGNAME') + '_' + ss['task'] + ".tgz"
304 sstatepkg = d.getVar('SSTATE_PKG') + '_' + ss['task'] + ".tgz" 304 sstatepkg = d.getVar('SSTATE_PKG') + '_' + ss['task'] + ".tgz"
@@ -320,11 +320,36 @@ def sstate_installpkg(ss, d):
320 if not signer.verify(sstatepkg + '.sig'): 320 if not signer.verify(sstatepkg + '.sig'):
321 bb.warn("Cannot verify signature on sstate package %s" % sstatepkg) 321 bb.warn("Cannot verify signature on sstate package %s" % sstatepkg)
322 322
323 for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split(): 323 sstateinst = d.getVar("SSTATE_INSTDIR")
324 d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
325
326 for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package']:
324 # All hooks should run in the SSTATE_INSTDIR 327 # All hooks should run in the SSTATE_INSTDIR
325 bb.build.exec_func(f, d, (sstateinst,)) 328 bb.build.exec_func(f, d, (sstateinst,))
326 329
330 return sstate_installpkgdir(ss, d)
331
332def sstate_installpkgdir(ss, d):
333 import oe.path
334 import subprocess
335
336 sstateinst = d.getVar("SSTATE_INSTDIR")
337 d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
338
339 for f in (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
340 # All hooks should run in the SSTATE_INSTDIR
341 bb.build.exec_func(f, d, (sstateinst,))
342
343 def prepdir(dir):
344 # remove dir if it exists, ensure any parent directories do exist
345 if os.path.exists(dir):
346 oe.path.remove(dir)
347 bb.utils.mkdirhier(dir)
348 oe.path.remove(dir)
349
327 for state in ss['dirs']: 350 for state in ss['dirs']:
351 if d.getVar('SSTATE_SKIP_CREATION') == '1':
352 continue
328 prepdir(state[1]) 353 prepdir(state[1])
329 os.rename(sstateinst + state[0], state[1]) 354 os.rename(sstateinst + state[0], state[1])
330 sstate_install(ss, d) 355 sstate_install(ss, d)
@@ -347,18 +372,18 @@ python sstate_hardcode_path_unpack () {
347 import subprocess 372 import subprocess
348 373
349 sstateinst = d.getVar('SSTATE_INSTDIR') 374 sstateinst = d.getVar('SSTATE_INSTDIR')
350 fixmefn = sstateinst + "fixmepath" 375 sstatefixmedir = d.getVar('SSTATE_FIXMEDIR')
376 fixmefn = sstateinst + "fixmepath"
351 if os.path.isfile(fixmefn): 377 if os.path.isfile(fixmefn):
352 staging = d.getVar('STAGING_DIR') 378 staging_target = d.getVar('RECIPE_SYSROOT')
353 staging_target = d.getVar('STAGING_DIR_TARGET') 379 staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
354 staging_host = d.getVar('STAGING_DIR_HOST') 380
355 381 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
356 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d):
357 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIR:%s:g'" % (staging)
358 elif bb.data.inherits_class('cross', d):
359 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIR:%s:g'" % (staging_target, staging)
360 else:
361 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host) 382 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host)
383 elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
384 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (staging_target, staging_host)
385 else:
386 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g'" % (staging_target)
362 387
363 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or '' 388 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
364 for fixmevar in extra_staging_fixmes.split(): 389 for fixmevar in extra_staging_fixmes.split():
@@ -368,6 +393,18 @@ python sstate_hardcode_path_unpack () {
368 # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed 393 # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed
369 sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd) 394 sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd)
370 395
396 # Defer do_populate_sysroot relocation command
397 if sstatefixmedir:
398 bb.utils.mkdirhier(sstatefixmedir)
399 with open(sstatefixmedir + "/fixmepath.cmd", "w") as f:
400 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(fixmefn, sstatefixmedir + "/fixmepath")
401 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(sstateinst, "FIXMEFINALSSTATEINST")
402 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_host, "FIXMEFINALSSTATEHOST")
403 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_target, "FIXMEFINALSSTATETARGET")
404 f.write(sstate_hardcode_cmd)
405 bb.utils.copyfile(fixmefn, sstatefixmedir + "/fixmepath")
406 return
407
371 bb.note("Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd)) 408 bb.note("Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd))
372 subprocess.call(sstate_hardcode_cmd, shell=True) 409 subprocess.call(sstate_hardcode_cmd, shell=True)
373 410
@@ -499,20 +536,19 @@ python sstate_hardcode_path () {
499 # Note: the logic in this function needs to match the reverse logic 536 # Note: the logic in this function needs to match the reverse logic
500 # in sstate_installpkg(ss, d) 537 # in sstate_installpkg(ss, d)
501 538
502 staging = d.getVar('STAGING_DIR') 539 staging_target = d.getVar('RECIPE_SYSROOT')
503 staging_target = d.getVar('STAGING_DIR_TARGET') 540 staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
504 staging_host = d.getVar('STAGING_DIR_HOST')
505 sstate_builddir = d.getVar('SSTATE_BUILDDIR') 541 sstate_builddir = d.getVar('SSTATE_BUILDDIR')
506 542
507 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d): 543 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
508 sstate_grep_cmd = "grep -l -e '%s'" % (staging)
509 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIR:g'" % (staging)
510 elif bb.data.inherits_class('cross', d):
511 sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging)
512 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g; s:%s:FIXMESTAGINGDIR:g'" % (staging_target, staging)
513 else:
514 sstate_grep_cmd = "grep -l -e '%s'" % (staging_host) 544 sstate_grep_cmd = "grep -l -e '%s'" % (staging_host)
515 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host) 545 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host)
546 elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
547 sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging_host)
548 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g; s:%s:FIXMESTAGINGDIRHOST:g'" % (staging_target, staging_host)
549 else:
550 sstate_grep_cmd = "grep -l -e '%s'" % (staging_target)
551 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g'" % (staging_target)
516 552
517 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or '' 553 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
518 for fixmevar in extra_staging_fixmes.split(): 554 for fixmevar in extra_staging_fixmes.split():
@@ -537,14 +573,14 @@ python sstate_hardcode_path () {
537 sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd) 573 sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd)
538 574
539 bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)) 575 bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
540 subprocess.call(sstate_hardcode_cmd, shell=True) 576 subprocess.check_call(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
541 577
542 # If the fixmefn is empty, remove it.. 578 # If the fixmefn is empty, remove it..
543 if os.stat(fixmefn).st_size == 0: 579 if os.stat(fixmefn).st_size == 0:
544 os.remove(fixmefn) 580 os.remove(fixmefn)
545 else: 581 else:
546 bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) 582 bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
547 subprocess.call(sstate_filelist_relative_cmd, shell=True) 583 subprocess.check_call(sstate_filelist_relative_cmd, shell=True)
548} 584}
549 585
550def sstate_package(ss, d): 586def sstate_package(ss, d):
@@ -560,6 +596,8 @@ def sstate_package(ss, d):
560 if not link.startswith(tmpdir): 596 if not link.startswith(tmpdir):
561 return 597 return
562 598
599 #base = os.path.relpath(link, os.path.dirname(path))
600
563 depth = outputpath.rpartition(tmpdir)[2].count('/') 601 depth = outputpath.rpartition(tmpdir)[2].count('/')
564 base = link.partition(tmpdir)[2].strip() 602 base = link.partition(tmpdir)[2].strip()
565 while depth > 1: 603 while depth > 1:
@@ -594,14 +632,14 @@ def sstate_package(ss, d):
594 dstpath = srcpath.replace(state[1], state[2]) 632 dstpath = srcpath.replace(state[1], state[2])
595 make_relative_symlink(srcpath, dstpath, d) 633 make_relative_symlink(srcpath, dstpath, d)
596 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) 634 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
597 oe.path.copyhardlinktree(state[1], sstatebuild + state[0]) 635 os.rename(state[1], sstatebuild + state[0])
598 636
599 workdir = d.getVar('WORKDIR') 637 workdir = d.getVar('WORKDIR')
600 for plain in ss['plaindirs']: 638 for plain in ss['plaindirs']:
601 pdir = plain.replace(workdir, sstatebuild) 639 pdir = plain.replace(workdir, sstatebuild)
602 bb.utils.mkdirhier(plain) 640 bb.utils.mkdirhier(plain)
603 bb.utils.mkdirhier(pdir) 641 bb.utils.mkdirhier(pdir)
604 oe.path.copyhardlinktree(plain, pdir) 642 os.rename(plain, pdir)
605 643
606 d.setVar('SSTATE_BUILDDIR', sstatebuild) 644 d.setVar('SSTATE_BUILDDIR', sstatebuild)
607 d.setVar('SSTATE_PKG', sstatepkg) 645 d.setVar('SSTATE_PKG', sstatepkg)
@@ -614,6 +652,8 @@ def sstate_package(ss, d):
614 652
615 bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) 653 bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
616 654
655 d.setVar('SSTATE_INSTDIR', sstatebuild)
656
617 return 657 return
618 658
619def pstaging_fetch(sstatefetch, sstatepkg, d): 659def pstaging_fetch(sstatefetch, sstatepkg, d):
@@ -672,14 +712,21 @@ sstate_task_prefunc[dirs] = "${WORKDIR}"
672python sstate_task_postfunc () { 712python sstate_task_postfunc () {
673 shared_state = sstate_state_fromvars(d) 713 shared_state = sstate_state_fromvars(d)
674 714
675 sstate_install(shared_state, d)
676 for intercept in shared_state['interceptfuncs']: 715 for intercept in shared_state['interceptfuncs']:
677 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),)) 716 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),))
717
678 omask = os.umask(0o002) 718 omask = os.umask(0o002)
679 if omask != 0o002: 719 if omask != 0o002:
680 bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask) 720 bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
681 sstate_package(shared_state, d) 721 sstate_package(shared_state, d)
682 os.umask(omask) 722 os.umask(omask)
723
724 sstateinst = d.getVar("SSTATE_INSTDIR")
725 d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
726
727 sstate_installpkgdir(shared_state, d)
728
729 bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
683} 730}
684sstate_task_postfunc[dirs] = "${WORKDIR}" 731sstate_task_postfunc[dirs] = "${WORKDIR}"
685 732
@@ -704,9 +751,6 @@ sstate_create_package () {
704 fi 751 fi
705 chmod 0664 $TFILE 752 chmod 0664 $TFILE
706 mv -f $TFILE ${SSTATE_PKG} 753 mv -f $TFILE ${SSTATE_PKG}
707
708 cd ${WORKDIR}
709 rm -rf ${SSTATE_BUILDDIR}
710} 754}
711 755
712python sstate_sign_package () { 756python sstate_sign_package () {
@@ -877,7 +921,7 @@ def setscene_depvalid(task, taskdependees, notneeded, d):
877 bb.debug(2, "Considering setscene task: %s" % (str(taskdependees[task]))) 921 bb.debug(2, "Considering setscene task: %s" % (str(taskdependees[task])))
878 922
879 def isNativeCross(x): 923 def isNativeCross(x):
880 return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x 924 return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross")
881 925
882 # We only need to trigger populate_lic through direct dependencies 926 # We only need to trigger populate_lic through direct dependencies
883 if taskdependees[task][1] == "do_populate_lic": 927 if taskdependees[task][1] == "do_populate_lic":