Patchwork [1/1] gcc-cross-canadian: Clean non shipped empty directories.

login
register
mail settings
Submitter Lianhao Lu
Date March 27, 2012, 4:38 a.m.
Message ID <68f501edc836a42438c8eb49bf8c14cfc706eb9d.1332822880.git.lianhao.lu@intel.com>
Download mbox | patch
Permalink /patch/24607/
State New
Headers show

Comments

Lianhao Lu - March 27, 2012, 4:38 a.m.
Cleaning up non shipped empty directories.

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
---
 meta/recipes-devtools/gcc/gcc-package-sdk.inc |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-package-sdk.inc b/meta/recipes-devtools/gcc/gcc-package-sdk.inc
index 95d6804..ffe9a9e 100644
--- a/meta/recipes-devtools/gcc/gcc-package-sdk.inc
+++ b/meta/recipes-devtools/gcc/gcc-package-sdk.inc
@@ -47,11 +47,11 @@  do_install () {
 	rm -f ${D}${libdir}/libiberty.a
 
 	# Cleanup empty directories which are not shipped
-	# we use rmdir instead of 'rm -f' to ensure the directories are empty
-	rmdir ${D}${libdir}/../lib
-	rmdir ${D}${prefix}/${TARGET_SYS}/lib
-	rmdir ${D}${prefix}/${TARGET_SYS}
-	rmdir ${D}${includedir}
+	# we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
+	local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
+	for i in $empty_dirs; do
+		[ -d $i ] && rmdir --ignore-fail-on-non-empty $i
+	done
 
 	# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
 	# found.