diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-26 23:30:39 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-11 22:15:59 +0100 |
commit | 292cb6a32f71a19928d93b65c43038fb9633e900 (patch) | |
tree | 5c46e72e978f504a30d113e90229a4c81dfabfcb /meta/classes | |
parent | 54efca180ba02bd7a3d51d23ed426c7b31d06eda (diff) | |
download | poky-292cb6a32f71a19928d93b65c43038fb9633e900.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)
(From OE-Core rev: 67438ac91a40429affc952ad1d7e92c763f52bab)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 3de078642925e720c2fca5b89cd3abb8b29d2439)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/staging.bbclass | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass index a0b74a2258..590be61a62 100644 --- a/meta/classes/staging.bbclass +++ b/meta/classes/staging.bbclass | |||
@@ -328,6 +328,7 @@ python extend_recipe_sysroot() { | |||
328 | import subprocess | 328 | import subprocess |
329 | import errno | 329 | import errno |
330 | import collections | 330 | import collections |
331 | import glob | ||
331 | 332 | ||
332 | taskdepdata = d.getVar("BB_TASKDEPDATA", False) | 333 | taskdepdata = d.getVar("BB_TASKDEPDATA", False) |
333 | mytaskname = d.getVar("BB_RUNTASK") | 334 | mytaskname = d.getVar("BB_RUNTASK") |
@@ -612,6 +613,7 @@ python extend_recipe_sysroot() { | |||
612 | # to be insignificant | 613 | # to be insignificant |
613 | taskindex = depdir + "/" + "index." + mytaskname | 614 | taskindex = depdir + "/" + "index." + mytaskname |
614 | if os.path.exists(taskindex): | 615 | if os.path.exists(taskindex): |
616 | potential = [] | ||
615 | with open(taskindex, "r") as f: | 617 | with open(taskindex, "r") as f: |
616 | for l in f: | 618 | for l in f: |
617 | l = l.strip() | 619 | l = l.strip() |
@@ -620,11 +622,24 @@ python extend_recipe_sysroot() { | |||
620 | if not os.path.exists(l): | 622 | if not os.path.exists(l): |
621 | # Was likely already uninstalled | 623 | # Was likely already uninstalled |
622 | continue | 624 | continue |
623 | bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l)) | 625 | potential.append(l) |
624 | lnk = os.readlink(l) | 626 | # We need to ensure not other task needs this dependency. We hold the sysroot |
625 | sstate_clean_manifest(depdir + "/" + lnk, d, workdir) | 627 | # lock so we ca search the indexes to check |
626 | os.unlink(l) | 628 | if potential: |
627 | os.unlink(l + ".complete") | 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") | ||
628 | with open(taskindex, "w") as f: | 643 | with open(taskindex, "w") as f: |
629 | for l in sorted(installed): | 644 | for l in sorted(installed): |
630 | f.write(l + "\n") | 645 | f.write(l + "\n") |