diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-30 11:48:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-31 16:58:36 +0100 |
commit | 2feb9e20e464088c377fadb9344da28100662130 (patch) | |
tree | 69c4398b44d9fab60a66c1e95bffd457d84630f5 /meta/classes-global | |
parent | 3220a20b9862301d94118a271c8b054018541cd4 (diff) | |
download | poky-2feb9e20e464088c377fadb9344da28100662130.tar.gz |
sstate/buildhistory: Fix plaindirs handling to occur before SSTATEPOSTINSTFUNCS
buildhistory is showing issues where plaindirs installed files (such as package
listings) are not reliably being handled with installs from sstate.
The reason is that plaindirs is being handled after SSTATEPOSTINSTFUNCS
instead of before it, meaning the files visible in a non-sstate accelerated
code run are different to show from an accelerated run.
This can be observed by the missing files lists for packages in buildhistory, both
in from scratch builds and in builds from sstate. In builds where sstate is installed
over an existing build directory, the files are present though, so there is a
determinism problem.
Fix this by moving the code into sstate_install, this is the only call
site for the funciton.
Since the move needs prepdir, move that as well as it's call site,
being careful to handle the two different definitions of SSTATE_INSTDIR. The
version originally in the function was obsolete and was causing the postinstfuncs
to run in an incorrect directory. The only user is buildhistory and it wasn't
sensitive to cwd however so this happened not to cause a problem. Fix the
code to use the correct location.
(From OE-Core rev: 62ee349cf18532dac8736488752c00e89de78fcd)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-global')
-rw-r--r-- | meta/classes-global/sstate.bbclass | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index f4ebeb5859..beb22f424e 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass | |||
@@ -223,12 +223,23 @@ def sstate_install(ss, d): | |||
223 | import oe.sstatesig | 223 | import oe.sstatesig |
224 | import subprocess | 224 | import subprocess |
225 | 225 | ||
226 | def prepdir(dir): | ||
227 | # remove dir if it exists, ensure any parent directories do exist | ||
228 | if os.path.exists(dir): | ||
229 | oe.path.remove(dir) | ||
230 | bb.utils.mkdirhier(dir) | ||
231 | oe.path.remove(dir) | ||
232 | |||
233 | sstateinst = d.getVar("SSTATE_INSTDIR") | ||
234 | |||
235 | for state in ss['dirs']: | ||
236 | prepdir(state[1]) | ||
237 | bb.utils.rename(sstateinst + state[0], state[1]) | ||
238 | |||
226 | sharedfiles = [] | 239 | sharedfiles = [] |
227 | shareddirs = [] | 240 | shareddirs = [] |
228 | bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}")) | 241 | bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}")) |
229 | 242 | ||
230 | sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task']) | ||
231 | |||
232 | manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d) | 243 | manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d) |
233 | 244 | ||
234 | if os.access(manifest, os.R_OK): | 245 | if os.access(manifest, os.R_OK): |
@@ -327,6 +338,17 @@ def sstate_install(ss, d): | |||
327 | if os.path.exists(state[1]): | 338 | if os.path.exists(state[1]): |
328 | oe.path.copyhardlinktree(state[1], state[2]) | 339 | oe.path.copyhardlinktree(state[1], state[2]) |
329 | 340 | ||
341 | for plain in ss['plaindirs']: | ||
342 | workdir = d.getVar('WORKDIR') | ||
343 | sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared") | ||
344 | src = sstateinst + "/" + plain.replace(workdir, '') | ||
345 | if sharedworkdir in plain: | ||
346 | src = sstateinst + "/" + plain.replace(sharedworkdir, '') | ||
347 | dest = plain | ||
348 | bb.utils.mkdirhier(src) | ||
349 | prepdir(dest) | ||
350 | bb.utils.rename(src, dest) | ||
351 | |||
330 | for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split(): | 352 | for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split(): |
331 | # All hooks should run in the SSTATE_INSTDIR | 353 | # All hooks should run in the SSTATE_INSTDIR |
332 | bb.build.exec_func(postinst, d, (sstateinst,)) | 354 | bb.build.exec_func(postinst, d, (sstateinst,)) |
@@ -391,29 +413,8 @@ def sstate_installpkgdir(ss, d): | |||
391 | # All hooks should run in the SSTATE_INSTDIR | 413 | # All hooks should run in the SSTATE_INSTDIR |
392 | bb.build.exec_func(f, d, (sstateinst,)) | 414 | bb.build.exec_func(f, d, (sstateinst,)) |
393 | 415 | ||
394 | def prepdir(dir): | ||
395 | # remove dir if it exists, ensure any parent directories do exist | ||
396 | if os.path.exists(dir): | ||
397 | oe.path.remove(dir) | ||
398 | bb.utils.mkdirhier(dir) | ||
399 | oe.path.remove(dir) | ||
400 | |||
401 | for state in ss['dirs']: | ||
402 | prepdir(state[1]) | ||
403 | bb.utils.rename(sstateinst + state[0], state[1]) | ||
404 | sstate_install(ss, d) | 416 | sstate_install(ss, d) |
405 | 417 | ||
406 | for plain in ss['plaindirs']: | ||
407 | workdir = d.getVar('WORKDIR') | ||
408 | sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared") | ||
409 | src = sstateinst + "/" + plain.replace(workdir, '') | ||
410 | if sharedworkdir in plain: | ||
411 | src = sstateinst + "/" + plain.replace(sharedworkdir, '') | ||
412 | dest = plain | ||
413 | bb.utils.mkdirhier(src) | ||
414 | prepdir(dest) | ||
415 | bb.utils.rename(src, dest) | ||
416 | |||
417 | return True | 418 | return True |
418 | 419 | ||
419 | python sstate_hardcode_path_unpack () { | 420 | python sstate_hardcode_path_unpack () { |