All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sstate: Improve performance by moving files rather than using copy and delete
@ 2011-07-11 15:48 Richard Purdie
  2011-07-11 16:59 ` Joshua Lock
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2011-07-11 15:48 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/sstate.bbclass |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 0daaf48..62c7c43 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -147,6 +147,13 @@ def sstate_install(ss, d):
 def sstate_installpkg(ss, d):
     import oe.path
 
+    def prepdir(dir):
+        # remove dir if it exists, ensure any parent directories do exist
+        if os.path.exists(dir):
+            oe.path.remove(dir)
+        bb.mkdirhier(dir)
+        oe.path.remove(dir)
+
     sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d)
     sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz"
 
@@ -178,9 +185,8 @@ def sstate_installpkg(ss, d):
             os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file))
 
     for state in ss['dirs']:
-        if os.path.exists(state[1]):
-            oe.path.remove(state[1])
-        oe.path.copytree(sstateinst + state[0], state[1])
+        prepdir(state[1])
+        os.rename(sstateinst + state[0], state[1])
     sstate_install(ss, d)
 
     for plain in ss['plaindirs']:
@@ -188,8 +194,8 @@ def sstate_installpkg(ss, d):
         src = sstateinst + "/" + plain.replace(workdir, '')
         dest = plain
         bb.mkdirhier(src)
-        bb.mkdirhier(dest)
-        oe.path.copytree(src, dest)
+        prepdir(dest)
+        os.rename(src, dest)
 
     return True
 
-- 
1.7.4.1





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sstate: Improve performance by moving files rather than using copy and delete
  2011-07-11 15:48 [PATCH] sstate: Improve performance by moving files rather than using copy and delete Richard Purdie
@ 2011-07-11 16:59 ` Joshua Lock
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Lock @ 2011-07-11 16:59 UTC (permalink / raw)
  To: openembedded-core

On Mon, 2011-07-11 at 16:48 +0100, Richard Purdie wrote:
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Acked-by: Joshua Lock <josh@linux.intel.com>

> ---
>  meta/classes/sstate.bbclass |   16 +++++++++++-----
>  1 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 0daaf48..62c7c43 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -147,6 +147,13 @@ def sstate_install(ss, d):
>  def sstate_installpkg(ss, d):
>      import oe.path
>  
> +    def prepdir(dir):
> +        # remove dir if it exists, ensure any parent directories do exist
> +        if os.path.exists(dir):
> +            oe.path.remove(dir)
> +        bb.mkdirhier(dir)
> +        oe.path.remove(dir)
> +
>      sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d)
>      sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz"
>  
> @@ -178,9 +185,8 @@ def sstate_installpkg(ss, d):
>              os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file))
>  
>      for state in ss['dirs']:
> -        if os.path.exists(state[1]):
> -            oe.path.remove(state[1])
> -        oe.path.copytree(sstateinst + state[0], state[1])
> +        prepdir(state[1])
> +        os.rename(sstateinst + state[0], state[1])
>      sstate_install(ss, d)
>  
>      for plain in ss['plaindirs']:
> @@ -188,8 +194,8 @@ def sstate_installpkg(ss, d):
>          src = sstateinst + "/" + plain.replace(workdir, '')
>          dest = plain
>          bb.mkdirhier(src)
> -        bb.mkdirhier(dest)
> -        oe.path.copytree(src, dest)
> +        prepdir(dest)
> +        os.rename(src, dest)
>  
>      return True
>  

-- 
Joshua Lock
        Yocto Project "Johannes Factotum"
        Intel Open Source Technology Centre




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-11 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 15:48 [PATCH] sstate: Improve performance by moving files rather than using copy and delete Richard Purdie
2011-07-11 16:59 ` Joshua Lock

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.