From: Richard Purdie Date: Fri, 20 Aug 2010 14:11:44 +0000 (+0100) Subject: bitbake/utils.py: Allow copyfile to copy files which aren't readable X-Git-Tag: 2011-1~4816 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=75b57d573c8e129d3ae8821e81e76ebf4b37fbfb;p=openembedded-core.git bitbake/utils.py: Allow copyfile to copy files which aren't readable Signed-off-by: Richard Purdie --- diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index fd7948f1de..56577dabe1 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -686,11 +686,14 @@ def copyfile(src, dest, newmtime = None, sstat = None): return False if stat.S_ISREG(sstat[stat.ST_MODE]): + os.chmod(src, stat.S_IRUSR) # Make sure we can read it try: # For safety copy then move it over. shutil.copyfile(src, dest + "#new") 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 else: #we don't yet handle special, so we need to fall back to /bin/mv