diff options
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 5676d3fd27..d208f5ee2f 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -91,10 +91,9 @@ class Wget(FetchMethod): | |||
91 | 91 | ||
92 | fetchcmd = self.basecmd | 92 | fetchcmd = self.basecmd |
93 | 93 | ||
94 | if 'downloadfilename' in ud.parm: | 94 | localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp" |
95 | localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) | 95 | bb.utils.mkdirhier(os.path.dirname(localpath)) |
96 | bb.utils.mkdirhier(os.path.dirname(localpath)) | 96 | fetchcmd += " -O %s" % shlex.quote(localpath) |
97 | fetchcmd += " -O %s" % shlex.quote(localpath) | ||
98 | 97 | ||
99 | if ud.user and ud.pswd: | 98 | if ud.user and ud.pswd: |
100 | fetchcmd += " --user=%s --password=%s --auth-no-challenge" % (ud.user, ud.pswd) | 99 | fetchcmd += " --user=%s --password=%s --auth-no-challenge" % (ud.user, ud.pswd) |
@@ -108,6 +107,10 @@ class Wget(FetchMethod): | |||
108 | 107 | ||
109 | self._runwget(ud, d, fetchcmd, False) | 108 | self._runwget(ud, d, fetchcmd, False) |
110 | 109 | ||
110 | # Remove the ".tmp" and move the file into position atomically | ||
111 | # Our lock prevents multiple writers but mirroring code may grab incomplete files | ||
112 | os.rename(localpath, localpath[:-4]) | ||
113 | |||
111 | # Sanity check since wget can pretend it succeed when it didn't | 114 | # Sanity check since wget can pretend it succeed when it didn't |
112 | # Also, this used to happen if sourceforge sent us to the mirror page | 115 | # Also, this used to happen if sourceforge sent us to the mirror page |
113 | if not os.path.exists(ud.localpath): | 116 | if not os.path.exists(ud.localpath): |