mirror of
git://git.yoctoproject.org/poky
synced 2026-10-01 04:30:20 +00:00
bitbake/utils.py: Allow copyfile to copy files which aren't readable
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
ac3452c431
commit
75b57d573c
@ -686,11 +686,14 @@ def copyfile(src, dest, newmtime = None, sstat = None):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if stat.S_ISREG(sstat[stat.ST_MODE]):
|
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.
|
try: # For safety copy then move it over.
|
||||||
shutil.copyfile(src, dest + "#new")
|
shutil.copyfile(src, dest + "#new")
|
||||||
os.rename(dest + "#new", dest)
|
os.rename(dest + "#new", dest)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('copyfile: copy', src, '->', dest, 'failed.', 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
|
return False
|
||||||
else:
|
else:
|
||||||
#we don't yet handle special, so we need to fall back to /bin/mv
|
#we don't yet handle special, so we need to fall back to /bin/mv
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user