* [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
@ 2010-10-18 16:44 Michael Smith
2010-10-18 17:33 ` Khem Raj
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Michael Smith @ 2010-10-18 16:44 UTC (permalink / raw)
To: openembedded-devel; +Cc: Enrico Scholz
The previous system("cp %s/* ...") missed dotfiles/dirs at the
top-level.
Signed-off-by: Michael Smith <msmith@cbnco.com>
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Graham Gower <graham.gower@gmail.com>
Cc: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
---
classes/package.bbclass | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/classes/package.bbclass b/classes/package.bbclass
index e2a61bf..2769595 100644
--- a/classes/package.bbclass
+++ b/classes/package.bbclass
@@ -356,15 +356,15 @@ python package_do_split_locales() {
}
python perform_packagecopy () {
- dest = bb.data.getVar('D', d, True)
- dvar = bb.data.getVar('PKGD', d, True)
+ installdest = bb.data.getVar('D', d, True)
+ pkgcopy = bb.data.getVar('PKGD', d, True)
- bb.mkdirhier(dvar)
+ bb.mkdirhier(pkgcopy)
# 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))
+ os.system('rm -rf %s/*' % (pkgcopy))
+ os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
}
python populate_packages () {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-18 16:44 [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD Michael Smith
@ 2010-10-18 17:33 ` Khem Raj
2010-10-18 18:00 ` Frans Meulenbroeks
2010-10-18 18:27 ` Khem Raj
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Khem Raj @ 2010-10-18 17:33 UTC (permalink / raw)
To: openembedded-devel
On Mon, Oct 18, 2010 at 9:44 AM, Michael Smith <msmith@cbnco.com> wrote:
> The previous system("cp %s/* ...") missed dotfiles/dirs at the
> top-level.
>
> Signed-off-by: Michael Smith <msmith@cbnco.com>
> Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> Cc: Graham Gower <graham.gower@gmail.com>
> Cc: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
> ---
> classes/package.bbclass | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/classes/package.bbclass b/classes/package.bbclass
> index e2a61bf..2769595 100644
> --- a/classes/package.bbclass
> +++ b/classes/package.bbclass
> @@ -356,15 +356,15 @@ python package_do_split_locales() {
> }
>
> python perform_packagecopy () {
> - dest = bb.data.getVar('D', d, True)
> - dvar = bb.data.getVar('PKGD', d, True)
> + installdest = bb.data.getVar('D', d, True)
> + pkgcopy = bb.data.getVar('PKGD', d, True)
>
> - bb.mkdirhier(dvar)
> + bb.mkdirhier(pkgcopy)
>
> # 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))
> + os.system('rm -rf %s/*' % (pkgcopy))
> + os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
> }
will it also try to copy . and .. ?
>
> python populate_packages () {
> --
> 1.7.0.4
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-18 17:33 ` Khem Raj
@ 2010-10-18 18:00 ` Frans Meulenbroeks
0 siblings, 0 replies; 10+ messages in thread
From: Frans Meulenbroeks @ 2010-10-18 18:00 UTC (permalink / raw)
To: openembedded-devel
2010/10/18 Khem Raj <raj.khem@gmail.com>:
> On Mon, Oct 18, 2010 at 9:44 AM, Michael Smith <msmith@cbnco.com> wrote:
>> The previous system("cp %s/* ...") missed dotfiles/dirs at the
>> top-level.
>>
>> Signed-off-by: Michael Smith <msmith@cbnco.com>
>> Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
>> Cc: Graham Gower <graham.gower@gmail.com>
>> Cc: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
>> ---
>> classes/package.bbclass | 10 +++++-----
>> 1 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/classes/package.bbclass b/classes/package.bbclass
>> index e2a61bf..2769595 100644
>> --- a/classes/package.bbclass
>> +++ b/classes/package.bbclass
>> @@ -356,15 +356,15 @@ python package_do_split_locales() {
>> }
>>
>> python perform_packagecopy () {
>> - dest = bb.data.getVar('D', d, True)
>> - dvar = bb.data.getVar('PKGD', d, True)
>> + installdest = bb.data.getVar('D', d, True)
>> + pkgcopy = bb.data.getVar('PKGD', d, True)
>>
>> - bb.mkdirhier(dvar)
>> + bb.mkdirhier(pkgcopy)
>>
>> # 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))
>> + os.system('rm -rf %s/*' % (pkgcopy))
>> + os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
>> }
>
> will it also try to copy . and .. ?
No (tested that).
Frans.
>
>>
>> python populate_packages () {
>> --
>> 1.7.0.4
>>
>>
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-18 16:44 [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD Michael Smith
2010-10-18 17:33 ` Khem Raj
@ 2010-10-18 18:27 ` Khem Raj
[not found] ` <AANLkTi=DtXf+VnB3LPzbzDD57LNSxgUaeeTM6=ohGstK@mail.gmail.com>
2010-10-19 13:16 ` Enrico Scholz
3 siblings, 0 replies; 10+ messages in thread
From: Khem Raj @ 2010-10-18 18:27 UTC (permalink / raw)
To: openembedded-devel; +Cc: Enrico Scholz
On Mon, Oct 18, 2010 at 9:44 AM, Michael Smith <msmith@cbnco.com> wrote:
> The previous system("cp %s/* ...") missed dotfiles/dirs at the
> top-level.
>
> Signed-off-by: Michael Smith <msmith@cbnco.com>
> Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> Cc: Graham Gower <graham.gower@gmail.com>
> Cc: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Acked-by: Khem Raj <raj.khem@gmail.com>
> ---
> classes/package.bbclass | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/classes/package.bbclass b/classes/package.bbclass
> index e2a61bf..2769595 100644
> --- a/classes/package.bbclass
> +++ b/classes/package.bbclass
> @@ -356,15 +356,15 @@ python package_do_split_locales() {
> }
>
> python perform_packagecopy () {
> - dest = bb.data.getVar('D', d, True)
> - dvar = bb.data.getVar('PKGD', d, True)
> + installdest = bb.data.getVar('D', d, True)
> + pkgcopy = bb.data.getVar('PKGD', d, True)
>
> - bb.mkdirhier(dvar)
> + bb.mkdirhier(pkgcopy)
>
> # 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))
> + os.system('rm -rf %s/*' % (pkgcopy))
> + os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
> }
>
> python populate_packages () {
> --
> 1.7.0.4
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
[not found] ` <AANLkTi=DtXf+VnB3LPzbzDD57LNSxgUaeeTM6=ohGstK@mail.gmail.com>
@ 2010-10-18 20:43 ` Michael Smith
0 siblings, 0 replies; 10+ messages in thread
From: Michael Smith @ 2010-10-18 20:43 UTC (permalink / raw)
To: Frans Meulenbroeks; +Cc: openembedded-devel
Frans Meulenbroeks wrote:
> Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
>
> but with a minor improvement suggestion.
> What aboout elimiating one os.system call by combining the two into one:
>
> os.system('rm -rf %s/*;cp -pPR %s/. %s/' % (pkgcopy, installdest, pkgcopy))
Hi Frans,
Thanks for the SOB. I like it better as two separate lines. I would have
preferred shutil.rmtree() if shutil.copytree() worked, actually - but
since it doesn't, no point using shutil for one line and not the other.
Mike
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-18 16:44 [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD Michael Smith
` (2 preceding siblings ...)
[not found] ` <AANLkTi=DtXf+VnB3LPzbzDD57LNSxgUaeeTM6=ohGstK@mail.gmail.com>
@ 2010-10-19 13:16 ` Enrico Scholz
2010-10-19 13:25 ` Frans Meulenbroeks
3 siblings, 1 reply; 10+ messages in thread
From: Enrico Scholz @ 2010-10-19 13:16 UTC (permalink / raw)
To: openembedded-devel
Michael Smith <msmith@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))
Enrico
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-19 13:16 ` Enrico Scholz
@ 2010-10-19 13:25 ` Frans Meulenbroeks
2010-10-19 13:44 ` Henning Heinold
2010-10-19 17:07 ` Enrico Scholz
0 siblings, 2 replies; 10+ messages in thread
From: Frans Meulenbroeks @ 2010-10-19 13:25 UTC (permalink / raw)
To: openembedded-devel
2010/10/19 Enrico Scholz <enrico.scholz@sigma-chemnitz.de>:
> Michael Smith <msmith@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@frans-desktop:/tmp$ mkdir tst
frans@frans-desktop:/tmp$ mkdir dest
frans@frans-desktop:/tmp$ date >tst/f
frans@frans-desktop:/tmp$ cp -pPR tst/. dest
frans@frans-desktop:/tmp$ ls -l dest
total 4
-rw-r--r-- 1 frans frans 30 2010-10-19 15:20 f
frans@frans-desktop:/tmp$ rm dest/*
frans@frans-desktop:/tmp$ cp -pPR tst dest
frans@frans-desktop:/tmp$ ls dest
tst
frans@frans-desktop:/tmp$ rm -rf dest
frans@frans-desktop:/tmp$ cp -pPR tst dest
frans@frans-desktop:/tmp$ ls dest
f
frans@frans-desktop:/tmp$
Enjoy, Frans
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-19 13:25 ` Frans Meulenbroeks
@ 2010-10-19 13:44 ` Henning Heinold
2010-10-19 17:07 ` Enrico Scholz
1 sibling, 0 replies; 10+ messages in thread
From: Henning Heinold @ 2010-10-19 13:44 UTC (permalink / raw)
To: openembedded-devel
Hm,
the overall question here is, why the class is still using os.system instead of subprocess.
Bye Henning
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-19 13:25 ` Frans Meulenbroeks
2010-10-19 13:44 ` Henning Heinold
@ 2010-10-19 17:07 ` Enrico Scholz
2010-10-19 17:24 ` Frans Meulenbroeks
1 sibling, 1 reply; 10+ messages in thread
From: Enrico Scholz @ 2010-10-19 17:07 UTC (permalink / raw)
To: openembedded-devel
Frans Meulenbroeks <fransmeulenbroeks@gmail.com> writes:
>>> + os.system('rm -rf %s/*' % (pkgcopy))
>>
>> Can be written as
>>
>> os.system('rm -rf %s' % (pkgcopy))
>> ...
>>> + os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
>>
>
> No this is not good. The rm command you give will also remove the dir.
Why is this bad? The dir is recreated by the 'cp'.
> The cp command will copy %s/.
Only the final permissions of <dstdir> may differ between
rm -rf <dstdir>
cp -pPR <srcdir>/. <dstdir>/
and
rm -rf <dstdir>
mkdir <dstdir>
cp -pPR <srcdir>/. <dstdir>/
In first case, <dstdir> gets permissions of <srcdir>. In the second it
keeps the permissions from <dstdir>.
Else, content (both the files and their attributes) of <dstdir> will be
the same for both operations.
Enrico
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD
2010-10-19 17:07 ` Enrico Scholz
@ 2010-10-19 17:24 ` Frans Meulenbroeks
0 siblings, 0 replies; 10+ messages in thread
From: Frans Meulenbroeks @ 2010-10-19 17:24 UTC (permalink / raw)
To: openembedded-devel
2010/10/19 Enrico Scholz <enrico.scholz@sigma-chemnitz.de>:
> Frans Meulenbroeks <fransmeulenbroeks@gmail.com> writes:
>
>>>> + os.system('rm -rf %s/*' % (pkgcopy))
>>>
>>> Can be written as
>>>
>>> os.system('rm -rf %s' % (pkgcopy))
>>> ...
>>>> + os.system('cp -pPR %s/. %s/' % (installdest, pkgcopy))
>>>
>>
>> No this is not good. The rm command you give will also remove the dir.
>
> Why is this bad? The dir is recreated by the 'cp'.
>
>
>> The cp command will copy %s/.
>
> Only the final permissions of <dstdir> may differ between
>
> rm -rf <dstdir>
> cp -pPR <srcdir>/. <dstdir>/
>
> and
>
> rm -rf <dstdir>
> mkdir <dstdir>
> cp -pPR <srcdir>/. <dstdir>/
>
>
> In first case, <dstdir> gets permissions of <srcdir>. In the second it
> keeps the permissions from <dstdir>.
>
> Else, content (both the files and their attributes) of <dstdir> will be
> the same for both operations.
Yes, you're right. I accidenlty dropped off the / of the dstdir when I
tested this earlier.
Sorry for the noise.
Not sure if there is a gain though.
Frans.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-10-19 17:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-18 16:44 [PATCH v3] package.bbclass: copy dotfiles in root D to PKGD Michael Smith
2010-10-18 17:33 ` Khem Raj
2010-10-18 18:00 ` Frans Meulenbroeks
2010-10-18 18:27 ` Khem Raj
[not found] ` <AANLkTi=DtXf+VnB3LPzbzDD57LNSxgUaeeTM6=ohGstK@mail.gmail.com>
2010-10-18 20:43 ` Michael Smith
2010-10-19 13:16 ` Enrico Scholz
2010-10-19 13:25 ` Frans Meulenbroeks
2010-10-19 13:44 ` Henning Heinold
2010-10-19 17:07 ` Enrico Scholz
2010-10-19 17:24 ` Frans Meulenbroeks
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.