]> code.ossystems Code Review - openembedded-core.git/commitdiff
utils.py: Fix bb.copyfile to change the permissions of the file back correctly
authorRichard Purdie <rpurdie@linux.intel.com>
Mon, 23 Aug 2010 12:01:05 +0000 (13:01 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Mon, 23 Aug 2010 12:01:05 +0000 (13:01 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/utils.py

index c8f139b192b33cf22c8fb231307ace05bddc331a..9fc56eaa0fac3fe08f423bfd2a9352876cd0529b 100644 (file)
@@ -703,9 +703,11 @@ def copyfile(src, dest, newmtime = None, sstat = None):
             os.rename(dest + "#new", dest)
         except Exception as e:
             print('copyfile: copy', src, '->', dest, 'failed.', e)
-            os.chmod(src, stat.S_IMODE(sstat[stat.ST_MODE]))
-            os.utime(src, (sstat[stat.ST_ATIME], sstat[stat.ST_MTIME]))
             return False
+        finally:
+            os.chmod(src, sstat[stat.ST_MODE])
+            os.utime(src, (sstat[stat.ST_ATIME], sstat[stat.ST_MTIME]))
+
     else:
         #we don't yet handle special, so we need to fall back to /bin/mv
         a = getstatusoutput("/bin/cp -f " + "'" + src + "' '" + dest + "'")