]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
utils: Specify dest file name in movefile()
authorBenjamin Esquivel <benjamin.esquivel@linux.intel.com>
Thu, 20 Aug 2015 13:59:58 +0000 (13:59 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Sep 2015 21:36:56 +0000 (22:36 +0100)
 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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/utils.py

index 5b94432b379e80179855a229fe00f237ea7760aa..5eec78733694d98fd0df39d5c2d69da5ae7692c0 100644 (file)
@@ -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: