diff options
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 5f4c8300ef..6bce941fcb 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
| @@ -412,14 +412,28 @@ class FetchData(object): | |||
| 412 | # if user sets localpath for file, use it instead. | 412 | # if user sets localpath for file, use it instead. |
| 413 | self.localpath = self.parm["localpath"] | 413 | self.localpath = self.parm["localpath"] |
| 414 | else: | 414 | else: |
| 415 | try: | 415 | premirrors = bb.data.getVar('PREMIRRORS', d) |
| 416 | bb.fetch.srcrev_internal_call = True | 416 | local = "" |
| 417 | self.localpath = self.method.localpath(self.url, self, d) | 417 | if premirrors and self.url: |
| 418 | finally: | 418 | aurl = self.url.split(";")[0] |
| 419 | bb.fetch.srcrev_internal_call = False | 419 | mirrors = [ i.split() for i in (premirrors or "").split('\n') if i ] |
| 420 | # We have to clear data's internal caches since the cached value of SRCREV is now wrong. | 420 | for (find, replace) in mirrors: |
| 421 | # Horrible... | 421 | if replace.startswith("file://"): |
| 422 | bb.data.delVar("ISHOULDNEVEREXIST", d) | 422 | path = aurl.split("://")[1] |
| 423 | path = path.split(";")[0] | ||
| 424 | local = replace.split("://")[1] + os.path.basename(path) | ||
| 425 | if local == aurl or not os.path.exists(local) or os.path.isdir(local): | ||
| 426 | local = "" | ||
| 427 | self.localpath = local | ||
| 428 | if not local: | ||
| 429 | try: | ||
| 430 | bb.fetch.srcrev_internal_call = True | ||
| 431 | self.localpath = self.method.localpath(self.url, self, d) | ||
| 432 | finally: | ||
| 433 | bb.fetch.srcrev_internal_call = False | ||
| 434 | # We have to clear data's internal caches since the cached value of SRCREV is now wrong. | ||
| 435 | # Horrible... | ||
| 436 | bb.data.delVar("ISHOULDNEVEREXIST", d) | ||
| 423 | 437 | ||
| 424 | # Note: These files should always be in DL_DIR whereas localpath may not be. | 438 | # 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) | 439 | basepath = bb.data.expand("${DL_DIR}/%s" % os.path.basename(self.localpath), d) |
