summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-23 16:35:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-24 23:43:33 +0000
commitfaf70253bae495b1c366171339073174fd6ebb76 (patch)
treef0e3ddf60612c902daefaefd745394a05a09dde0 /meta/classes
parentce9cbae874495b71b148f32a4f3bfbc1c82e3f41 (diff)
downloadpoky-faf70253bae495b1c366171339073174fd6ebb76.tar.gz
staging: Remove uninstalled dependencies from sysroots
Currently, if something is added to a sysroot, its hash remains unchanged, and it continues to be buildable, it doesn't get removed from the sysroot. This patch handles the case where something is removed from DEPENDS or [depends]. It does introduce its own issue where something could get removed even though some other task in parallel may have the same requirement. This case should be extrememly rare and fixing the more common DEPENDS removal is likely the bigger win though. (From OE-Core rev: 06227bc5e533841ab12cde84a6ed6f8b8ddeb5cb) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/staging.bbclass28
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 6dd21e8ec4..27fcd1efa9 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -469,6 +469,8 @@ python extend_recipe_sysroot() {
469 multilibs = {} 469 multilibs = {}
470 manifests = {} 470 manifests = {}
471 471
472 installed = []
473
472 for f in os.listdir(depdir): 474 for f in os.listdir(depdir):
473 if not f.endswith(".complete"): 475 if not f.endswith(".complete"):
474 continue 476 continue
@@ -487,6 +489,9 @@ python extend_recipe_sysroot() {
487 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"): 489 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
488 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c) 490 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
489 continue 491 continue
492
493 installed.append(c)
494
490 if os.path.exists(depdir + "/" + c): 495 if os.path.exists(depdir + "/" + c):
491 lnk = os.readlink(depdir + "/" + c) 496 lnk = os.readlink(depdir + "/" + c)
492 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"): 497 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
@@ -601,6 +606,29 @@ python extend_recipe_sysroot() {
601 c = setscenedeps[dep][0] 606 c = setscenedeps[dep][0]
602 os.symlink(manifests[dep], depdir + "/" + c + ".complete") 607 os.symlink(manifests[dep], depdir + "/" + c + ".complete")
603 608
609 # We want to remove anything which this task previously installed but is no longer a dependency
610 # This could potentially race against another task which also installed it but still requires it
611 # but the alternative is not doing anything at all and that race window should be small enough
612 # to be insignificant
613 taskindex = depdir + "/" + "index." + mytaskname
614 if os.path.exists(taskindex):
615 with open(taskindex, "r") as f:
616 for l in f:
617 l = l.strip()
618 if l not in installed:
619 l = depdir + "/" + l
620 if not os.path.exists(l):
621 # Was likely already uninstalled
622 continue
623 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
624 lnk = os.readlink(l)
625 sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
626 os.unlink(l)
627 os.unlink(l + ".complete")
628 with open(taskindex, "w") as f:
629 for l in sorted(installed):
630 f.write(l + "\n")
631
604 bb.utils.unlockfile(lock) 632 bb.utils.unlockfile(lock)
605} 633}
606extend_recipe_sysroot[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA" 634extend_recipe_sysroot[vardepsexclude] += "MACHINE_ARCH PACKAGE_EXTRA_ARCHS SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"