summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/wget.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-07 12:07:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-08 21:53:15 +0100
commit96e34de6f0c485307d1018910bca642d3cdb58e9 (patch)
tree4ea35d4d206232e98f4e116c88f66696b64270a7 /bitbake/lib/bb/fetch2/wget.py
parentc6afc6d6ede401397419e067e8c229395a2afff0 (diff)
downloadpoky-96e34de6f0c485307d1018910bca642d3cdb58e9.tar.gz
bitbake: fetch/wget: Move files into place atomically
(Bitbake rev: cd7cce4cf4be5c742d29671169354fe84220b47a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/wget.py')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index b3a3de571a..b2b542e1dc 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -106,10 +106,9 @@ class Wget(FetchMethod):
106 106
107 fetchcmd = self.basecmd 107 fetchcmd = self.basecmd
108 108
109 if 'downloadfilename' in ud.parm: 109 localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp"
110 localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) 110 bb.utils.mkdirhier(os.path.dirname(localpath))
111 bb.utils.mkdirhier(os.path.dirname(localpath)) 111 fetchcmd += " -O %s" % shlex.quote(localpath)
112 fetchcmd += " -O %s" % shlex.quote(localpath)
113 112
114 if ud.user and ud.pswd: 113 if ud.user and ud.pswd:
115 fetchcmd += " --auth-no-challenge" 114 fetchcmd += " --auth-no-challenge"
@@ -133,6 +132,10 @@ class Wget(FetchMethod):
133 132
134 self._runwget(ud, d, fetchcmd, False) 133 self._runwget(ud, d, fetchcmd, False)
135 134
135 # Remove the ".tmp" and move the file into position atomically
136 # Our lock prevents multiple writers but mirroring code may grab incomplete files
137 os.rename(localpath, localpath[:-4])
138
136 # Sanity check since wget can pretend it succeed when it didn't 139 # Sanity check since wget can pretend it succeed when it didn't
137 # Also, this used to happen if sourceforge sent us to the mirror page 140 # Also, this used to happen if sourceforge sent us to the mirror page
138 if not os.path.exists(ud.localpath): 141 if not os.path.exists(ud.localpath):