[oe] [PATCH] package.bbclass: copy dotfiles in root D to PKGD

Michael Smith msmith at cbnco.com
Fri Sep 24 19:10:53 UTC 2010


Use shtuil.copytree() to copy D ("image") to PKGD ("package"). The
previous system("cp %s/* ...") missed dotfiles/dirs at the top-level.

Relies on Python 2.5+ version of copytree() to create missing path
components.

Signed-off-by: Michael Smith <msmith at cbnco.com>
---
 classes/package.bbclass |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/classes/package.bbclass b/classes/package.bbclass
index c378133..be2e514 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -354,15 +354,18 @@ python package_do_split_locales() {
 }
 
 python perform_packagecopy () {
-	dest = bb.data.getVar('D', d, True)
-	dvar = bb.data.getVar('PKGD', d, True)
+	import shutil
 
-	bb.mkdirhier(dvar)
+	installdest = bb.data.getVar('D', d, True)
+	pkgcopy = bb.data.getVar('PKGD', d, True)
 
-	# Start by package population by taking a copy of the installed 
+	# Start package population by taking a copy of the installed 
 	# files to operate on
-	os.system('rm -rf %s/*' % (dvar))
-	os.system('cp -pPR %s/* %s/' % (dest, dvar))
+	shutil.rmtree(pkgcopy, True)
+
+	# copytree() automatically creates missing path components in pkgcopy.
+	# Preserve symlinks (don't dereference).
+	shutil.copytree(installdest, pkgcopy, symlinks=True)
 }
 
 python populate_packages () {
-- 
1.7.0.4





More information about the Openembedded-devel mailing list