aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-04 17:33:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-07 14:47:21 +0000
commit51834006476786f847b3ca60d5ed83a952fc64cb (patch)
tree15e50bda2b7553ce9c5aab0a2375ee7fc02eea10 /meta/classes
parent9792ba51c5caf56d182f1290df41f2a89b85f744 (diff)
downloadopenembedded-core-contrib-51834006476786f847b3ca60d5ed83a952fc64cb.tar.gz
openembedded-core-contrib-51834006476786f847b3ca60d5ed83a952fc64cb.tar.bz2
openembedded-core-contrib-51834006476786f847b3ca60d5ed83a952fc64cb.zip
staging: Add shared manifest support
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/staging.bbclass23
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() {
bb.note("\n".join(msgbuf))
stagingdir = d.getVar("STAGING_DIR")
+ sharedmanifests = stagingdir + "-components/manifests"
recipesysroot = d.getVar("RECIPE_SYSROOT")
recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE")
current_variant = d.getVar("BBEXTENDVARIANT")
@@ -493,6 +494,7 @@ python extend_recipe_sysroot() {
depdir = recipesysrootnative + "/installeddeps"
bb.utils.mkdirhier(depdir)
+ bb.utils.mkdirhier(sharedmanifests)
lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
@@ -588,6 +590,27 @@ python extend_recipe_sysroot() {
dest = staging_copyfile(l, destsysroot, fixme[''], postinsts, stagingdir, seendirs)
if dest:
m.write(dest.replace(workdir + "/", "") + "\n")
+ # Having multiple identical manifests in each sysroot eats diskspace so
+ # create a shared pool of them.
+ sharedm = sharedmanifests + "/" + os.path.basename(taskmanifest)
+ if not os.path.exists(sharedm):
+ smlock = bb.utils.lockfile(sharedm + ".lock")
+ # Can race here. You'd think it just means we may not end up with all copies hardlinked to each other
+ # but python can lose file handles so we need to do this under a lock.
+ try:
+ if not os.path.exists(sharedm):
+ os.rename(taskmanifest, sharedm)
+ except OSError:
+ pass
+ bb.utils.unlockfile(smlock)
+ if os.path.exists(sharedm):
+ # If we're crossing mount points we'll not reach here.
+ if os.path.exists(taskmanifest):
+ if os.path.getsize(sharedm) != os.path.getsize(taskmanifest):
+ # Order of entries can differ, overall size shouldn't
+ raise Exception("Manifests %s and %s differ in size and shouldn't?" % (sharedm, taskmanifest))
+ os.unlink(taskmanifest)
+ os.link(sharedm, taskmanifest)
for f in fixme:
if f == '':