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

Frans Meulenbroeks fransmeulenbroeks at gmail.com
Tue Oct 19 13:25:40 UTC 2010


2010/10/19 Enrico Scholz <enrico.scholz at sigma-chemnitz.de>:
> Michael Smith <msmith at cbnco.com> writes:
>
>> +     os.system('rm -rf %s/*' % (pkgcopy))
>
> Can be written as
>
>  os.system('rm -rf %s' % (pkgcopy))
>
> Every SUSv3 compliant 'cp' will create the 'pkgcopy' directory.
>
>
>> +     os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
>

No this is not good. The rm command you give will also remove the dir.
The cp command will copy %s/.
There is a subtle difference with %s (although %s and %s/. refer to
the same path)
If you want to use %s instead of %s/* you also need to change the %s/. into %s

Thinking of it doing both changes is better as the effect of
os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy)) is different
depending on whether pkgcopy already exist or not, while in the new
case it is not.
I can submit a patch if needed.

See also this log on hte behaviour of cp

frans at frans-desktop:/tmp$ mkdir tst
frans at frans-desktop:/tmp$ mkdir dest
frans at frans-desktop:/tmp$ date >tst/f
frans at frans-desktop:/tmp$ cp -pPR tst/. dest
frans at frans-desktop:/tmp$ ls -l dest
total 4
-rw-r--r-- 1 frans frans 30 2010-10-19 15:20 f
frans at frans-desktop:/tmp$ rm dest/*
frans at frans-desktop:/tmp$ cp -pPR tst dest
frans at frans-desktop:/tmp$ ls dest
tst
frans at frans-desktop:/tmp$ rm -rf dest
frans at frans-desktop:/tmp$ cp -pPR tst dest
frans at frans-desktop:/tmp$ ls dest
f
frans at frans-desktop:/tmp$

Enjoy, Frans




More information about the Openembedded-devel mailing list