diff options
-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 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") |