summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sstate.bbclass8
-rw-r--r--meta/classes/staging.bbclass6
2 files changed, 8 insertions, 6 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 53dcfc8274..9ed0e0c139 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -483,7 +483,7 @@ def sstate_clean_cachefiles(d):
483 ss = sstate_state_fromvars(ld, task) 483 ss = sstate_state_fromvars(ld, task)
484 sstate_clean_cachefile(ss, ld) 484 sstate_clean_cachefile(ss, ld)
485 485
486def sstate_clean_manifest(manifest, d, prefix=None): 486def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
487 import oe.path 487 import oe.path
488 488
489 mfile = open(manifest) 489 mfile = open(manifest)
@@ -501,7 +501,9 @@ def sstate_clean_manifest(manifest, d, prefix=None):
501 if entry.endswith("/"): 501 if entry.endswith("/"):
502 if os.path.islink(entry[:-1]): 502 if os.path.islink(entry[:-1]):
503 os.remove(entry[:-1]) 503 os.remove(entry[:-1])
504 elif os.path.exists(entry) and len(os.listdir(entry)) == 0: 504 elif os.path.exists(entry) and len(os.listdir(entry)) == 0 and not canrace:
505 # Removing directories whilst builds are in progress exposes a race. Only
506 # do it in contexts where it is safe to do so.
505 os.rmdir(entry[:-1]) 507 os.rmdir(entry[:-1])
506 else: 508 else:
507 os.remove(entry) 509 os.remove(entry)
@@ -539,7 +541,7 @@ def sstate_clean(ss, d):
539 for lock in ss['lockfiles']: 541 for lock in ss['lockfiles']:
540 locks.append(bb.utils.lockfile(lock)) 542 locks.append(bb.utils.lockfile(lock))
541 543
542 sstate_clean_manifest(manifest, d) 544 sstate_clean_manifest(manifest, d, canrace=True)
543 545
544 for lock in locks: 546 for lock in locks:
545 bb.utils.unlockfile(lock) 547 bb.utils.unlockfile(lock)
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 506ce0665e..78eb914921 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -408,7 +408,7 @@ python extend_recipe_sysroot() {
408 if os.path.islink(f) and not os.path.exists(f): 408 if os.path.islink(f) and not os.path.exists(f):
409 bb.note("%s no longer exists, removing from sysroot" % f) 409 bb.note("%s no longer exists, removing from sysroot" % f)
410 lnk = os.readlink(f.replace(".complete", "")) 410 lnk = os.readlink(f.replace(".complete", ""))
411 sstate_clean_manifest(depdir + "/" + lnk, d, workdir) 411 sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
412 os.unlink(f) 412 os.unlink(f)
413 os.unlink(f.replace(".complete", "")) 413 os.unlink(f.replace(".complete", ""))
414 414
@@ -453,7 +453,7 @@ python extend_recipe_sysroot() {
453 fl = depdir + "/" + l 453 fl = depdir + "/" + l
454 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l)) 454 bb.note("Task %s no longer depends on %s, removing from sysroot" % (mytaskname, l))
455 lnk = os.readlink(fl) 455 lnk = os.readlink(fl)
456 sstate_clean_manifest(depdir + "/" + lnk, d, workdir) 456 sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
457 os.unlink(fl) 457 os.unlink(fl)
458 os.unlink(fl + ".complete") 458 os.unlink(fl + ".complete")
459 459
@@ -474,7 +474,7 @@ python extend_recipe_sysroot() {
474 continue 474 continue
475 else: 475 else:
476 bb.note("%s exists in sysroot, but is stale (%s vs. %s), removing." % (c, lnk, c + "." + taskhash)) 476 bb.note("%s exists in sysroot, but is stale (%s vs. %s), removing." % (c, lnk, c + "." + taskhash))
477 sstate_clean_manifest(depdir + "/" + lnk, d, workdir) 477 sstate_clean_manifest(depdir + "/" + lnk, d, canrace=True, prefix=workdir)
478 os.unlink(depdir + "/" + c) 478 os.unlink(depdir + "/" + c)
479 if os.path.lexists(depdir + "/" + c + ".complete"): 479 if os.path.lexists(depdir + "/" + c + ".complete"):
480 os.unlink(depdir + "/" + c + ".complete") 480 os.unlink(depdir + "/" + c + ".complete")