aboutsummaryrefslogtreecommitdiff
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-09-11 22:13:20 +0100
commitbb5c7b792162f6397634d05c151ec67ff60dd7d1 (patch)
treeb0e2785c0288ecefa4c7af098ec0cd4b4f1a7257
parent7f74ff71ae9d9ef1ca55c12be16094f1a9d7fade (diff)
downloadopenembedded-core-bb5c7b792162f6397634d05c151ec67ff60dd7d1.zip
openembedded-core-bb5c7b792162f6397634d05c151ec67ff60dd7d1.tar.gz
openembedded-core-bb5c7b792162f6397634d05c151ec67ff60dd7d1.tar.bz2
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> (cherry picked from commit 3de078642925e720c2fca5b89cd3abb8b29d2439) Signed-off-by: Armin Kuster <akuster808@gmail.com>
-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 a0b74a2..590be61 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -328,6 +328,7 @@ python extend_recipe_sysroot() {
import subprocess
import errno
import collections
+ import glob
taskdepdata = d.getVar("BB_TASKDEPDATA", False)
mytaskname = d.getVar("BB_RUNTASK")
@@ -612,6 +613,7 @@ python extend_recipe_sysroot() {
# to be insignificant
taskindex = depdir + "/" + "index." + mytaskname
if os.path.exists(taskindex):
+ potential = []
with open(taskindex, "r") as f:
for l in f:
l = l.strip()
@@ -620,11 +622,24 @@ python extend_recipe_sysroot() {
if not os.path.exists(l):
# Was likely already uninstalled
continue
- bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
- lnk = os.readlink(l)
- sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
- os.unlink(l)
- os.unlink(l + ".complete")
+ potential.append(l)
+ # We need to ensure not other task needs this dependency. We hold the sysroot
+ # lock so we ca search the indexes to check
+ if potential:
+ for i in glob.glob(depdir + "/index.*"):
+ if i.endswith("." + mytaskname):
+ continue
+ with open(i, "r") as f:
+ for l in f:
+ l = l.strip()
+ if l in potential:
+ potential.remove(l)
+ for l in potential:
+ bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
+ lnk = os.readlink(l)
+ sstate_clean_manifest(depdir + "/" + lnk, d, workdir)
+ os.unlink(l)
+ os.unlink(l + ".complete")
with open(taskindex, "w") as f:
for l in sorted(installed):
f.write(l + "\n")