Skip to contentSkip to conversation

gcc-runtime: Avoid error when trying to remove nonexistent directories

PATCH In review Phil Blundell 2 participants 3 messages May 2, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-runtime: Avoid error when trying to remove nonexistent directories

If we didn't build libgomp then we won't have installed anything into ${infodir} or ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude. Check whether those directories exist before trying to remove them, else we will lose.

---
 meta/recipes-devtools/gcc/gcc-configure-runtime.inc |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/recipes-devtools/gcc/gcc-configure-runtime.inc +6 -2
index a9f77d9..977a98a 100644
@@ -43,8 +43,12 @@ do_install () {
 		oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/$d/ install
 	done
 	rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
-	rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
-	rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
+	if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
+		rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
+	fi
+	if [ -d ${D}${infodir} ]; then
+		rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
+	fi
 	chown -R root:root ${D}
 }
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 4 lines · Phil Blundell

If we didn't build libgomp then we won't have installed anything into ${infodir} or ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude. Check whether those directories exist before trying to remove them, else we will lose.

Isn't it neater to use rm -rf?

Ross

#2 lore raw
Quoted 7 lines · Ross
Quoted 4 lines · Phil Blundell

If we didn't build libgomp then we won't have installed anything into ${infodir} or ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude. Check whether those directories exist before trying to remove them, else we will lose.

Isn't it neater to use rm -rf?

The original code goes to some trouble to use "rmdir --ignore-fail-on-non-empty", which I assume means that there are some circumstances where those directories do contain other files that we want to keep. Using "rm -rf" would obviously blow the whole thing away.

p.