Skip to contentSkip to conversation

package.bbclass: copy dotfiles in root D to PKGD

PATCH Superseded Michael Smith 2 participants 2 messages Sep 24, 2010

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass: copy dotfiles in root D to PKGD

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.

---
 classes/package.bbclass |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
classes/package.bbclass +9 -6
index c378133..be2e514 100644
@@ -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 () {
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Michael Smith

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.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics