summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-27 09:21:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-27 22:30:06 +0100
commit5b45fe40db81292dd6bb57b210d1e4ba32e65e9e (patch)
treeac3d729505129b810fabdbf175e7e8c641fce8f4 /meta/classes
parent3de078642925e720c2fca5b89cd3abb8b29d2439 (diff)
downloadpoky-5b45fe40db81292dd6bb57b210d1e4ba32e65e9e.tar.gz
staging: Ensure dependencies are removed before being added
Currently items are added to the sysroot, the obsolete items are removed. If a change such as pkgconfig -> pkgconf is made, this leads to conflicts of overlapping files in the sysroot. In order to better support this, handle removing items before adding them. This requires some minor refactoring to construct the installed list before the main function loop, otherwise there are no changes in this patch other than reordering the operations. (From OE-Core rev: add4f107c151d32d9ea914bb0b93c3d3c17c776c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/staging.bbclass77
1 files changed, 39 insertions, 38 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 8b833d313c..eb06f398ac 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -389,8 +389,6 @@ python extend_recipe_sysroot() {
389 multilibs = {} 389 multilibs = {}
390 manifests = {} 390 manifests = {}
391 391
392 installed = []
393
394 for f in os.listdir(depdir): 392 for f in os.listdir(depdir):
395 if not f.endswith(".complete"): 393 if not f.endswith(".complete"):
396 continue 394 continue
@@ -402,16 +400,52 @@ python extend_recipe_sysroot() {
402 os.unlink(f) 400 os.unlink(f)
403 os.unlink(f.replace(".complete", "")) 401 os.unlink(f.replace(".complete", ""))
404 402
403 installed = []
405 for dep in configuredeps: 404 for dep in configuredeps:
406 c = setscenedeps[dep][0] 405 c = setscenedeps[dep][0]
407 taskhash = setscenedeps[dep][5]
408 taskmanifest = depdir + "/" + c + "." + taskhash
409 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"): 406 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
410 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c) 407 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
411 continue 408 continue
412
413 installed.append(c) 409 installed.append(c)
414 410
411 # We want to remove anything which this task previously installed but is no longer a dependency
412 taskindex = depdir + "/" + "index." + mytaskname
413 if os.path.exists(taskindex):
414 potential = []
415 with open(taskindex, "r") as f:
416 for l in f:
417 l = l.strip()
418 if l not in installed:
419 l = depdir + "/" + l
420 if not os.path.exists(l):
421 # Was likely already uninstalled
422 continue
423 potential.append(l)
424 # We need to ensure not other task needs this dependency. We hold the sysroot
425 # lock so we ca search the indexes to check
426 if potential:
427 for i in glob.glob(depdir + "/index.*"):
428 if i.endswith("." + mytaskname):
429 continue
430 with open(i, "r") as f:
431 for l in f:
432 l = l.strip()
433 if l in potential:
434 potential.remove(l)
435 for l in potential:
436 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
437 lnk = os.readlink(l)
438 sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
439 os.unlink(l)
440 os.unlink(l + ".complete")
441
442 for dep in configuredeps:
443 c = setscenedeps[dep][0]
444 if c not in installed:
445 continue
446 taskhash = setscenedeps[dep][5]
447 taskmanifest = depdir + "/" + c + "." + taskhash
448
415 if os.path.exists(depdir + "/" + c): 449 if os.path.exists(depdir + "/" + c):
416 lnk = os.readlink(depdir + "/" + c) 450 lnk = os.readlink(depdir + "/" + c)
417 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"): 451 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
@@ -526,39 +560,6 @@ python extend_recipe_sysroot() {
526 c = setscenedeps[dep][0] 560 c = setscenedeps[dep][0]
527 os.symlink(manifests[dep], depdir + "/" + c + ".complete") 561 os.symlink(manifests[dep], depdir + "/" + c + ".complete")
528 562
529 # We want to remove anything which this task previously installed but is no longer a dependency
530 # This could potentially race against another task which also installed it but still requires it
531 # but the alternative is not doing anything at all and that race window should be small enough
532 # to be insignificant
533 taskindex = depdir + "/" + "index." + mytaskname
534 if os.path.exists(taskindex):
535 potential = []
536 with open(taskindex, "r") as f:
537 for l in f:
538 l = l.strip()
539 if l not in installed:
540 l = depdir + "/" + l
541 if not os.path.exists(l):
542 # Was likely already uninstalled
543 continue
544 potential.append(l)
545 # We need to ensure not other task needs this dependency. We hold the sysroot
546 # lock so we ca search the indexes to check
547 if potential:
548 for i in glob.glob(depdir + "/index.*"):
549 if i.endswith("." + mytaskname):
550 continue
551 with open(i, "r") as f:
552 for l in f:
553 l = l.strip()
554 if l in potential:
555 potential.remove(l)
556 for l in potential:
557 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
558 lnk = os.readlink(l)
559 sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
560 os.unlink(l)
561 os.unlink(l + ".complete")
562 with open(taskindex, "w") as f: 563 with open(taskindex, "w") as f:
563 for l in sorted(installed): 564 for l in sorted(installed):
564 f.write(l + "\n") 565 f.write(l + "\n")