diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-04 17:33:27 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-07 14:50:09 +0000 |
commit | 175a4570322a4909c223b193fcb77f00bcb8362a (patch) | |
tree | 7980bc18a15545c3760ae3f86066fa0ec8430d74 | |
parent | 4764c113f988e596f30e484720e694b413211da9 (diff) | |
download | poky-175a4570322a4909c223b193fcb77f00bcb8362a.tar.gz |
staging: Add shared manifest support
(From OE-Core rev: 51834006476786f847b3ca60d5ed83a952fc64cb)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/staging.bbclass | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass index b92bdaf490..bd798ba9bc 100644 --- a/meta/classes/staging.bbclass +++ b/meta/classes/staging.bbclass | |||
@@ -479,6 +479,7 @@ python extend_recipe_sysroot() { | |||
479 | bb.note("\n".join(msgbuf)) | 479 | bb.note("\n".join(msgbuf)) |
480 | 480 | ||
481 | stagingdir = d.getVar("STAGING_DIR") | 481 | stagingdir = d.getVar("STAGING_DIR") |
482 | sharedmanifests = stagingdir + "-components/manifests" | ||
482 | recipesysroot = d.getVar("RECIPE_SYSROOT") | 483 | recipesysroot = d.getVar("RECIPE_SYSROOT") |
483 | recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE") | 484 | recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE") |
484 | current_variant = d.getVar("BBEXTENDVARIANT") | 485 | current_variant = d.getVar("BBEXTENDVARIANT") |
@@ -493,6 +494,7 @@ python extend_recipe_sysroot() { | |||
493 | 494 | ||
494 | depdir = recipesysrootnative + "/installeddeps" | 495 | depdir = recipesysrootnative + "/installeddeps" |
495 | bb.utils.mkdirhier(depdir) | 496 | bb.utils.mkdirhier(depdir) |
497 | bb.utils.mkdirhier(sharedmanifests) | ||
496 | 498 | ||
497 | lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock") | 499 | lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock") |
498 | 500 | ||
@@ -588,6 +590,27 @@ python extend_recipe_sysroot() { | |||
588 | dest = staging_copyfile(l, destsysroot, fixme[''], postinsts, stagingdir, seendirs) | 590 | dest = staging_copyfile(l, destsysroot, fixme[''], postinsts, stagingdir, seendirs) |
589 | if dest: | 591 | if dest: |
590 | m.write(dest.replace(workdir + "/", "") + "\n") | 592 | m.write(dest.replace(workdir + "/", "") + "\n") |
593 | # Having multiple identical manifests in each sysroot eats diskspace so | ||
594 | # create a shared pool of them. | ||
595 | sharedm = sharedmanifests + "/" + os.path.basename(taskmanifest) | ||
596 | if not os.path.exists(sharedm): | ||
597 | smlock = bb.utils.lockfile(sharedm + ".lock") | ||
598 | # Can race here. You'd think it just means we may not end up with all copies hardlinked to each other | ||
599 | # but python can lose file handles so we need to do this under a lock. | ||
600 | try: | ||
601 | if not os.path.exists(sharedm): | ||
602 | os.rename(taskmanifest, sharedm) | ||
603 | except OSError: | ||
604 | pass | ||
605 | bb.utils.unlockfile(smlock) | ||
606 | if os.path.exists(sharedm): | ||
607 | # If we're crossing mount points we'll not reach here. | ||
608 | if os.path.exists(taskmanifest): | ||
609 | if os.path.getsize(sharedm) != os.path.getsize(taskmanifest): | ||
610 | # Order of entries can differ, overall size shouldn't | ||
611 | raise Exception("Manifests %s and %s differ in size and shouldn't?" % (sharedm, taskmanifest)) | ||
612 | os.unlink(taskmanifest) | ||
613 | os.link(sharedm, taskmanifest) | ||
591 | 614 | ||
592 | for f in fixme: | 615 | for f in fixme: |
593 | if f == '': | 616 | if f == '': |