mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 09:49:33 +02:00
bitbake: bb/utils: movefile: use the logger for printing
(Bitbake rev: 274b2d7a2fa0b43b0b542cb5471ff832e692ea93) Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
895779fd7e
commit
ace415e622
@@ -751,7 +751,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||||||
if not sstat:
|
if not sstat:
|
||||||
sstat = os.lstat(src)
|
sstat = os.lstat(src)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("movefile: Stating source file failed...", e)
|
logger.warning("movefile: Stating source file failed...", e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
destexists = 1
|
destexists = 1
|
||||||
@@ -779,7 +779,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||||||
os.unlink(src)
|
os.unlink(src)
|
||||||
return os.lstat(dest)
|
return os.lstat(dest)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("movefile: failed to properly create symlink:", dest, "->", target, e)
|
logger.warning("movefile: failed to properly create symlink:", dest, "->", target, e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
renamefailed = 1
|
renamefailed = 1
|
||||||
@@ -796,7 +796,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
if e.errno != errno.EXDEV:
|
if e.errno != errno.EXDEV:
|
||||||
# Some random error.
|
# Some random error.
|
||||||
print("movefile: Failed to move", src, "to", dest, e)
|
logger.warning("movefile: Failed to move", src, "to", dest, e)
|
||||||
return None
|
return None
|
||||||
# Invalid cross-device-link 'bind' mounted or actually Cross-Device
|
# Invalid cross-device-link 'bind' mounted or actually Cross-Device
|
||||||
|
|
||||||
@@ -808,13 +808,13 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||||||
bb.utils.rename(destpath + "#new", destpath)
|
bb.utils.rename(destpath + "#new", destpath)
|
||||||
didcopy = 1
|
didcopy = 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('movefile: copy', src, '->', dest, 'failed.', e)
|
logger.warning('movefile: copy', src, '->', dest, 'failed.', e)
|
||||||
return None
|
return None
|
||||||
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
|
||||||
a = getstatusoutput("/bin/mv -f " + "'" + src + "' '" + dest + "'")
|
a = getstatusoutput("/bin/mv -f " + "'" + src + "' '" + dest + "'")
|
||||||
if a[0] != 0:
|
if a[0] != 0:
|
||||||
print("movefile: Failed to move special file:" + src + "' to '" + dest + "'", a)
|
logger.warning("movefile: Failed to move special file:" + src + "' to '" + dest + "'", a)
|
||||||
return None # failure
|
return None # failure
|
||||||
try:
|
try:
|
||||||
if didcopy:
|
if didcopy:
|
||||||
@@ -822,7 +822,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
|||||||
os.chmod(destpath, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
|
os.chmod(destpath, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown
|
||||||
os.unlink(src)
|
os.unlink(src)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("movefile: Failed to chown/chmod/unlink", dest, e)
|
logger.warning("movefile: Failed to chown/chmod/unlink", dest, e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if newmtime:
|
if newmtime:
|
||||||
|
|||||||
Reference in New Issue
Block a user