Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] utils.movefile: specify dest file name
@ 2015-08-20 13:59 Benjamin Esquivel
  2015-08-21 10:05 ` [PATCH v2] bb.utils.movefile: " Benjamin Esquivel
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Esquivel @ 2015-08-20 13:59 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

 When moving a file via the os.rename function, it was missing the
 destination file name which caused an OSError

 [YOCTO#8180]

Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
---
 bitbake/lib/bb/utils.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 5b94432..5eec787 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -741,7 +741,9 @@ def movefile(src, dest, newmtime = None, sstat = None):
     renamefailed = 1
     if sstat[stat.ST_DEV] == dstat[stat.ST_DEV]:
         try:
-            os.rename(src, dest)
+            # os.rename needs to know the destination path with file name
+            destfile = os.path.join(dest, os.path.basename(src))
+            os.rename(src, destfile) 
             renamefailed = 0
         except Exception as e:
             if e[0] != errno.EXDEV:
-- 
2.3.0



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

* [PATCH v2] bb.utils.movefile: specify dest file name
  2015-08-20 13:59 [PATCH] utils.movefile: specify dest file name Benjamin Esquivel
@ 2015-08-21 10:05 ` Benjamin Esquivel
  2015-08-27 16:17   ` Benjamin Esquivel
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Esquivel @ 2015-08-21 10:05 UTC (permalink / raw)
  To: openembedded-core; +Cc: paul.eggleton

 When moving a file via the python os.rename function it is required
 to specify the path including the file name at the end.
 Failure to provide this file name at the destination argument of the
 os.rename function raises an OSError exception.

 [YOCTO#8180]

Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
---
 bitbake/lib/bb/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 5b94432..5ed8e01 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -741,7 +741,11 @@ def movefile(src, dest, newmtime = None, sstat = None):
     renamefailed = 1
     if sstat[stat.ST_DEV] == dstat[stat.ST_DEV]:
         try:
-            os.rename(src, dest)
+            # os.rename needs to know the destination path with file name
+            srcfname = os.path.basename(src)
+            destfname = os.path.join(dest, srcfname) if os.path.isdir(dest) \
+                        else dest
+            os.rename(src, destfname)
             renamefailed = 0
         except Exception as e:
             if e[0] != errno.EXDEV:
-- 
2.3.0



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

* Re: [PATCH v2] bb.utils.movefile: specify dest file name
  2015-08-21 10:05 ` [PATCH v2] bb.utils.movefile: " Benjamin Esquivel
@ 2015-08-27 16:17   ` Benjamin Esquivel
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Esquivel @ 2015-08-27 16:17 UTC (permalink / raw)
  To: openembedded-core, paul.eggleton, ross.burton

Hey guys, I would like to get this reviewed/integrated for closing this
bug :)

Benjamin

On Fri, 2015-08-21 at 10:05 +0000, Benjamin Esquivel wrote:
>  When moving a file via the python os.rename function it is required
>  to specify the path including the file name at the end.
>  Failure to provide this file name at the destination argument of the
>  os.rename function raises an OSError exception.
> 
>  [YOCTO#8180]
> 
> Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
> ---
>  bitbake/lib/bb/utils.py | 6 +++++-e
>  1 file changed, 5 insertions(+), 1 deletion(-)
> diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
> index 5b94432..5ed8e01 100644
> --- a/bitbake/lib/bb/utils.py
> +++ b/bitbake/lib/bb/utils.py
> @@ -741,7 +741,11 @@ def movefile(src, dest, newmtime = None, sstat =
> None):
>      renamefailed = 1
>      if sstat[stat.ST_DEV] == dstat[stat.ST_DEV]:
>          try:
> -            os.rename(src, dest)
> +            # os.rename needs to know the destination path with file
> name
> +            srcfname = os.path.basename(src)
> +            destfname = os.path.join(dest, srcfname) if
> os.path.isdir(dest) \
> +                        else dest
> +            os.rename(src, destfname)
>              renamefailed = 0
>          except Exception as e:
>              if e[0] != errno.EXDEV:


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

end of thread, other threads:[~2015-08-27 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 13:59 [PATCH] utils.movefile: specify dest file name Benjamin Esquivel
2015-08-21 10:05 ` [PATCH v2] bb.utils.movefile: " Benjamin Esquivel
2015-08-27 16:17   ` Benjamin Esquivel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox