summaryrefslogtreecommitdiffstats
path: root/meta
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-09-11 22:15:59 +0100
commit8329bfd1566b1fc584a904f5429dec445f7ebc9c (patch)
tree54485a676335c20c911291e1763cbf16b187188d /meta
parent292cb6a32f71a19928d93b65c43038fb9633e900 (diff)
downloadpoky-8329bfd1566b1fc584a904f5429dec445f7ebc9c.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) (From OE-Core rev: 970d4df7336e5102ac61e66689e977fb2e41a1aa) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 5b45fe40db81292dd6bb57b210d1e4ba32e65e9e) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 590be61a62..286d7b7e9e 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -470,8 +470,6 @@ python extend_recipe_sysroot() {
470 multilibs = {} 470 multilibs = {}
471 manifests = {} 471 manifests = {}
472 472
473 installed = []
474
475 for f in os.listdir(depdir): 473 for f in os.listdir(depdir):
476 if not f.endswith(".complete"): 474 if not f.endswith(".complete"):
477 continue 475 continue
@@ -483,16 +481,52 @@ python extend_recipe_sysroot() {
483 os.unlink(f) 481 os.unlink(f)
484 os.unlink(f.replace(".complete", "")) 482 os.unlink(f.replace(".complete", ""))
485 483
484 installed = []
486 for dep in configuredeps: 485 for dep in configuredeps:
487 c = setscenedeps[dep][0] 486 c = setscenedeps[dep][0]
488 taskhash = setscenedeps[dep][5]
489 taskmanifest = depdir + "/" + c + "." + taskhash
490 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"): 487 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
491 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c) 488 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
492 continue 489 continue
493
494 installed.append(c) 490 installed.append(c)
495 491
492 # We want to remove anything which this task previously installed but is no longer a dependency
493 taskindex = depdir + "/" + "index." + mytaskname
494 if os.path.exists(taskindex):
495 potential = []
496 with open(taskindex, "r") as f:
497 for l in f:
498 l = l.strip()
499 if l not in installed:
500 l = depdir + "/" + l
501 if not os.path.exists(l):
502 # Was likely already uninstalled
503 continue
504 potential.append(l)
505 # We need to ensure not other task needs this dependency. We hold the sysroot
506 # lock so we ca search the indexes to check
507 if potential:
508 for i in glob.glob(depdir + "/index.*"):
509 if i.endswith("." + mytaskname):
510 continue
511 with open(i, "r") as f:
512 for l in f:
513 l = l.strip()
514 if l in potential:
515 potential.remove(l)
516 for l in potential:
517 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
518 lnk = os.readlink(l)
519 sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
520 os.unlink(l)
521 os.unlink(l + ".complete")
522
523 for dep in configuredeps:
524 c = setscenedeps[dep][0]
525 if c not in installed:
526 continue
527 taskhash = setscenedeps[dep][5]
528 taskmanifest = depdir + "/" + c + "." + taskhash
529
496 if os.path.exists(depdir + "/" + c): 530 if os.path.exists(depdir + "/" + c):
497 lnk = os.readlink(depdir + "/" + c) 531 lnk = os.readlink(depdir + "/" + c)
498 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"): 532 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
@@ -607,39 +641,6 @@ python extend_recipe_sysroot() {
607 c = setscenedeps[dep][0] 641 c = setscenedeps[dep][0]
608 os.symlink(manifests[dep], depdir + "/" + c + ".complete") 642 os.symlink(manifests[dep], depdir + "/" + c + ".complete")
609 643
610 # We want to remove anything which this task previously installed but is no longer a dependency
611 # This could potentially race against another task which also installed it but still requires it
612 # but the alternative is not doing anything at all and that race window should be small enough
613 # to be insignificant
614 taskindex = depdir + "/" + "index." + mytaskname
615 if os.path.exists(taskindex):
616 potential = []
617 with open(taskindex, "r") as f:
618 for l in f:
619 l = l.strip()
620 if l not in installed:
621 l = depdir + "/" + l
622 if not os.path.exists(l):
623 # Was likely already uninstalled
624 continue
625 potential.append(l)
626 # We need to ensure not other task needs this dependency. We hold the sysroot
627 # lock so we ca search the indexes to check
628 if potential:
629 for i in glob.glob(depdir + "/index.*"):
630 if i.endswith("." + mytaskname):
631 continue
632 with open(i, "r") as f:
633 for l in f:
634 l = l.strip()
635 if l in potential:
636 potential.remove(l)
637 for l in potential:
638 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
639 lnk = os.readlink(l)
640 sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
641 os.unlink(l)
642 os.unlink(l + ".complete")
643 with open(taskindex, "w") as f: 644 with open(taskindex, "w") as f:
644 for l in sorted(installed): 645 for l in sorted(installed):
645 f.write(l + "\n") 646 f.write(l + "\n")