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

Frans Meulenbroeks fransmeulenbroeks at gmail.com
Mon Oct 18 07:43:58 UTC 2010


2010/10/18 Graham Gower <graham.gower at gmail.com>:
>>> On Fri, Oct 8, 2010 at 6:34 AM, Michael Smith <msmith at cbnco.com> wrote:
>>>
>>>> Use shutil.copytree() to copy D ("image") to PKGD ("package"). The
>>>> previous system("cp %s/* ...") missed dotfiles/dirs at the top-level.
>
> I expect this problem could be fixed by adding an extra line, e.g.
> os.system('cp -pPR %s/.??* %s/' % (dest, dvar))
>
> -Graham

Do you mean as an addition to the copytree, or as an addition to the old code?

The patch we had reads:

 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)
 }

Seems adding an additional os.system kind-a beats using the
shutil.copytree as we then still have the os.system to do the cp
I guess the best way forward is to revert the patch and extend the
os.system call with your patter.
E.g. something like:
-	os.system('cp -pPR %s/* %s/' % (dest, dvar))
+	os.system('cp -pPR %s/* %s/.??* %s/' % (dest, dest, dvar))

cp may have mutliple sources if the output is a dir.

Frans




More information about the Openembedded-devel mailing list