aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/staging.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2010-06-25 13:56:04 +0100
committerJoshua Lock <josh@linux.intel.com>2010-07-16 15:31:04 +0100
commitf23aa92f085d058df15f44c0a5ff9024952f1cd9 (patch)
tree0d85a6a6ccfc80c9620b912652bd328cdb88866c /meta/classes/staging.bbclass
parent63e6ba85677b8aa9f4cf9942a1fccbb8a8c72660 (diff)
downloadopenembedded-core-contrib-f23aa92f085d058df15f44c0a5ff9024952f1cd9.tar.gz
staging: fix staging of empty directories and add localstatedir
If a program creates an empty directory during its build it's probably for a good reason, so if it exists it seems sensible to stage it. Some programs require localstatedir to operate so we should be sure to stage it. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta/classes/staging.bbclass')
-rw-r--r--meta/classes/staging.bbclass12
1 files changed, 10 insertions, 2 deletions
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index e03ed2a5ef..b771b92fae 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -13,10 +13,17 @@ packagedstaging_fastpath () {
sysroot_stage_dir() {
src="$1"
dest="$2"
- # This will remove empty directories so we can ignore them
+ # if the src doesn't exist don't do anything
+ if [ ! -d "$src" ]; then
+ return
+ fi
+
+ # We only want to stage the contents of $src if it's non-empty so first rmdir $src
+ # then if it still exists (rmdir on non-empty dir fails) we can copy its contents
rmdir "$src" 2> /dev/null || true
+ # However we always want to stage a $src itself, even if it's empty
+ mkdir -p "$dest"
if [ -d "$src" ]; then
- mkdir -p "$dest"
cp -fpPR "$src"/* "$dest"
fi
}
@@ -52,6 +59,7 @@ sysroot_stage_dirs() {
sysroot_stage_dir $from${base_sbindir} $to${STAGING_DIR_HOST}${base_sbindir}
sysroot_stage_dir $from${libexecdir} $to${STAGING_DIR_HOST}${libexecdir}
sysroot_stage_dir $from${sysconfdir} $to${STAGING_DIR_HOST}${sysconfdir}
+ sysroot_stage_dir $from${localstatedir} $to${STAGING_DIR_HOST}${localstatedir}
fi
if [ -d $from${libdir} ]
then