diff options
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index ccb60de59c..5f4c8300ef 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
| @@ -188,14 +188,19 @@ def go(d, urls = None): | |||
| 188 | 188 | ||
| 189 | # First try fetching uri, u, from PREMIRRORS | 189 | # First try fetching uri, u, from PREMIRRORS |
| 190 | mirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', d, 1) or "").split('\n') if i ] | 190 | mirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', d, 1) or "").split('\n') if i ] |
| 191 | if not try_mirrors(d, u, mirrors): | 191 | localpath = try_mirrors(d, u, mirrors) |
| 192 | if not localpath: | ||
| 192 | # Next try fetching from the original uri, u | 193 | # Next try fetching from the original uri, u |
| 193 | try: | 194 | try: |
| 194 | m.go(u, ud, d) | 195 | m.go(u, ud, d) |
| 196 | localpath = ud.localpath | ||
| 195 | except: | 197 | except: |
| 196 | # Finally, try fetching uri, u, from MIRRORS | 198 | # Finally, try fetching uri, u, from MIRRORS |
| 197 | mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', d, 1) or "").split('\n') if i ] | 199 | mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', d, 1) or "").split('\n') if i ] |
| 198 | try_mirrors (d, u, mirrors) | 200 | localpath = try_mirrors (d, u, mirrors) |
| 201 | |||
| 202 | if localpath: | ||
| 203 | ud.localpath = localpath | ||
| 199 | 204 | ||
| 200 | if ud.localfile: | 205 | if ud.localfile: |
| 201 | if not m.forcefetch(u, ud, d): | 206 | if not m.forcefetch(u, ud, d): |
| @@ -355,7 +360,7 @@ def try_mirrors(d, uri, mirrors): | |||
| 355 | fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri)) | 360 | fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri)) |
| 356 | if os.access(fpath, os.R_OK): | 361 | if os.access(fpath, os.R_OK): |
| 357 | bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath) | 362 | bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath) |
| 358 | return True | 363 | return fpath |
| 359 | 364 | ||
| 360 | ld = d.createCopy() | 365 | ld = d.createCopy() |
| 361 | for (find, replace) in mirrors: | 366 | for (find, replace) in mirrors: |
| @@ -371,14 +376,14 @@ def try_mirrors(d, uri, mirrors): | |||
| 371 | 376 | ||
| 372 | try: | 377 | try: |
| 373 | ud.method.go(newuri, ud, ld) | 378 | ud.method.go(newuri, ud, ld) |
| 374 | return True | 379 | return ud.localpath |
| 375 | except (bb.fetch.MissingParameterError, | 380 | except (bb.fetch.MissingParameterError, |
| 376 | bb.fetch.FetchError, | 381 | bb.fetch.FetchError, |
| 377 | bb.fetch.MD5SumError): | 382 | bb.fetch.MD5SumError): |
| 378 | import sys | 383 | import sys |
| 379 | (type, value, traceback) = sys.exc_info() | 384 | (type, value, traceback) = sys.exc_info() |
| 380 | bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value) | 385 | bb.msg.debug(2, bb.msg.domain.Fetcher, "Mirror fetch failure: %s" % value) |
| 381 | return False | 386 | return "" |
| 382 | 387 | ||
| 383 | 388 | ||
| 384 | class FetchData(object): | 389 | class FetchData(object): |
| @@ -415,8 +420,11 @@ class FetchData(object): | |||
| 415 | # We have to clear data's internal caches since the cached value of SRCREV is now wrong. | 420 | # We have to clear data's internal caches since the cached value of SRCREV is now wrong. |
| 416 | # Horrible... | 421 | # Horrible... |
| 417 | bb.data.delVar("ISHOULDNEVEREXIST", d) | 422 | bb.data.delVar("ISHOULDNEVEREXIST", d) |
| 418 | self.md5 = self.localpath + '.md5' | 423 | |
| 419 | self.lockfile = self.localpath + '.lock' | 424 | # Note: These files should always be in DL_DIR whereas localpath may not be. |
| 425 | basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) | ||
| 426 | self.md5 = basepath + '.md5' | ||
| 427 | self.lockfile = basepath + '.lock' | ||
| 420 | 428 | ||
| 421 | 429 | ||
| 422 | class Fetch(object): | 430 | class Fetch(object): |
