diff options
| -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 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): |
