summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch/__init__.py46
1 files changed, 16 insertions, 30 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 55ffdb84c9..5fcb9b83e2 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -237,32 +237,14 @@ def go(d, urls = None):
237 for u in urls: 237 for u in urls:
238 ud = urldata[u] 238 ud = urldata[u]
239 m = ud.method 239 m = ud.method
240 premirror_fetch = True
241 localpath = "" 240 localpath = ""
242 241
243 if ud.localfile: 242 if not ud.localfile:
244 if not m.try_premirror(u, ud, d): 243 continue
245 premirror_fetch = False
246 # File already present along with md5 stamp file
247 # Touch md5 file to show activity
248 try:
249 os.utime(ud.md5, None)
250 except:
251 # Errors aren't fatal here
252 pass
253
254 lf = bb.utils.lockfile(ud.lockfile)
255 if not m.try_premirror(u, ud, d):
256 premirror_fetch = False
257 # If someone else fetched this before we got the lock,
258 # notice and don't try again
259 try:
260 os.utime(ud.md5, None)
261 except:
262 # Errors aren't fatal here
263 pass
264 244
265 if premirror_fetch: 245 lf = bb.utils.lockfile(ud.lockfile)
246
247 if m.try_premirror(u, ud, d):
266 # First try fetching uri, u, from PREMIRRORS 248 # First try fetching uri, u, from PREMIRRORS
267 mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', d, True)) 249 mirrors = mirror_from_string(bb.data.getVar('PREMIRRORS', d, True))
268 localpath = try_mirrors(d, u, mirrors, False, m.forcefetch(u, ud, d)) 250 localpath = try_mirrors(d, u, mirrors, False, m.forcefetch(u, ud, d))
@@ -282,14 +264,18 @@ def go(d, urls = None):
282 if not localpath or not os.path.exists(localpath): 264 if not localpath or not os.path.exists(localpath):
283 raise FetchError("Unable to fetch URL %s from any source." % u) 265 raise FetchError("Unable to fetch URL %s from any source." % u)
284 266
285 if localpath: 267 ud.localpath = localpath
286 ud.localpath = localpath 268 if os.path.exists(ud.md5):
287 269 # Touch the md5 file to show active use of the download
288 if ud.localfile: 270 try:
289 if not m.forcefetch(u, ud, d): 271 os.utime(ud.md5, None)
290 Fetch.write_md5sum(u, ud, d) 272 except:
291 bb.utils.unlockfile(lf) 273 # Errors aren't fatal here
274 pass
275 else:
276 Fetch.write_md5sum(u, ud, d)
292 277
278 bb.utils.unlockfile(lf)
293 279
294def checkstatus(d): 280def checkstatus(d):
295 """ 281 """