summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-26 23:30:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-27 22:30:06 +0100
commit3de078642925e720c2fca5b89cd3abb8b29d2439 (patch)
treeb3c9ef8b09e8be1238a13e3b1db6a255fa3ba3e2 /meta/classes
parent5ad6333911c8dfb399a94dea37a5188fbf35a2d4 (diff)
downloadpoky-3de078642925e720c2fca5b89cd3abb8b29d2439.tar.gz
staging: Avoid sysroot removal races
Currently a task could remove a dependency needed by another task leading to build failures, often due to missing dependencies (e.g. dynamic libraries not being found). This was often seen for all-arch recipes in package_write_rpm. When removing a dependency, first check that no other task active for the recipe has that same dependency. (From OE-Core rev: ff3617cc2cd5618f48a25aa4e3b2014430fcbe23) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/staging.bbclass25
1 files changed, 20 insertions, 5 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 9d3d2ad9dd..8b833d313c 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -247,6 +247,7 @@ python extend_recipe_sysroot() {
247 import subprocess 247 import subprocess
248 import errno 248 import errno
249 import collections 249 import collections
250 import glob
250 251
251 taskdepdata = d.getVar("BB_TASKDEPDATA", False) 252 taskdepdata = d.getVar("BB_TASKDEPDATA", False)
252 mytaskname = d.getVar("BB_RUNTASK") 253 mytaskname = d.getVar("BB_RUNTASK")
@@ -531,6 +532,7 @@ python extend_recipe_sysroot() {
531 # to be insignificant 532 # to be insignificant
532 taskindex = depdir + "/" + "index." + mytaskname 533 taskindex = depdir + "/" + "index." + mytaskname
533 if os.path.exists(taskindex): 534 if os.path.exists(taskindex):
535 potential = []
534 with open(taskindex, "r") as f: 536 with open(taskindex, "r") as f:
535 for l in f: 537 for l in f:
536 l = l.strip() 538 l = l.strip()
@@ -539,11 +541,24 @@ python extend_recipe_sysroot() {
539 if not os.path.exists(l): 541 if not os.path.exists(l):
540 # Was likely already uninstalled 542 # Was likely already uninstalled
541 continue 543 continue
542 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l)) 544 potential.append(l)
543 lnk = os.readlink(l) 545 # We need to ensure not other task needs this dependency. We hold the sysroot
544 sstate_clean_manifest(depdir + "/" + lnk, d, workdir) 546 # lock so we ca search the indexes to check
545 os.unlink(l) 547 if potential:
546 os.unlink(l + ".complete") 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")
547 with open(taskindex, "w") as f: 562 with open(taskindex, "w") as f:
548 for l in sorted(installed): 563 for l in sorted(installed):
549 f.write(l + "\n") 564 f.write(l + "\n")