1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

bitbake: fetch/wget: Move files into place atomically

(Bitbake rev: aaf9c1b8673f5b181255a08eee4e9a342863e896)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit cd7cce4cf4be5c742d29671169354fe84220b47a)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Richard Purdie
2022-06-07 12:07:38 +01:00
committed by Steve Sakoman
parent 78fc4af777
commit 5a511dadc0
+5 -2
View File
@@ -109,8 +109,7 @@ class Wget(FetchMethod):
fetchcmd = self.basecmd fetchcmd = self.basecmd
if 'downloadfilename' in ud.parm: localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp"
localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile)
bb.utils.mkdirhier(os.path.dirname(localpath)) bb.utils.mkdirhier(os.path.dirname(localpath))
fetchcmd += " -O %s" % shlex.quote(localpath) fetchcmd += " -O %s" % shlex.quote(localpath)
@@ -136,6 +135,10 @@ class Wget(FetchMethod):
self._runwget(ud, d, fetchcmd, False) self._runwget(ud, d, fetchcmd, False)
# Remove the ".tmp" and move the file into position atomically
# Our lock prevents multiple writers but mirroring code may grab incomplete files
os.rename(localpath, localpath[:-4])
# Sanity check since wget can pretend it succeed when it didn't # Sanity check since wget can pretend it succeed when it didn't
# Also, this used to happen if sourceforge sent us to the mirror page # Also, this used to happen if sourceforge sent us to the mirror page
if not os.path.exists(ud.localpath): if not os.path.exists(ud.localpath):