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

Michael Smith msmith at cbnco.com
Fri Oct 8 13:34:12 UTC 2010


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

Signed-off-by: Michael Smith <msmith at cbnco.com>
---

I sent an earlier version of this a couple of weeks back, but it relied
on shutil.copytree() functionality only available in Python 2.5+. This
version should work on 2.4 (i.e. RHEL 5).

 classes/package.bbclass |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/classes/package.bbclass b/classes/package.bbclass
index 35d9864..e7659ae 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -354,15 +354,20 @@ python package_do_split_locales() {
 }
 
 python perform_packagecopy () {
-	dest = bb.data.getVar('D', d, True)
-	dvar = bb.data.getVar('PKGD', d, True)
+	import shutil
+
+	installdest = bb.data.getVar('D', d, True)
+	pkgcopy = bb.data.getVar('PKGD', d, True)
 
-	bb.mkdirhier(dvar)
+	# Start package population by taking a copy of the installed 
+	# files to operate on. Create missing parent directories of
+	# pkgcopy first (shutil.copytree() does this automatically but only
+	# in Python 2.5+).
+	bb.mkdirhier(pkgcopy)
+	shutil.rmtree(pkgcopy, True)
 
-	# Start by 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))
+	# Preserve symlinks.
+	shutil.copytree(installdest, pkgcopy, symlinks=True)
 }
 
 python populate_packages () {
-- 
1.7.0.4





More information about the Openembedded-devel mailing list