summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/wget.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/wget.py')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index fbfa6938ac..2e92117634 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -108,7 +108,8 @@ class Wget(FetchMethod):
108 108
109 fetchcmd = self.basecmd 109 fetchcmd = self.basecmd
110 110
111 localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp" 111 dldir = os.path.realpath(d.getVar("DL_DIR"))
112 localpath = os.path.join(dldir, ud.localfile) + ".tmp"
112 bb.utils.mkdirhier(os.path.dirname(localpath)) 113 bb.utils.mkdirhier(os.path.dirname(localpath))
113 fetchcmd += " -O %s" % shlex.quote(localpath) 114 fetchcmd += " -O %s" % shlex.quote(localpath)
114 115
@@ -128,12 +129,21 @@ class Wget(FetchMethod):
128 uri = ud.url.split(";")[0] 129 uri = ud.url.split(";")[0]
129 if os.path.exists(ud.localpath): 130 if os.path.exists(ud.localpath):
130 # file exists, but we didnt complete it.. trying again.. 131 # file exists, but we didnt complete it.. trying again..
131 fetchcmd += d.expand(" -c -P ${DL_DIR} '%s'" % uri) 132 fetchcmd += " -c -P " + dldir + " '" + uri + "'"
132 else: 133 else:
133 fetchcmd += d.expand(" -P ${DL_DIR} '%s'" % uri) 134 fetchcmd += " -P " + dldir + " '" + uri + "'"
134 135
135 self._runwget(ud, d, fetchcmd, False) 136 self._runwget(ud, d, fetchcmd, False)
136 137
138 # Sanity check since wget can pretend it succeed when it didn't
139 # Also, this used to happen if sourceforge sent us to the mirror page
140 if not os.path.exists(localpath):
141 raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, localpath), uri)
142
143 if os.path.getsize(localpath) == 0:
144 os.remove(localpath)
145 raise FetchError("The fetch of %s resulted in a zero size file?! Deleting and failing since this isn't right." % (uri), uri)
146
137 # Try and verify any checksum now, meaning if it isn't correct, we don't remove the 147 # Try and verify any checksum now, meaning if it isn't correct, we don't remove the
138 # original file, which might be a race (imagine two recipes referencing the same 148 # original file, which might be a race (imagine two recipes referencing the same
139 # source, one with an incorrect checksum) 149 # source, one with an incorrect checksum)
@@ -143,15 +153,6 @@ class Wget(FetchMethod):
143 # Our lock prevents multiple writers but mirroring code may grab incomplete files 153 # Our lock prevents multiple writers but mirroring code may grab incomplete files
144 os.rename(localpath, localpath[:-4]) 154 os.rename(localpath, localpath[:-4])
145 155
146 # Sanity check since wget can pretend it succeed when it didn't
147 # Also, this used to happen if sourceforge sent us to the mirror page
148 if not os.path.exists(ud.localpath):
149 raise FetchError("The fetch command returned success for url %s but %s doesn't exist?!" % (uri, ud.localpath), uri)
150
151 if os.path.getsize(ud.localpath) == 0:
152 os.remove(ud.localpath)
153 raise FetchError("The fetch of %s resulted in a zero size file?! Deleting and failing since this isn't right." % (uri), uri)
154
155 return True 156 return True
156 157
157 def checkstatus(self, fetch, ud, d, try_again=True): 158 def checkstatus(self, fetch, ud, d, try_again=True):