diff options
Diffstat (limited to 'bitbake/lib/bb/fetch2')
| -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 9bcb0d4b7a..708f3a42e6 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
| @@ -109,10 +109,9 @@ class Wget(FetchMethod): | |||
| 109 | 109 | ||
| 110 | fetchcmd = self.basecmd | 110 | fetchcmd = self.basecmd |
| 111 | 111 | ||
| 112 | if 'downloadfilename' in ud.parm: | 112 | localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp" |
| 113 | localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) | 113 | bb.utils.mkdirhier(os.path.dirname(localpath)) |
| 114 | bb.utils.mkdirhier(os.path.dirname(localpath)) | 114 | fetchcmd += " -O %s" % shlex.quote(localpath) |
| 115 | fetchcmd += " -O %s" % shlex.quote(localpath) | ||
| 116 | 115 | ||
| 117 | if ud.user and ud.pswd: | 116 | if ud.user and ud.pswd: |
| 118 | fetchcmd += " --auth-no-challenge" | 117 | fetchcmd += " --auth-no-challenge" |
| @@ -136,6 +135,10 @@ class Wget(FetchMethod): | |||
| 136 | 135 | ||
| 137 | self._runwget(ud, d, fetchcmd, False) | 136 | self._runwget(ud, d, fetchcmd, False) |
| 138 | 137 | ||
| 138 | # Remove the ".tmp" and move the file into position atomically | ||
| 139 | # Our lock prevents multiple writers but mirroring code may grab incomplete files | ||
| 140 | os.rename(localpath, localpath[:-4]) | ||
| 141 | |||
| 139 | # Sanity check since wget can pretend it succeed when it didn't | 142 | # Sanity check since wget can pretend it succeed when it didn't |
| 140 | # Also, this used to happen if sourceforge sent us to the mirror page | 143 | # Also, this used to happen if sourceforge sent us to the mirror page |
| 141 | if not os.path.exists(ud.localpath): | 144 | if not os.path.exists(ud.localpath): |
